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,533 +0,0 @@
|
|
|
1
|
-
#include "FortranFlukaIO.h"
|
|
2
|
-
|
|
3
|
-
#include "FlukaIO.h"
|
|
4
|
-
#include "FlukaIOServer.h"
|
|
5
|
-
#include <string.h>
|
|
6
|
-
|
|
7
|
-
#include <stdio.h>
|
|
8
|
-
|
|
9
|
-
#define FLUKAIO_MAX_CONNECTIONS 15
|
|
10
|
-
#define FLUKAIO_MAX_SERVERS 5
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Fortran can't handle pointers therefore an array storing the pointers is created
|
|
14
|
-
* and array indexes are given to fortran
|
|
15
|
-
*/
|
|
16
|
-
static flukaio_connection_t *connections[FLUKAIO_MAX_CONNECTIONS];
|
|
17
|
-
static flukaio_server_t *servers[FLUKAIO_MAX_SERVERS];
|
|
18
|
-
|
|
19
|
-
static flukaio_connection_t *get_connection(int cid);
|
|
20
|
-
static flukaio_server_t *get_server(int serverid);
|
|
21
|
-
|
|
22
|
-
/** particle buffer for ONLY one connection */
|
|
23
|
-
static particle_info_t *pbuffer=NULL;
|
|
24
|
-
static int pbuffer_pos=0;
|
|
25
|
-
static int pbuffer_max=0;
|
|
26
|
-
|
|
27
|
-
int store_connection(flukaio_connection_t *conn);
|
|
28
|
-
int store_server(flukaio_server_t *server);
|
|
29
|
-
|
|
30
|
-
int ntrecv_(
|
|
31
|
-
const int *cid,
|
|
32
|
-
uint8_t *type,
|
|
33
|
-
uint32_t *id, uint32_t *gen,
|
|
34
|
-
double *wgt,
|
|
35
|
-
double *x, double *y, double *z,
|
|
36
|
-
double *tx, double *ty, double *tz,
|
|
37
|
-
double *m, double *pc,
|
|
38
|
-
double *t,
|
|
39
|
-
int32_t *pdgid, int16_t *q,
|
|
40
|
-
double *sx, double *sy, double *sz)
|
|
41
|
-
{
|
|
42
|
-
ssize_t n = 0;
|
|
43
|
-
particle_info_t *particle = NULL;
|
|
44
|
-
flukaio_message_t msg;
|
|
45
|
-
flukaio_connection_t * conn = get_connection(*cid);
|
|
46
|
-
|
|
47
|
-
n = flukaio_receive_message(conn, &msg);
|
|
48
|
-
|
|
49
|
-
if (n <= 0)
|
|
50
|
-
return -1000+n;
|
|
51
|
-
|
|
52
|
-
if(type) *type = msg.type;
|
|
53
|
-
|
|
54
|
-
switch(msg.type) {
|
|
55
|
-
case N_PART:
|
|
56
|
-
particle = &msg.data.particle;
|
|
57
|
-
if(id) *id = particle->id;
|
|
58
|
-
if(gen) *gen = particle->gen;
|
|
59
|
-
if(wgt) *wgt = particle->weight;
|
|
60
|
-
|
|
61
|
-
if(x) *x = particle->x;
|
|
62
|
-
if(y) *y = particle->y;
|
|
63
|
-
if(z) *z = particle->z;
|
|
64
|
-
|
|
65
|
-
if(tx) *tx = particle->tx;
|
|
66
|
-
if(ty) *ty = particle->ty;
|
|
67
|
-
if(tz) *tz = particle->tz;
|
|
68
|
-
|
|
69
|
-
if(m) *m = particle->m;
|
|
70
|
-
if(pc) *pc = particle->pc;
|
|
71
|
-
if(t) *t = particle->t;
|
|
72
|
-
|
|
73
|
-
if(pdgid) *pdgid = particle->pdgid;
|
|
74
|
-
if(q) *q = particle->q;
|
|
75
|
-
if(sx) *sx = particle->sx;
|
|
76
|
-
if(sy) *sy = particle->sy;
|
|
77
|
-
if(sz) *sz = particle->sz;
|
|
78
|
-
break;
|
|
79
|
-
case N_IPT:
|
|
80
|
-
if(gen) *gen = msg.data.ipt.turn;
|
|
81
|
-
if(id) *id = msg.data.ipt.ipt;
|
|
82
|
-
break;
|
|
83
|
-
case N_EOB:
|
|
84
|
-
case N_END:
|
|
85
|
-
case N_ERR:
|
|
86
|
-
break;
|
|
87
|
-
default:
|
|
88
|
-
return -2;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return n;
|
|
92
|
-
} // ntrecv_
|
|
93
|
-
|
|
94
|
-
int ntsendp_( const int *cid,
|
|
95
|
-
const uint32_t *id, const uint32_t *gen,
|
|
96
|
-
const double *wgt,
|
|
97
|
-
const double *x, const double *y, const double *z,
|
|
98
|
-
const double *tx, const double *ty, const double *tz,
|
|
99
|
-
const double *m, const double *pc,
|
|
100
|
-
const double *t,
|
|
101
|
-
const int32_t *pdgid, const int16_t *q,
|
|
102
|
-
const double *sx, const double *sy, const double *sz)
|
|
103
|
-
{
|
|
104
|
-
flukaio_connection_t * conn = get_connection(*cid);
|
|
105
|
-
|
|
106
|
-
particle_info_t part;
|
|
107
|
-
part.id = *id;
|
|
108
|
-
part.gen = *gen;
|
|
109
|
-
part.weight = *wgt;
|
|
110
|
-
part.x = *x;
|
|
111
|
-
part.y = *y;
|
|
112
|
-
part.z = *z;
|
|
113
|
-
part.tx = *tx;
|
|
114
|
-
part.ty = *ty;
|
|
115
|
-
part.tz = *tz;
|
|
116
|
-
part.m = *m;
|
|
117
|
-
part.pc = *pc;
|
|
118
|
-
part.t = *t;
|
|
119
|
-
|
|
120
|
-
part.pdgid = *pdgid;
|
|
121
|
-
part.q = *q;
|
|
122
|
-
|
|
123
|
-
part.sx = *sx;
|
|
124
|
-
part.sy = *sy;
|
|
125
|
-
part.sz = *sz;
|
|
126
|
-
|
|
127
|
-
return flukaio_send_particle(conn, &part);
|
|
128
|
-
} // ntsendp_
|
|
129
|
-
|
|
130
|
-
int ntsendpbuf_(const int *cid,
|
|
131
|
-
const uint32_t *id, const uint32_t *gen,
|
|
132
|
-
const double *wgt,
|
|
133
|
-
const double *x, const double *y, const double *z,
|
|
134
|
-
const double *tx, const double *ty, const double *tz,
|
|
135
|
-
const double *m, const double *pc,
|
|
136
|
-
const double *t,
|
|
137
|
-
const int32_t *pdgid, const int16_t *q,
|
|
138
|
-
const double *sx, const double *sy, const double *sz)
|
|
139
|
-
{
|
|
140
|
-
if (pbuffer_pos >= pbuffer_max) {
|
|
141
|
-
if (pbuffer_max==0) {
|
|
142
|
-
pbuffer_max = 64; // initial size
|
|
143
|
-
pbuffer = (particle_info_t*)malloc(sizeof(particle_info_t)*pbuffer_max);
|
|
144
|
-
} else {
|
|
145
|
-
pbuffer_max <<= 1; // double the buffer
|
|
146
|
-
pbuffer = (particle_info_t*)realloc(pbuffer, sizeof(particle_info_t)*pbuffer_max);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
//flukaio_connection_t * conn = get_connection(*cid);
|
|
150
|
-
|
|
151
|
-
pbuffer[pbuffer_pos].id = *id;
|
|
152
|
-
pbuffer[pbuffer_pos].gen = *gen;
|
|
153
|
-
pbuffer[pbuffer_pos].weight = *wgt;
|
|
154
|
-
pbuffer[pbuffer_pos].x = *x;
|
|
155
|
-
pbuffer[pbuffer_pos].y = *y;
|
|
156
|
-
pbuffer[pbuffer_pos].z = *z;
|
|
157
|
-
pbuffer[pbuffer_pos].tx = *tx;
|
|
158
|
-
pbuffer[pbuffer_pos].ty = *ty;
|
|
159
|
-
pbuffer[pbuffer_pos].tz = *tz;
|
|
160
|
-
pbuffer[pbuffer_pos].m = *m;
|
|
161
|
-
pbuffer[pbuffer_pos].pc = *pc;
|
|
162
|
-
pbuffer[pbuffer_pos].t = *t;
|
|
163
|
-
|
|
164
|
-
pbuffer[pbuffer_pos].pdgid = *pdgid;
|
|
165
|
-
pbuffer[pbuffer_pos].q = *q;
|
|
166
|
-
pbuffer[pbuffer_pos].sx = *sx;
|
|
167
|
-
pbuffer[pbuffer_pos].sy = *sy;
|
|
168
|
-
pbuffer[pbuffer_pos].sz = *sz;
|
|
169
|
-
|
|
170
|
-
return ++pbuffer_pos;
|
|
171
|
-
// return flukaio_send_particle(conn, &part);
|
|
172
|
-
} // ntsendpbuf_
|
|
173
|
-
|
|
174
|
-
int ntsendeob_(const int *cid)
|
|
175
|
-
{
|
|
176
|
-
flukaio_connection_t* conn = get_connection(*cid);
|
|
177
|
-
|
|
178
|
-
if (pbuffer_pos>0) {
|
|
179
|
-
int i=0;
|
|
180
|
-
for (i=0; i<pbuffer_pos; i++) {
|
|
181
|
-
int err = flukaio_send_particle(conn, &pbuffer[i]);
|
|
182
|
-
if (err<0) return err;
|
|
183
|
-
}
|
|
184
|
-
pbuffer_pos = 0;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return flukaio_send_eob(conn);
|
|
188
|
-
} // ntsendeob_
|
|
189
|
-
|
|
190
|
-
int ntsendipt_(const int *cid, const uint32_t *turn, const uint16_t *ipt)
|
|
191
|
-
{
|
|
192
|
-
flukaio_connection_t* conn = get_connection(*cid);
|
|
193
|
-
return flukaio_send_ipt(conn, *turn, *ipt);
|
|
194
|
-
} // ntsendipt_
|
|
195
|
-
|
|
196
|
-
int ntsendeoc_(const int *cid)
|
|
197
|
-
{
|
|
198
|
-
flukaio_connection_t* conn = get_connection(*cid);
|
|
199
|
-
return flukaio_send_eoc(conn);
|
|
200
|
-
} // ntsendeoc_
|
|
201
|
-
|
|
202
|
-
int ntsendnpart_(const int *cid, const uint32_t *npart)
|
|
203
|
-
{
|
|
204
|
-
flukaio_connection_t* conn = get_connection(*cid);
|
|
205
|
-
return flukaio_send_npart(conn, *npart);
|
|
206
|
-
} // ntsendnpart_
|
|
207
|
-
|
|
208
|
-
int ntnpart_(const int *cid)
|
|
209
|
-
{
|
|
210
|
-
flukaio_message_t msg;
|
|
211
|
-
flukaio_connection_t* conn = get_connection(*cid);
|
|
212
|
-
|
|
213
|
-
if (flukaio_wait_message(conn, &msg)<0)
|
|
214
|
-
return -3;
|
|
215
|
-
|
|
216
|
-
if (msg.type == N_INT && msg.data.varint.id==N_NPART) {
|
|
217
|
-
return (int)msg.data.varint.value;
|
|
218
|
-
} else
|
|
219
|
-
return -4;
|
|
220
|
-
} // ntnpart_
|
|
221
|
-
|
|
222
|
-
int ntsendbrhono_(const int *cid, const double *brhono)
|
|
223
|
-
{
|
|
224
|
-
flukaio_connection_t* conn = get_connection(*cid);
|
|
225
|
-
return flukaio_send_double(conn, N_BRHONO, *brhono);
|
|
226
|
-
} // ntsendbrhono_
|
|
227
|
-
|
|
228
|
-
int ntbrho_(const int *cid, double *brhono)
|
|
229
|
-
{
|
|
230
|
-
flukaio_message_t msg;
|
|
231
|
-
flukaio_connection_t* conn = get_connection(*cid);
|
|
232
|
-
|
|
233
|
-
if (flukaio_wait_message(conn, &msg)<0)
|
|
234
|
-
return -5;
|
|
235
|
-
|
|
236
|
-
if (msg.type == N_DBLE && msg.data.vardouble.id==N_BRHONO) {
|
|
237
|
-
*brhono = msg.data.vardouble.value;
|
|
238
|
-
return 0;
|
|
239
|
-
} else {
|
|
240
|
-
*brhono = 0.0;
|
|
241
|
-
return -6;
|
|
242
|
-
}
|
|
243
|
-
} // ntbrho_
|
|
244
|
-
|
|
245
|
-
int ntwait_(
|
|
246
|
-
const int *cid,
|
|
247
|
-
uint8_t *type,
|
|
248
|
-
uint32_t *id, uint32_t *gen,
|
|
249
|
-
double *wgt,
|
|
250
|
-
double *x, double *y, double *z,
|
|
251
|
-
double *tx, double *ty, double *tz,
|
|
252
|
-
double *m, double *pc,
|
|
253
|
-
double *t,
|
|
254
|
-
int32_t *pdgid, int16_t *q,
|
|
255
|
-
double *sx, double *sy, double *sz)
|
|
256
|
-
{
|
|
257
|
-
ssize_t n = 0;
|
|
258
|
-
particle_info_t *particle = NULL;
|
|
259
|
-
flukaio_message_t msg;
|
|
260
|
-
flukaio_connection_t * conn = get_connection(*cid);
|
|
261
|
-
|
|
262
|
-
n = flukaio_wait_message(conn, &msg);
|
|
263
|
-
|
|
264
|
-
if (n <= 0)
|
|
265
|
-
return -2000+n;
|
|
266
|
-
|
|
267
|
-
if (type) *type = msg.type;
|
|
268
|
-
|
|
269
|
-
switch (msg.type) {
|
|
270
|
-
case N_PART:
|
|
271
|
-
particle = &msg.data.particle;
|
|
272
|
-
if(id) *id = particle->id;
|
|
273
|
-
if(gen) *gen = particle->gen;
|
|
274
|
-
if(wgt) *wgt = particle->weight;
|
|
275
|
-
|
|
276
|
-
if(x) *x = particle->x;
|
|
277
|
-
if(y) *y = particle->y;
|
|
278
|
-
if(z) *z = particle->z;
|
|
279
|
-
|
|
280
|
-
if(tx) *tx = particle->tx;
|
|
281
|
-
if(ty) *ty = particle->ty;
|
|
282
|
-
if(tz) *tz = particle->tz;
|
|
283
|
-
|
|
284
|
-
if(m) *m = particle->m;
|
|
285
|
-
if(pc) *pc = particle->pc;
|
|
286
|
-
if(t) *t = particle->t;
|
|
287
|
-
|
|
288
|
-
if(pdgid) *pdgid = particle->pdgid;
|
|
289
|
-
if(q) *q = particle->q;
|
|
290
|
-
if(sx) *sx = particle->sx;
|
|
291
|
-
if(sy) *sy = particle->sy;
|
|
292
|
-
if(sz) *sz = particle->sz;
|
|
293
|
-
break;
|
|
294
|
-
case N_IPT:
|
|
295
|
-
if(gen) *gen = msg.data.ipt.turn;
|
|
296
|
-
if(id) *id = msg.data.ipt.ipt;
|
|
297
|
-
break;
|
|
298
|
-
|
|
299
|
-
case N_EOB:
|
|
300
|
-
case N_END:
|
|
301
|
-
case N_ERR:
|
|
302
|
-
case N_INT:
|
|
303
|
-
case N_DBLE:
|
|
304
|
-
break;
|
|
305
|
-
default:
|
|
306
|
-
return -7;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
return n;
|
|
310
|
-
} // ntwait_
|
|
311
|
-
|
|
312
|
-
int ntserver_() {
|
|
313
|
-
flukaio_server_t *server = flukaio_server_create();
|
|
314
|
-
if (server)
|
|
315
|
-
return store_server(server);
|
|
316
|
-
return -8;
|
|
317
|
-
} // ntserver_
|
|
318
|
-
|
|
319
|
-
int ntstart_(const int *serverid, int *port) {
|
|
320
|
-
flukaio_server_t *server = get_server(*serverid);
|
|
321
|
-
if(server)
|
|
322
|
-
return flukaio_server_start(server, *port);
|
|
323
|
-
return -9;
|
|
324
|
-
} // ntstart_
|
|
325
|
-
|
|
326
|
-
int ntshdwn_(const int *serverid) {
|
|
327
|
-
flukaio_server_t *server = get_server(*serverid);
|
|
328
|
-
if(server) {
|
|
329
|
-
int ret = flukaio_server_shutdown(server);
|
|
330
|
-
// Update servers array
|
|
331
|
-
servers[*serverid] = NULL;
|
|
332
|
-
if (pbuffer) {
|
|
333
|
-
free(pbuffer);
|
|
334
|
-
pbuffer_max = pbuffer_pos = 0;
|
|
335
|
-
}
|
|
336
|
-
return ret;
|
|
337
|
-
}
|
|
338
|
-
return -10;
|
|
339
|
-
} // ntshdwn_
|
|
340
|
-
|
|
341
|
-
int ntgetport_(const int *serverid) {
|
|
342
|
-
flukaio_server_t *server = get_server(*serverid);
|
|
343
|
-
if(server)
|
|
344
|
-
return flukaio_server_get_port(server);
|
|
345
|
-
return -11;
|
|
346
|
-
} // ntgetport_
|
|
347
|
-
|
|
348
|
-
int ntaccept_(const int *serverid)
|
|
349
|
-
{
|
|
350
|
-
flukaio_server_t *server = get_server(*serverid);
|
|
351
|
-
if(server) {
|
|
352
|
-
int cid;
|
|
353
|
-
flukaio_connection_t *conn;
|
|
354
|
-
conn = flukaio_server_accept(server);
|
|
355
|
-
|
|
356
|
-
cid = store_connection(conn);
|
|
357
|
-
|
|
358
|
-
// No space left
|
|
359
|
-
if(cid < 0)
|
|
360
|
-
connection_destroy(conn);
|
|
361
|
-
|
|
362
|
-
return cid;
|
|
363
|
-
}
|
|
364
|
-
return -12;
|
|
365
|
-
} // ntaccept_
|
|
366
|
-
|
|
367
|
-
int ntend_(const int *cid) {
|
|
368
|
-
flukaio_connection_t * conn;
|
|
369
|
-
|
|
370
|
-
conn = get_connection(*cid);
|
|
371
|
-
|
|
372
|
-
if (conn == NULL)
|
|
373
|
-
return -13;
|
|
374
|
-
|
|
375
|
-
flukaio_disconnect(conn);
|
|
376
|
-
|
|
377
|
-
// Update connections array
|
|
378
|
-
connections[*cid] = NULL;
|
|
379
|
-
|
|
380
|
-
return 0;
|
|
381
|
-
} // ntend_
|
|
382
|
-
|
|
383
|
-
int ntrtimeout_(const int *cid, const int *seconds) {
|
|
384
|
-
flukaio_connection_t * conn;
|
|
385
|
-
|
|
386
|
-
conn = get_connection(*cid);
|
|
387
|
-
|
|
388
|
-
if (conn == NULL)
|
|
389
|
-
return -14;
|
|
390
|
-
|
|
391
|
-
return connection_set_read_timeout(conn, *seconds);
|
|
392
|
-
} // ntrtimeout_
|
|
393
|
-
|
|
394
|
-
int ntwtimeout_(const int *cid, const int *seconds) {
|
|
395
|
-
flukaio_connection_t * conn;
|
|
396
|
-
|
|
397
|
-
conn = get_connection(*cid);
|
|
398
|
-
|
|
399
|
-
if (conn == NULL)
|
|
400
|
-
return -15;
|
|
401
|
-
|
|
402
|
-
return connection_set_write_timeout(conn, *seconds);
|
|
403
|
-
} // ntwtimeout_
|
|
404
|
-
|
|
405
|
-
int ntconnect_(char *host, int *port, const long hostlen)
|
|
406
|
-
{
|
|
407
|
-
int cid;
|
|
408
|
-
char *chost;
|
|
409
|
-
chost = create_fortran_string(host, hostlen);
|
|
410
|
-
|
|
411
|
-
if (chost == NULL)
|
|
412
|
-
return -16;
|
|
413
|
-
|
|
414
|
-
flukaio_connection_t *conn = flukaio_connect(connection_create(-1), chost, *port);
|
|
415
|
-
if (conn == NULL)
|
|
416
|
-
return -17;
|
|
417
|
-
|
|
418
|
-
free(chost);
|
|
419
|
-
|
|
420
|
-
if (conn == NULL)
|
|
421
|
-
return -18;
|
|
422
|
-
|
|
423
|
-
cid = store_connection(conn);
|
|
424
|
-
if (cid < 0) // No space left, destroy connection
|
|
425
|
-
connection_destroy(conn);
|
|
426
|
-
|
|
427
|
-
return cid;
|
|
428
|
-
} // ntconnect_
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Initializes the list of connections and servers
|
|
432
|
-
*/
|
|
433
|
-
int ntinit_()
|
|
434
|
-
{
|
|
435
|
-
int i;
|
|
436
|
-
for (i = 0; i < FLUKAIO_MAX_CONNECTIONS; i++) {
|
|
437
|
-
connections[i] = NULL;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
for (i = 0; i < FLUKAIO_MAX_SERVERS; i++) {
|
|
441
|
-
servers[i] = NULL;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
return 0;
|
|
445
|
-
} // ntinit_
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Convert a fortran string to c string
|
|
449
|
-
*/
|
|
450
|
-
char* create_fortran_string(const char *str, const long str_len) {
|
|
451
|
-
long len;
|
|
452
|
-
char *rslt = NULL;
|
|
453
|
-
|
|
454
|
-
for(len = str_len-1; len >= 0; len--) {
|
|
455
|
-
if (str[len] != ' ')
|
|
456
|
-
break;
|
|
457
|
-
}
|
|
458
|
-
len++;
|
|
459
|
-
|
|
460
|
-
if (len < 0)
|
|
461
|
-
return NULL;
|
|
462
|
-
|
|
463
|
-
rslt = malloc(len+1);
|
|
464
|
-
strncpy(rslt, str, len);
|
|
465
|
-
rslt[len] = 0;
|
|
466
|
-
|
|
467
|
-
return rslt;
|
|
468
|
-
} // create_fortran_string
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Find connection data associated with cid
|
|
472
|
-
* @return connection object
|
|
473
|
-
*/
|
|
474
|
-
static flukaio_connection_t *get_connection(int cid)
|
|
475
|
-
{
|
|
476
|
-
return connections[cid];
|
|
477
|
-
} // get_connection
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Stores connection information an assigns it a connection id
|
|
481
|
-
* @return connection id, -1 if error
|
|
482
|
-
*/
|
|
483
|
-
int store_connection(flukaio_connection_t *conn)
|
|
484
|
-
{
|
|
485
|
-
int i;
|
|
486
|
-
|
|
487
|
-
if (conn == NULL)
|
|
488
|
-
return -19;
|
|
489
|
-
|
|
490
|
-
// Find an empty slot in connections to store connection data
|
|
491
|
-
for (i = 0; i < FLUKAIO_MAX_CONNECTIONS; i++) {
|
|
492
|
-
if (connections[i] == NULL)
|
|
493
|
-
{
|
|
494
|
-
connections[i] = conn;
|
|
495
|
-
return i;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
return -20;
|
|
500
|
-
} // store_connection
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* Find server data associated with serverid
|
|
504
|
-
* @return connection object
|
|
505
|
-
*/
|
|
506
|
-
static flukaio_server_t *get_server(int serverid)
|
|
507
|
-
{
|
|
508
|
-
return servers[serverid];
|
|
509
|
-
} // get_server
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Stores server information an assigns it a server id
|
|
513
|
-
* @return server id, -1 if error
|
|
514
|
-
*/
|
|
515
|
-
int store_server(flukaio_server_t *server)
|
|
516
|
-
{
|
|
517
|
-
int i;
|
|
518
|
-
|
|
519
|
-
if (server == NULL)
|
|
520
|
-
return -21;
|
|
521
|
-
|
|
522
|
-
// Find an empty slot in servers to store server data
|
|
523
|
-
for (i = 0; i < FLUKAIO_MAX_SERVERS; i++) {
|
|
524
|
-
if (servers[i] == NULL)
|
|
525
|
-
{
|
|
526
|
-
servers[i] = server;
|
|
527
|
-
return i;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
return -22;
|
|
533
|
-
} // store_server
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
src/FortranFlukaIO.o src/FortranFlukaIO.d: src/FortranFlukaIO.c \
|
|
2
|
-
include/FortranFlukaIO.h \
|
|
3
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stdint.h \
|
|
4
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdint.h \
|
|
5
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/features.h \
|
|
6
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/cdefs.h \
|
|
7
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/wordsize.h \
|
|
8
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/gnu/stubs.h \
|
|
9
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/gnu/stubs-64.h \
|
|
10
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/wchar.h \
|
|
11
|
-
include/FlukaIO.h \
|
|
12
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdlib.h \
|
|
13
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stddef.h \
|
|
14
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/waitflags.h \
|
|
15
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/waitstatus.h \
|
|
16
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/endian.h \
|
|
17
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/endian.h \
|
|
18
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/byteswap.h \
|
|
19
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/types.h \
|
|
20
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/types.h \
|
|
21
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/typesizes.h \
|
|
22
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/time.h \
|
|
23
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/select.h \
|
|
24
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/select.h \
|
|
25
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/sigset.h \
|
|
26
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/time.h \
|
|
27
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/sys/sysmacros.h \
|
|
28
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/pthreadtypes.h \
|
|
29
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/alloca.h \
|
|
30
|
-
include/Message.h include/ParticleInfo.h include/Connection.h \
|
|
31
|
-
include/FlukaIOServer.h \
|
|
32
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/string.h \
|
|
33
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/xlocale.h \
|
|
34
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h \
|
|
35
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/libio.h \
|
|
36
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/_G_config.h \
|
|
37
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/wchar.h \
|
|
38
|
-
/apps/miniforge3/envs/xcoll/lib/gcc/x86_64-conda-linux-gnu/13.2.0/include/stdarg.h \
|
|
39
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/stdio_lim.h \
|
|
40
|
-
/apps/miniforge3/envs/xcoll/x86_64-conda-linux-gnu/sysroot/usr/include/bits/sys_errlist.h
|
|
Binary file
|