xcoll 0.6.1__py3-none-any.whl → 0.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xcoll might be problematic. Click here for more details.
- xcoll/general.py +1 -1
- {xcoll-0.6.1.dist-info → xcoll-0.6.2.dist-info}/METADATA +5 -4
- xcoll-0.6.2.dist-info/RECORD +61 -0
- {xcoll-0.6.1.dist-info → xcoll-0.6.2.dist-info}/WHEEL +1 -1
- xcoll/__init__.py.orig +0 -26
- xcoll/general.py.orig +0 -20
- xcoll/initial_distribution.py.orig +0 -256
- xcoll/scattering_routines/fluka/flukaio/.git +0 -1
- xcoll/scattering_routines/fluka/flukaio/.gitignore +0 -2
- xcoll/scattering_routines/fluka/flukaio/CMakeLists.txt +0 -18
- xcoll/scattering_routines/fluka/flukaio/ComponentMakefile +0 -192
- xcoll/scattering_routines/fluka/flukaio/Makefile +0 -144
- xcoll/scattering_routines/fluka/flukaio/README +0 -26
- xcoll/scattering_routines/fluka/flukaio/doc/Doxyfile +0 -1551
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.asciidoc +0 -1054
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.epub +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.html +0 -1607
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO.pdf +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__1.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__2.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__3.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__4.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__5.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__6.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/FlukaIO__7.png +0 -0
- xcoll/scattering_routines/fluka/flukaio/doc/Makefile +0 -8
- xcoll/scattering_routines/fluka/flukaio/doc/docbook.xsl +0 -1690
- xcoll/scattering_routines/fluka/flukaio/include/Connection.h +0 -79
- xcoll/scattering_routines/fluka/flukaio/include/FlukaIO.h +0 -58
- xcoll/scattering_routines/fluka/flukaio/include/FlukaIOServer.h +0 -33
- xcoll/scattering_routines/fluka/flukaio/include/FortranFlukaIO.h +0 -277
- xcoll/scattering_routines/fluka/flukaio/include/Message.h +0 -89
- xcoll/scattering_routines/fluka/flukaio/include/ParticleInfo.h +0 -76
- xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
- xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.so +0 -0
- xcoll/scattering_routines/fluka/flukaio/samples/ClientTest.c +0 -156
- xcoll/scattering_routines/fluka/flukaio/samples/ServerTest.c +0 -123
- xcoll/scattering_routines/fluka/flukaio/samples/fclient.f +0 -149
- xcoll/scattering_routines/fluka/flukaio/samples/fserver.f +0 -118
- xcoll/scattering_routines/fluka/flukaio/src/Connection.c +0 -264
- xcoll/scattering_routines/fluka/flukaio/src/Connection.d +0 -69
- xcoll/scattering_routines/fluka/flukaio/src/Connection.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.c +0 -211
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.d +0 -46
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.c +0 -45
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.d +0 -29
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.h +0 -17
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.c +0 -84
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.d +0 -70
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer_private.h +0 -22
- xcoll/scattering_routines/fluka/flukaio/src/FlukaIO_private.h +0 -16
- xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.c +0 -533
- xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.d +0 -40
- xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/NetIO.c +0 -304
- xcoll/scattering_routines/fluka/flukaio/src/NetIO.d +0 -66
- xcoll/scattering_routines/fluka/flukaio/src/NetIO.h +0 -30
- xcoll/scattering_routines/fluka/flukaio/src/NetIO.o +0 -0
- xcoll/scattering_routines/fluka/flukaio/src/tags +0 -167
- xcoll/scattering_routines/fluka/flukaio/tests/AllTests.cpp +0 -8
- xcoll/scattering_routines/fluka/flukaio/tests/CommonTest.h +0 -10
- xcoll/scattering_routines/fluka/flukaio/tests/ConnectionTest.cpp +0 -99
- xcoll/scattering_routines/fluka/flukaio/tests/FlukaIOServerTest.cpp +0 -104
- xcoll/scattering_routines/fluka/flukaio/tests/FlukaIOTest.cpp +0 -439
- xcoll/scattering_routines/fluka/flukaio/tests/FortranFlukaIOTest.cpp +0 -682
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeConnection.c +0 -19
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeConnection.h +0 -16
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIO.c +0 -74
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIO.h +0 -50
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOHandshake.c +0 -16
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOHandshake.h +0 -20
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.c +0 -12
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFlukaIOServer.h +0 -18
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeFortranFlukaIO.h +0 -19
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.c +0 -80
- xcoll/scattering_routines/fluka/flukaio/tests/fakes/FakeNetIO.h +0 -35
- xcoll-0.6.1.dist-info/LICENSE +0 -201
- xcoll-0.6.1.dist-info/NOTICE +0 -2
- xcoll-0.6.1.dist-info/RECORD +0 -138
- /LICENSE → /xcoll-0.6.2.dist-info/LICENSE +0 -0
- /NOTICE → /xcoll-0.6.2.dist-info/NOTICE +0 -0
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
#include <stdio.h>
|
|
2
|
-
#include <stdlib.h>
|
|
3
|
-
#include <stdbool.h>
|
|
4
|
-
#include <signal.h>
|
|
5
|
-
#include <string.h>
|
|
6
|
-
#include <assert.h>
|
|
7
|
-
|
|
8
|
-
#include <unistd.h>
|
|
9
|
-
|
|
10
|
-
#include "FlukaIO.h"
|
|
11
|
-
|
|
12
|
-
#define NPARTS 20000
|
|
13
|
-
#define NTURNS 150
|
|
14
|
-
#define PORT 14999
|
|
15
|
-
|
|
16
|
-
static flukaio_connection_t *conn = NULL;
|
|
17
|
-
|
|
18
|
-
void die(char *msg);
|
|
19
|
-
void sigint_handler(int sig_no);
|
|
20
|
-
|
|
21
|
-
int main(int argc, char *argv[]) {
|
|
22
|
-
|
|
23
|
-
int port = PORT;
|
|
24
|
-
long i, j;
|
|
25
|
-
int n;
|
|
26
|
-
flukaio_message_t msg;
|
|
27
|
-
particle_info_t part;
|
|
28
|
-
|
|
29
|
-
part.id = 0;
|
|
30
|
-
part.gen = 1;
|
|
31
|
-
part.weight = 1.0;
|
|
32
|
-
part.x = -6.319439221E-01;
|
|
33
|
-
part.y = 1.147679085E+00;
|
|
34
|
-
part.z = 1.0;
|
|
35
|
-
part.tx = -3.856529999E-05;
|
|
36
|
-
part.ty = -2.004572999E-06;
|
|
37
|
-
part.tz = 5.004483739E-06;
|
|
38
|
-
part.aa = 1;
|
|
39
|
-
part.zz = 1;
|
|
40
|
-
part.m = 450e0;
|
|
41
|
-
part.pc = 4520e0;
|
|
42
|
-
part.t = 5E-3;
|
|
43
|
-
|
|
44
|
-
/* Install signal handler */
|
|
45
|
-
struct sigaction action;
|
|
46
|
-
memset(&action, 0, sizeof(action));
|
|
47
|
-
action.sa_handler = &sigint_handler;
|
|
48
|
-
action.sa_flags = SA_RESTART;
|
|
49
|
-
sigaction(SIGINT, &action, NULL);
|
|
50
|
-
action.sa_handler = SIG_IGN;
|
|
51
|
-
sigaction(SIGPIPE, &action, NULL);
|
|
52
|
-
|
|
53
|
-
/* Main */
|
|
54
|
-
conn = flukaio_connect(flukaio_conn(), "localhost", port);
|
|
55
|
-
if (conn == NULL)
|
|
56
|
-
{
|
|
57
|
-
die("Error connecting to server, wrong protocol version?");
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
printf("Connected to server\n");
|
|
61
|
-
for (j = 0; j < NTURNS; ++j)
|
|
62
|
-
{
|
|
63
|
-
printf("IPT %ld\n", j+1);
|
|
64
|
-
n = flukaio_send_ipt(conn, j+1, 0);
|
|
65
|
-
if (n < 0) {
|
|
66
|
-
die("Error occurred sending IPT");
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
for (i = 0; i < NPARTS; ++i)
|
|
70
|
-
{
|
|
71
|
-
part.id = (unsigned int)i+1;
|
|
72
|
-
n = flukaio_send_particle(conn, &part);
|
|
73
|
-
if (n < 0) {
|
|
74
|
-
die("Error occurred sending P");
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
#ifdef VERBOSE
|
|
78
|
-
printf(">");
|
|
79
|
-
#endif
|
|
80
|
-
// Read incomming messages
|
|
81
|
-
while (flukaio_receive_message(conn, &msg) > 0) {
|
|
82
|
-
#ifdef VERBOSE
|
|
83
|
-
if (msg.type == N_PART)
|
|
84
|
-
printf("<");
|
|
85
|
-
#endif
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
n = flukaio_send_eob(conn);
|
|
89
|
-
if (n < 0) {
|
|
90
|
-
die("Error occurred sending EOB");
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
#ifdef VERBOSE
|
|
94
|
-
printf("EOB\n");
|
|
95
|
-
#endif
|
|
96
|
-
// Read incomming messages until end of turn
|
|
97
|
-
do {
|
|
98
|
-
n = flukaio_wait_message(conn, &msg);
|
|
99
|
-
if (n == -1) {
|
|
100
|
-
die("Server timeout when waiting end of computation");
|
|
101
|
-
}
|
|
102
|
-
#ifdef VERBOSE
|
|
103
|
-
if (msg.type == N_PART)
|
|
104
|
-
printf("<");
|
|
105
|
-
#endif
|
|
106
|
-
} while (msg.type != N_EOB);
|
|
107
|
-
#ifdef VERBOSE
|
|
108
|
-
printf("t\n");
|
|
109
|
-
#endif
|
|
110
|
-
printf("Turn %ld finished\n", j+1);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
printf("\nDone sending particles\n");
|
|
114
|
-
printf("Closing connection...\n");
|
|
115
|
-
|
|
116
|
-
#ifdef VERBOSE
|
|
117
|
-
printf("f\n");
|
|
118
|
-
#endif
|
|
119
|
-
n = flukaio_send_eoc(conn);
|
|
120
|
-
if (n < 0) {
|
|
121
|
-
die("Error occurred sending");
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
n = flukaio_wait_message(conn, &msg);
|
|
125
|
-
if (n == -1) {
|
|
126
|
-
die("Server timeout when waiting end of computation");
|
|
127
|
-
}
|
|
128
|
-
if (msg.type != N_END) {
|
|
129
|
-
die("Unexpected message received");
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
flukaio_disconnect(conn);
|
|
133
|
-
conn = NULL;
|
|
134
|
-
|
|
135
|
-
return 0;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/* Close */
|
|
139
|
-
void die(char *msg) {
|
|
140
|
-
perror(msg);
|
|
141
|
-
|
|
142
|
-
if (conn)
|
|
143
|
-
{
|
|
144
|
-
flukaio_disconnect(conn);
|
|
145
|
-
conn = NULL;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
exit(1);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/* Signal handlers */
|
|
152
|
-
void sigint_handler(int sig_no)
|
|
153
|
-
{
|
|
154
|
-
die("Interrupted: Ending connection");
|
|
155
|
-
}
|
|
156
|
-
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
#include <stdlib.h>
|
|
2
|
-
#include <stdio.h>
|
|
3
|
-
|
|
4
|
-
#include <unistd.h>
|
|
5
|
-
#include <string.h>
|
|
6
|
-
#include <signal.h>
|
|
7
|
-
|
|
8
|
-
#include "FlukaIO.h"
|
|
9
|
-
#include "FlukaIOServer.h"
|
|
10
|
-
|
|
11
|
-
#define PORT 14999
|
|
12
|
-
|
|
13
|
-
static flukaio_connection_t *conn = NULL;
|
|
14
|
-
static flukaio_server_t *server = NULL;
|
|
15
|
-
void die(char *msg);
|
|
16
|
-
void sigint_handler(int sig_no);
|
|
17
|
-
|
|
18
|
-
/* */
|
|
19
|
-
int main(int argc, char *argv[]) {
|
|
20
|
-
|
|
21
|
-
int n;
|
|
22
|
-
flukaio_message_t msg;
|
|
23
|
-
uint32_t turn = 0;
|
|
24
|
-
uint32_t count = 0;
|
|
25
|
-
uint32_t total = 0;
|
|
26
|
-
|
|
27
|
-
/* Install signal handlers */
|
|
28
|
-
struct sigaction action;
|
|
29
|
-
memset(&action, 0, sizeof(action));
|
|
30
|
-
action.sa_handler = &sigint_handler;
|
|
31
|
-
action.sa_flags = SA_RESTART;
|
|
32
|
-
sigaction(SIGINT, &action, NULL);
|
|
33
|
-
action.sa_handler = SIG_IGN;
|
|
34
|
-
sigaction(SIGPIPE, &action, NULL);
|
|
35
|
-
|
|
36
|
-
server = flukaio_server_create();
|
|
37
|
-
if (!server)
|
|
38
|
-
{
|
|
39
|
-
die("** Error, create server object\n");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
n = flukaio_server_start(server, PORT);
|
|
43
|
-
if (n == -1)
|
|
44
|
-
{
|
|
45
|
-
die("** Error, could not start server\n");
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
printf("Listening on port %d\n", n);
|
|
49
|
-
|
|
50
|
-
while(1) {
|
|
51
|
-
|
|
52
|
-
printf("Waiting new connection...\n");
|
|
53
|
-
conn = flukaio_server_accept(server);
|
|
54
|
-
if (!conn) {
|
|
55
|
-
printf("Failed connection attempt, wrong protocol version?\n");
|
|
56
|
-
} else {
|
|
57
|
-
printf("New connection accepted\n");
|
|
58
|
-
count = 0;
|
|
59
|
-
//connection_set_read_timeout(conn, 20);
|
|
60
|
-
|
|
61
|
-
while (1) {
|
|
62
|
-
n = flukaio_wait_message(conn, &msg);
|
|
63
|
-
|
|
64
|
-
if (n < 0) {
|
|
65
|
-
printf("** Client timeout\n");
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (msg.type == N_IPT) {
|
|
70
|
-
turn = msg.data.ipt.turn;
|
|
71
|
-
printf("Starting turn %d\n", turn);
|
|
72
|
-
}
|
|
73
|
-
else if (msg.type == N_PART) {
|
|
74
|
-
count++;
|
|
75
|
-
n = flukaio_send_particle(conn, &msg.data.particle);
|
|
76
|
-
if (n < 0) {
|
|
77
|
-
printf("** Error occurred sending\n");
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else if (msg.type == N_EOB) {
|
|
82
|
-
printf("End of turn %d, received %d particles\n", turn, count);
|
|
83
|
-
flukaio_send_eob(conn);
|
|
84
|
-
total += count;
|
|
85
|
-
count = 0;
|
|
86
|
-
}
|
|
87
|
-
else if (msg.type == N_END) {
|
|
88
|
-
flukaio_send_eoc(conn);
|
|
89
|
-
printf("Connection finished\n");
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
flukaio_disconnect(conn);
|
|
95
|
-
conn = NULL;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
flukaio_server_shutdown(server);
|
|
100
|
-
|
|
101
|
-
return 0;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/* Close */
|
|
105
|
-
void die(char *msg) {
|
|
106
|
-
printf(msg);
|
|
107
|
-
|
|
108
|
-
if(conn)
|
|
109
|
-
{
|
|
110
|
-
flukaio_disconnect(conn);
|
|
111
|
-
conn = NULL;
|
|
112
|
-
}
|
|
113
|
-
flukaio_server_shutdown(server);
|
|
114
|
-
|
|
115
|
-
exit(1);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/* Signal handlers */
|
|
119
|
-
void sigint_handler(int sig_no)
|
|
120
|
-
{
|
|
121
|
-
die("\n** Shuting down server...");
|
|
122
|
-
}
|
|
123
|
-
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
program client
|
|
2
|
-
implicit none
|
|
3
|
-
|
|
4
|
-
integer PORT
|
|
5
|
-
integer NPARTS, NTURNS
|
|
6
|
-
parameter (PORT = 14999)
|
|
7
|
-
parameter (NPARTS = 20000, NTURNS = 150)
|
|
8
|
-
|
|
9
|
-
integer i, j, n
|
|
10
|
-
integer cid
|
|
11
|
-
|
|
12
|
-
integer mtype
|
|
13
|
-
integer turn, id, gen
|
|
14
|
-
double precision wgt, x, y, z, tx, ty, tz, m, pc, t
|
|
15
|
-
integer aa, zz
|
|
16
|
-
integer ntconnect, ntsendp, ntsendeob, ntsendipt
|
|
17
|
-
integer ntsendeoc, ntrecv, ntwait, ntend
|
|
18
|
-
integer ntsendnpart, ntnpart
|
|
19
|
-
integer ntsendbrhono, ntbrho
|
|
20
|
-
|
|
21
|
-
integer N_PART, N_EOB, N_END
|
|
22
|
-
parameter (N_PART = 1)
|
|
23
|
-
parameter (N_EOB = 2)
|
|
24
|
-
parameter (N_END = 3)
|
|
25
|
-
|
|
26
|
-
integer npart
|
|
27
|
-
double precision brho
|
|
28
|
-
|
|
29
|
-
turn = 0
|
|
30
|
-
id = 0
|
|
31
|
-
gen = 1
|
|
32
|
-
wgt = 1.0D+0
|
|
33
|
-
x = -6.319439221D-01
|
|
34
|
-
y = 1.147679085D+00
|
|
35
|
-
z = 1.0D+0
|
|
36
|
-
tx = -3.856529999D-05
|
|
37
|
-
ty = -2.004572999D-06
|
|
38
|
-
tz = 5.004483739D-06
|
|
39
|
-
aa = 1
|
|
40
|
-
zz = 1
|
|
41
|
-
m = 450.0D+0
|
|
42
|
-
pc = 4520.0D+0
|
|
43
|
-
t = 5.0D-3
|
|
44
|
-
|
|
45
|
-
call ntinit()
|
|
46
|
-
cid = ntconnect("localhost", PORT)
|
|
47
|
-
if (cid.eq.-1) then
|
|
48
|
-
write(*,*) "Error connecting to server"
|
|
49
|
-
goto 1000
|
|
50
|
-
end if
|
|
51
|
-
|
|
52
|
-
write(*,*) "Connected to server"
|
|
53
|
-
|
|
54
|
-
npart = 56000
|
|
55
|
-
n = ntsendnpart(cid, npart)
|
|
56
|
-
brho = 1.2345d0
|
|
57
|
-
n = ntsendbrhono(cid, brho)
|
|
58
|
-
|
|
59
|
-
do j = 1,NTURNS
|
|
60
|
-
|
|
61
|
-
turn = j
|
|
62
|
-
c Send ipt
|
|
63
|
-
write(*,*) "IPT ", j
|
|
64
|
-
n = ntsendipt(cid, j, 0)
|
|
65
|
-
if(n.lt.0) then
|
|
66
|
-
write(*,*) "Error sending IPT"
|
|
67
|
-
goto 900
|
|
68
|
-
end if
|
|
69
|
-
|
|
70
|
-
do i = 1,NPARTS
|
|
71
|
-
id = i
|
|
72
|
-
|
|
73
|
-
c Send particle
|
|
74
|
-
n = ntsendp(cid, id, gen, wgt,
|
|
75
|
-
& x, y, z, tx, ty, tz, aa, zz, m, pc, t)
|
|
76
|
-
if(n.lt.0) then
|
|
77
|
-
write(*,*) "Error sending P"
|
|
78
|
-
write(*,*) id, wgt, x, y, z, tx, ty, tz, aa, zz, m, pc, t
|
|
79
|
-
goto 900
|
|
80
|
-
end if
|
|
81
|
-
|
|
82
|
-
c Read all incoming particles to release server out buffer
|
|
83
|
-
100 continue
|
|
84
|
-
n = ntrecv(cid, mtype, id, gen, wgt,
|
|
85
|
-
& x, y, z, tx, ty, tz, aa, zz, m, pc, t)
|
|
86
|
-
if(n.gt.0) then
|
|
87
|
-
goto 100
|
|
88
|
-
end if
|
|
89
|
-
c End of reading incoming particles
|
|
90
|
-
|
|
91
|
-
end do ! Done sending current turn particles
|
|
92
|
-
|
|
93
|
-
c Send end of turn
|
|
94
|
-
write(*,*) "End of turn ", j
|
|
95
|
-
n = ntsendeob(cid)
|
|
96
|
-
if(n.lt.0) then
|
|
97
|
-
write(*,*) "Error sending T"
|
|
98
|
-
goto 900
|
|
99
|
-
end if
|
|
100
|
-
|
|
101
|
-
c + Wait until end of turn (Synchronize)
|
|
102
|
-
c |
|
|
103
|
-
200 continue
|
|
104
|
-
n = ntwait(cid, mtype, id, gen, wgt,
|
|
105
|
-
& x, y, z, tx, ty, tz, aa, zz, m, pc, t)
|
|
106
|
-
if(n.eq.-1) then
|
|
107
|
-
write(*,*) "Server timed out while waiting end of turn"
|
|
108
|
-
goto 900
|
|
109
|
-
end if
|
|
110
|
-
if(mtype.ne.N_EOB) then
|
|
111
|
-
goto 200
|
|
112
|
-
end if
|
|
113
|
-
c |
|
|
114
|
-
c + Finished waiting end of turn
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
end do ! Turn loop
|
|
118
|
-
|
|
119
|
-
write(*,*) "Done sending particles"
|
|
120
|
-
write(*,*) "Closing connection..."
|
|
121
|
-
|
|
122
|
-
c Send end of computation
|
|
123
|
-
n = ntsendeoc(cid)
|
|
124
|
-
if(n.lt.0) then
|
|
125
|
-
write(*,*) "Error sending F"
|
|
126
|
-
goto 900
|
|
127
|
-
end if
|
|
128
|
-
|
|
129
|
-
c Wait end of comp
|
|
130
|
-
n = ntwait(cid, mtype, id, gen, wgt,
|
|
131
|
-
& x, y, z, tx, ty, tz, aa, zz, m, pc, t)
|
|
132
|
-
if(n.eq.-1) then
|
|
133
|
-
write(*,*) "Server timed out while waiting end of comp"
|
|
134
|
-
goto 900
|
|
135
|
-
end if
|
|
136
|
-
if(mtype.ne.N_END) then
|
|
137
|
-
write(*,*) "Unexpected message received"
|
|
138
|
-
end if
|
|
139
|
-
c Both ends agreed to disconnect
|
|
140
|
-
|
|
141
|
-
900 continue ! Error while connected
|
|
142
|
-
|
|
143
|
-
c Finish connection
|
|
144
|
-
n = ntend(cid)
|
|
145
|
-
|
|
146
|
-
1000 continue ! Error connecting
|
|
147
|
-
|
|
148
|
-
stop
|
|
149
|
-
end
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
program server
|
|
2
|
-
implicit none
|
|
3
|
-
|
|
4
|
-
integer sid ! Server id
|
|
5
|
-
integer cid ! Connection id
|
|
6
|
-
integer n
|
|
7
|
-
integer count
|
|
8
|
-
integer total
|
|
9
|
-
integer PORT
|
|
10
|
-
parameter (PORT = 14999)
|
|
11
|
-
|
|
12
|
-
integer mtype
|
|
13
|
-
integer turn, id, gen
|
|
14
|
-
double precision wgt, x, y, z, tx, ty, tz, m, pc, t
|
|
15
|
-
integer aa, zz
|
|
16
|
-
integer ntaccept, ntstart, ntsendp, ntsendeob, ntserver
|
|
17
|
-
integer ntsendeoc, ntshdwn, ntwait, ntend
|
|
18
|
-
integer ntsendnpart, ntnpart
|
|
19
|
-
integer ntsendbrhono, ntbrho
|
|
20
|
-
|
|
21
|
-
integer N_PART, N_EOB, N_END, N_IPT
|
|
22
|
-
parameter (N_PART = 1)
|
|
23
|
-
parameter (N_EOB = 2)
|
|
24
|
-
parameter (N_END = 3)
|
|
25
|
-
parameter (N_IPT = 5)
|
|
26
|
-
|
|
27
|
-
integer npart
|
|
28
|
-
double precision brho
|
|
29
|
-
|
|
30
|
-
! Initialize fluka connections
|
|
31
|
-
call ntinit()
|
|
32
|
-
|
|
33
|
-
sid = ntserver()
|
|
34
|
-
if(sid.eq.-1) then
|
|
35
|
-
write(*,*) "Error creating the server"
|
|
36
|
-
stop
|
|
37
|
-
end if
|
|
38
|
-
! Listen
|
|
39
|
-
n = ntstart(sid, PORT)
|
|
40
|
-
if(n.eq.-1) then
|
|
41
|
-
write(*,*) "Error cannot start server"
|
|
42
|
-
stop
|
|
43
|
-
end if
|
|
44
|
-
|
|
45
|
-
write(*,*) "Listening on port ", n
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
100 continue ! while(1)
|
|
49
|
-
write(*,*) "** Waiting for new connection"
|
|
50
|
-
cid = ntaccept(sid)
|
|
51
|
-
|
|
52
|
-
npart = ntnpart(cid)
|
|
53
|
-
write(*,*) ">>>>>>>>> npart=",npart
|
|
54
|
-
n = ntbrho(cid, brho)
|
|
55
|
-
write(*,*) ">>>>>>>>> brho=",brho, n
|
|
56
|
-
|
|
57
|
-
if(.not.cid.lt.0) then
|
|
58
|
-
write(*,*) "** New connection accepted"
|
|
59
|
-
! n = nttimeout(cid, 20)
|
|
60
|
-
|
|
61
|
-
total = 0
|
|
62
|
-
count = 0
|
|
63
|
-
|
|
64
|
-
200 continue ! while(1)
|
|
65
|
-
|
|
66
|
-
n = ntwait(cid,
|
|
67
|
-
& mtype, id, gen, wgt,
|
|
68
|
-
& x, y, z, tx, ty, tz, aa, zz, m, pc, t)
|
|
69
|
-
if(n.lt.0) then
|
|
70
|
-
write(*,*) "Client timeout"
|
|
71
|
-
goto 900
|
|
72
|
-
end if
|
|
73
|
-
|
|
74
|
-
if(mtype.eq.N_PART) then
|
|
75
|
-
count = count + 1
|
|
76
|
-
! write(*,*) "<"
|
|
77
|
-
n = ntsendp(cid,
|
|
78
|
-
& id, gen, wgt,
|
|
79
|
-
& x, y, z, tx, ty, tz, aa, zz, m, pc, t)
|
|
80
|
-
|
|
81
|
-
if(n.lt.0) then
|
|
82
|
-
write(*,*) "Error sending"
|
|
83
|
-
goto 900
|
|
84
|
-
end if
|
|
85
|
-
! write(*,*) ">"
|
|
86
|
-
else if(mtype.eq.N_IPT) then
|
|
87
|
-
!ipt = id
|
|
88
|
-
turn = gen
|
|
89
|
-
else if(mtype.eq.N_EOB) then
|
|
90
|
-
! write(*,*) "T"
|
|
91
|
-
write(*,*) " End of turn ", turn, " received ", count,
|
|
92
|
-
& " particles"
|
|
93
|
-
n = ntsendeob(cid)
|
|
94
|
-
total = total + count
|
|
95
|
-
count = 0
|
|
96
|
-
else if(mtype.eq.N_END) then
|
|
97
|
-
! write(*,*) "F"
|
|
98
|
-
n = ntsendeoc(cid)
|
|
99
|
-
! write(*,*) "f"
|
|
100
|
-
write(*,*) "** Connection closed"
|
|
101
|
-
goto 900
|
|
102
|
-
end if
|
|
103
|
-
|
|
104
|
-
goto 200
|
|
105
|
-
|
|
106
|
-
900 continue
|
|
107
|
-
|
|
108
|
-
n = ntend(cid)
|
|
109
|
-
cid = -1
|
|
110
|
-
|
|
111
|
-
end if
|
|
112
|
-
|
|
113
|
-
goto 100
|
|
114
|
-
|
|
115
|
-
! Finished shutdown server
|
|
116
|
-
n = ntshdwn(sid)
|
|
117
|
-
|
|
118
|
-
end
|