OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
rad2rad_c.c
Go to the documentation of this file.
1//Copyright> OpenRadioss
2//Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3//Copyright>
4//Copyright> This program is free software: you can redistribute it and/or modify
5//Copyright> it under the terms of the GNU Affero General Public License as published by
6//Copyright> the Free Software Foundation, either version 3 of the License, or
7//Copyright> (at your option) any later version.
8//Copyright>
9//Copyright> This program is distributed in the hope that it will be useful,
10//Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11//Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//Copyright> GNU Affero General Public License for more details.
13//Copyright>
14//Copyright> You should have received a copy of the GNU Affero General Public License
15//Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16//Copyright>
17//Copyright>
18//Copyright> Commercial Alternative: Altair Radioss Software
19//Copyright>
20//Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21//Copyright> software under a commercial license. Contact Altair to discuss further if the
22//Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23#include "hardware.inc"
24
25#include "pipes_c.inc"
26#include "my_real_c.inc"
27#include <stdio.h>
28#include <string.h>
29#include <stdlib.h>
30#include <math.h>
31#include <fcntl.h>
32
33#ifdef _WIN64
34
35#include <sys/types.h>
36#include <sys/stat.h>
37#include <io.h>
38#include <process.h>
39#include <errno.h>
40#include <signal.h>
41#include <winsock2.h>
42#include <Winbase.h>
43#include <windows.h>
44#include <ws2tcpip.h>
45#include <ctype.h>
46#include <stdio.h>
47#include <tchar.h>
48#include <strsafe.h>
49#pragma comment(lib, "Ws2_32.lib")
50
51// Dummy signals definition
52#define SIGHUP 1
53#define SIGQUIT 3
54#define SIGBUS 10
55#define SIGPIPE 13
56#define _FCALL
57
58#define send_type char*
59
60#elif 1
61
62#include <semaphore.h>
63#include <sys/socket.h>
64#include <netinet/in.h>
65#include <netdb.h>
66#include <sys/resource.h>
67#include <sys/types.h>
68#include <sys/param.h>
69#include <sys/stat.h>
70#include <sys/signal.h>
71#include <signal.h>
72#include <unistd.h>
73#include <sys/mman.h>
74#include <errno.h>
75#include <time.h>
76#include <sched.h>
77#define _FCALL
78
79#define send_type void*
80
81#endif
82
83
84#define FALSE 0
85#define TRUE 1
86#define SERV_TCP_PORT1 18347
87#define SERV_TCP_PORT0 18344
88
89/**************************************************************************/
90
91#define PERM 0640
92#define ROOTLEN 80
93#define NAMESIZE 252
94#define BUFSIZE 3*PIPE_BUF
95#define buftop "top"
96#define MAX_LEN 10000
97#define my_max(a,b)(a>=b?a:b)
98
99struct region {
100 my_real_c *fx_buf;
101 my_real_c *fr_buf;
102 my_real_c *sx_buf;
103 my_real_c *sr_buf;
104 my_real_c *vx_buf;
105 my_real_c *vr_buf;
106 my_real_c *mass_buf;
107 my_real_c *iner_buf;
108 my_real_c *iner_rby_buf;
109 double *dx_buf;
110 int *buf;
111 int *itagr;
112 int *itagr2;
113 int *itags;
114 int *itags2;
115 int *tagelr;
116 int *tagels;
117 int *iactv;
118};
119
120
122
123char fifo_1[NAMESIZE], fifo_2[NAMESIZE], semaphore_int[NAMESIZE]; /* private fifos */
125
128static int *flagrot,**masterdb;
129static int i7flag = 0, flag_siu= 0, flg_sphinout = 0, compt_resize = 0;
130static int nbufvar = PIPE_BUF / sizeof(my_real_c);
131static my_real_c fx_buf[BUFSIZE];
132static my_real_c fr_buf[BUFSIZE];
133static my_real_c sx_buf[PIPE_BUF];
134static my_real_c sr_buf[PIPE_BUF];
135static my_real_c vx_buf[BUFSIZE];
136static my_real_c vr_buf[BUFSIZE];
137static double dx_buf[4*BUFSIZE];
138static my_real_c ms_buf[PIPE_BUF];
139static my_real_c in_buf[PIPE_BUF];
140static my_real_c in_rby_buf[3*BUFSIZE];
141
142
143#ifdef _WIN64
144 HANDLE *sem_int;
145 HANDLE shmidv;
146 HANDLE fidw, fidr;
147 HANDLE handler_array[2];
148#elif 1
151 static int fidw, fidr;
152#endif
153
154#include <rad2rad_c.h>
155/*---------------------------------------------------------------------*/
156
157
158void openfifo_c(int *iroot,int *len,int *fdw,int *fdr,int *sd,int *ispmd,int *nthr,int *ppid)
159{
160int i, naps, sock,val;
161char messtop[512];
162#ifdef DNC
163
164 nthreads = *nthr;
165 ispmd_glob = *ispmd;
166#ifdef _WIN64
167 *ppid = _getpid();
168#elif 1
169 *ppid = getpid();
170#endif
171
172 for (i = 0; i < *len; i++)
173 root[i] = (char) iroot[i];
174 root[i] = '\0';
175
176#ifdef _WIN64
177 sprintf(fifo_1,"\\\\.\\pipe\\Fifo_%d_%s_1",*ispmd,root);
178 sprintf(fifo_2,"\\\\.\\pipe\\Fifo_%d_%s_2",*ispmd,root);
179#elif 1
180 sprintf(fifo_1,"Fifo_%d_%s_1", *ispmd, root);
181 sprintf(fifo_2,"Fifo_%d_%s_2", *ispmd, root);
182#endif
183
184#ifdef _WIN64
185 sock = *sd;
186 if (recv(sock,(send_type)messtop,3*sizeof(char), 0) == -1){
187 perror("recv top fifo");
188 exit(1);}
189 fidr = CreateFile((const char*)&fifo_1,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
190 if (fidr == INVALID_HANDLE_VALUE)
191 fatal("Can't open fifo 1");
192 fidw = CreateFile((const char*)&fifo_2,GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
193 if (fidw == INVALID_HANDLE_VALUE)
194 fatal("Can't open fifo 2");
195 if (send(sock,(send_type)buftop,3*sizeof(char), 0) == -1){
196 perror("send top fifo");
197 exit(1);}
198
199 handler_array[0]=fidw;
200 handler_array[1]=fidr;
201 *fdw = 0;
202 *fdr = 1;
203#elif 1
204 for (naps = 0; naps < 15; naps++)
205 {
206 if ((fidr = open(fifo_1, O_RDONLY)) != -1) break;
207 else if (errno == ENOENT) sleep(1);
208 else
209 fatal("Radioss external link: can't open fifo");
210 }
211
212 if (fidr == -1)
213 fatal("Can't open fifo after 15 naps");
214
215 if ((fidw = open(fifo_2, O_WRONLY)) == -1)
216 fatal("Radioss external link: can't open fifo");
217 *fdw = (int)fidw;
218 *fdr = (int)fidr;
219#endif
220 if (*ispmd == 0) printf(" MULTIDOMAINS COUPLING- \n");
221
222 /********************opening of semaphore**********************/
223#ifdef _WIN64
224 sem_int = CreateSemaphore(NULL,0,128,NULL);
225 if (sem_int == NULL) {printf("error creation semahpore %lu\n",GetLastError());}
226#elif 1
227 if (flag_siu==0) if (sem_init(&sem_int, 0, 0) == -1) perror("error creation semahpore");
228#endif
229#endif
230}
231
232
233void _FCALL OPENFIFO_C(int *iroot,int *len,int *fdw,int *fdr,int *sd,int *ispmd,int *nthr,int *ppid){
234 openfifo_c(iroot,len,fdw,fdr,sd,ispmd,nthr,ppid);
235}
236
237void openfifo_c_(int *iroot,int *len,int *fdw,int *fdr,int *sd,int *ispmd,int *nthr,int *ppid){
238 openfifo_c(iroot,len,fdw,fdr,sd,ispmd,nthr,ppid);
239}
240
241void openfifo_c__(int *iroot,int *len,int *fdw,int *fdr,int *sd,int *ispmd,int *nthr,int *ppid){
242 openfifo_c(iroot,len,fdw,fdr,sd,ispmd,nthr,ppid);}
243
244/******************************************************************************/
245
246void opensem_c(int *iroot,int *len,int *ispmd,int *nthr,int *ppid)
247{
248int i, naps, sock,val;
249char messtop[512];
250
251 flag_siu = 1;
252 nthreads = *nthr;
253
254 for (i = 0; i < *len; i++) root[i] = (char) iroot[i];
255 root[i] = '\0';
256
257 val = 0;
258 sprintf(semaphore_int,"Sema_int_%d_%s_%d", val, root, *ppid);
259
260 /********************opening of semaphore**********************/
261#ifdef _WIN64
262 sem_int = CreateSemaphore(NULL,0,128,semaphore_int);
263 if (sem_int == NULL) {printf("error creation semahpore %lu\n",GetLastError());}
264#elif 1
265 if (*ispmd == 0) sem_glob = sem_open(semaphore_int, O_CREAT | O_EXCL, 0644, 0);
266 else sem_glob = sem_open(semaphore_int, 0);
267 if (sem_glob == SEM_FAILED) {perror("error semaphore engine");exit(1);}
268#endif
269}
270
271
272void _FCALL OPENSEM_C(int *iroot,int *len,int *ispmd,int *nthr,int *ppid){
273 opensem_c(iroot,len,ispmd,nthr,ppid);
274}
275
276void opensem_c_(int *iroot,int *len,int *ispmd,int *nthr,int *ppid){
277 opensem_c(iroot,len,ispmd,nthr,ppid);
278}
279
280void opensem_c__(int *iroot,int *len,int *ispmd,int *nthr,int *ppid){
281 opensem_c(iroot,len,ispmd,nthr,ppid);}
282
283/******************************************************************************/
285{
286int global_len,global_leni,local_len,offset,offseti,mclo,bid;
287int *shmi;
288my_real_c *shm;
289char add_shm[NAMESIZE],add_shmi[NAMESIZE];
290#ifdef _WIN64
291HANDLE shmid,shmidi;
292#elif 1
293int shmid,shmidi;
294#endif
295
296#ifdef DNC
297
298 shmvr_size = 150;
299 shmvs_size = 150;
300
301 readr(fidr, (void *) &offset, sizeof(int));
302 readr(fidr, (void *) &offseti, sizeof(int));
303 readr(fidr, (void *) &global_len, sizeof(int));
304 readr(fidr, (void *) &global_leni, sizeof(int));
305 readr(fidr, (void *) &local_len, sizeof(int));
306 readr(fidr, (void *) &r2r_id, sizeof(int));
307 readr(fidr, (void *) &proc_id, sizeof(int));
308 readr(fidr, (void *) &flg_sphinout, sizeof(int));
309 sprintf(add_shm,"Adress_shm_%d_%d",ispmd_glob,r2r_id);
310 sprintf(add_shmi,"Adress_shmi_%d_%d",ispmd_glob,r2r_id);
311 sprintf(add_shmv,"Adress_shmv_%d_%d_%d",proc_id,ispmd_glob,r2r_id);
312
313 /***********************shared memory**************************/
314#ifdef _WIN64
315 shmid = CreateFileMapping (INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, global_len*sizeof(my_real_c), add_shm);
316 shm = MapViewOfFile(shmid, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
317 shmidi = CreateFileMapping (INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, global_leni*sizeof(int), add_shmi);
318 shmi = MapViewOfFile(shmidi, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
319 shmidv = CreateFileMapping (INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (shmvr_size+shmvs_size)*sizeof(int), add_shmv);
320 shmv = MapViewOfFile(shmidv, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
321#elif 1
322 shmid = shm_open(add_shm, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); if (shmid == -1) {perror("shmopen");exit(1);}
323 shm = mmap(NULL, global_len*sizeof(my_real_c),PROT_WRITE | PROT_READ, MAP_SHARED, shmid, 0); if (shm == MAP_FAILED) {perror("mmap");exit(1);}
324 shmidi = shm_open(add_shmi, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); if (shmid == -1) {perror("shmopen");exit(1);}
325 shmi = mmap(NULL, global_leni*sizeof(int),PROT_WRITE | PROT_READ, MAP_SHARED, shmidi, 0); if (shmi == MAP_FAILED) {perror("mmap");exit(1);}
326 shmidv = shm_open(add_shmv, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); if (shmidv == -1) {perror("shmopen");exit(1);}
327 shmv = mmap(NULL, (shmvr_size+shmvs_size)*sizeof(int),PROT_WRITE | PROT_READ, MAP_SHARED, shmidv, 0); if (shmv == MAP_FAILED) {perror("mmap");exit(1);}
328#endif
329 if((com = (struct region *) malloc(sizeof(struct region))) == NULL) syserr_fatal("Malloc");
330 com->mass_buf = shm + offset;
331 com->iner_buf = shm + offset + local_len;
332 com->iner_rby_buf = shm + offset + 2*local_len;
333 com->fx_buf = shm + offset + 11*local_len;
334 com->fr_buf = shm + offset + 14*local_len;
335 com->sx_buf = shm + offset + 17*local_len;
336 com->sr_buf = shm + offset + 18*local_len;
337 com->vx_buf = shm + offset + 19*local_len;
338 com->vr_buf = shm + offset + 22*local_len;
339 com->dx_buf = (double*) (shm + offset + 25*local_len);
340 com->buf = shmi + offseti ;
341 com->itagr = shmi + offseti + 10;
342 com->itagr2 = shmi + offseti + 10 + local_len;
343 com->itags = shmi + offseti + 10 + 2*local_len;
344 com->itags2 = shmi + offseti + 10 + 3*local_len;
345 if (flg_sphinout == 1) com->iactv = shmi + offseti + 10 + 4*local_len;
346
347 com->tagelr = shmv ;
348 com->tagels = shmv + shmvr_size;
349
350 bid = 0;
351 writer(fidw, (void *) &bid, sizeof(int));
352#endif
353}
354
355
357{
358 openshm_c();
359}
361{
362 openshm_c();
363}
365{openshm_c();}
366
367/******************************************************************************/
368
369void r2r_unlock_threads_c(int *nthr) {
370 int i;
371 for (i = 0; i < *nthr; i++) {
372#ifdef _WIN64
373 if (!ReleaseSemaphore(sem_int, 1, NULL)) {
374 printf("release semaphore: %lu\n", GetLastError());
375 }
376#elif 1
377 if (flag_siu == 0) {
378 if (sem_post(&sem_int) == -1) {
379 perror("send");
380 exit(1);
381 }
382 } else {
383 if (sem_post(sem_glob) == -1) {
384 perror("send");
385 exit(1);
386 }
387 }
388#endif
389 }
390}
391
394}
395
396void r2r_unlock_threads_c_(int *nthr){
398}
399
400void r2r_unlock_threads__(int *nthr){
402}
403
404/******************************************************************************/
405
407{
408#ifdef _WIN64
409 DWORD dwWaitResult;
410 dwWaitResult = WaitForSingleObject(sem_int,18000);
411#elif 1
412 if (flag_siu==0) {if (sem_wait(&sem_int)==-1) {perror("send");exit(1);}}
413 else {if (sem_wait(sem_glob)==-1) {perror("send");exit(1);}}
414#endif
415}
416
418{
419 r2r_block_c();
420}
422{
423 r2r_block_c();
424}
427
428/******************************************************************************/
429
431{
432int bid;
433
434 bid = 0;
435 writer(fidw, (void *) &bid,sizeof(int));
436}
437
439{
440 r2r_sem_c();
441}
443{
444 r2r_sem_c();
445}
447{r2r_sem_c();}
448
449/******************************************************************************/
450
451void init_link_c(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *info, int *typ, int *cdt, int *cdr, int *print, int *rddl, int *nlink, my_real_c *dx)
452{
453 int i, j, t, nn, lbuf, lbuf1, init_buf[6], lbufa, lbufb, lbufel, dimno, k, capt, g, m, w, nbel, id, ref, lus;
454 int *nodid, *nbelem, *cnelem, *cnelem2, *cnelem3, *listel, *listelnbn, *listel2, *listel2nbn, *listelno, **tabl, nbn, *bcs;
455 my_real_c *crd;
456
457 lbuf = *nng * sizeof(my_real_c);
458 flagrot = (int *)malloc(*nlink * 2 * sizeof(int));
459 iroddl = *rddl;
460 crd = (my_real_c *)malloc(3 * lbuf);
461 lbuf1 = *nng * sizeof(int);
462 dimno = 0;
463 nbel = 0;
464 t = 0;
465 k = 0;
466 nodid = (int *)malloc(lbuf1);
467 bcs = (int *)malloc(lbuf1);
468
469 if (*typ > 3) {
470 /************************coupling type 4, 5 and 6*****************************/
471 /*****************************************************************************/
472 for (i = 0; i < *nng; i++) {
473 nn = nodbuf[i] - 1;
474 crd[3 * i] = x[3 * nn] - dx[3 * nn];
475 crd[3 * i + 1] = x[3 * nn + 1] - dx[3 * nn + 1];
476 crd[3 * i + 2] = x[3 * nn + 2] - dx[3 * nn + 2];
477
478 nodid[i] = itab[nn];
479 bcs[i] = 10 * cdt[nn];
480 if (*rddl)
481 bcs[i] += cdr[nn];
482 }
483
484 id = *igd;
485 init_buf[0] = *igd;
486 init_buf[1] = *nng;
487 init_buf[2] = dimno;
488 init_buf[3] = 0;
489 init_buf[4] = 0;
490 init_buf[5] = *print;
491
492 writer(fidw, (void *)init_buf, 6 * sizeof(int));
493 writer(fidw, (void *)nodid, lbuf1);
494 writer(fidw, (void *)bcs, lbuf1);
495 writer(fidw, (void *)crd, 3 * lbuf);
496 } else {
497 /************************coupling type 1 and 2********************************/
498 /*****************************************************************************/
499 nbelem = (int *)malloc(lbuf1);
500 cnelem = (int *)malloc(sizeof(int));
501 cnelem3 = (int *)malloc(sizeof(int));
502 listel2 = (int *)malloc(sizeof(int));
503 tabl = (int **)malloc(sizeof(int *));
504 listel2nbn = (int *)malloc(sizeof(int));
505
506 /********Creation of buffers************/
507 for (i = 0; i < *nng; i++) {
508 nn = nodbuf[i] - 1;
509 crd[3 * i] = x[3 * nn] - dx[3 * nn];
510 crd[3 * i + 1] = x[3 * nn + 1] - dx[3 * nn + 1];
511 crd[3 * i + 2] = x[3 * nn + 2] - dx[3 * nn + 2];
512 nodid[i] = itab[nn];
513 bcs[i] = 10 * cdt[nn];
514 if (*rddl)
515 bcs[i] += cdr[nn];
516
517 nbelem[i] = addcnel[nn + 2] - addcnel[nn + 1];
518 cnelem = (int *)realloc(cnelem, (dimno + nbelem[i]) * sizeof(int));
519 cnelem3 = (int *)realloc(cnelem3, (dimno + nbelem[i]) * sizeof(int));
520
521 for (j = 0; j < nbelem[i]; j++) {
522 capt = 0;
523 cnelem[dimno + j] = cnel[addcnel[nn + 1] + j];
524
525 for (k = 0; k < t; k++) {
526 if (cnelem[dimno + j] == listel2[k]) {
527 capt = 1;
528 tabl[k] = (int *)realloc(tabl[k], (listel2nbn[k] + 1) * sizeof(int));
529 tabl[k][listel2nbn[k]] = nodid[i];
530 listel2nbn[k]++;
531 cnelem3[dimno + j] = k;
532 }
533 }
534 if (capt == 0) {
535 listel2 = (int *)realloc(listel2, (t + 1) * sizeof(int));
536 listel2nbn = (int *)realloc(listel2nbn, (t + 1) * sizeof(int));
537 tabl = (int **)realloc(tabl, (t + 1) * sizeof(int *));
538 tabl[t] = (int *)malloc(sizeof(int));
539 listel2[t] = cnelem[dimno + j];
540 listel2nbn[t] = 1;
541 tabl[t][0] = nodid[i];
542 cnelem3[dimno + j] = t;
543 t++;
544 }
545 }
546 dimno = dimno + nbelem[i];
547 }
548
549 /********Sorting of element buffer************/
550 g = 0;
551 w = 0;
552 listel = (int *)(malloc(sizeof(int)));
553 listelnbn = (int *)(malloc(sizeof(int)));
554 listelno = (int *)(malloc(sizeof(int)));
555
556 for (i = 0; i < t; i++) {
557 if ((listel2nbn[i] > 1) || ((listel2nbn[i] == 1) && (*nng == 1))) {
558 listel = (int *)realloc(listel, (w + 1) * sizeof(int));
559 listelnbn = (int *)realloc(listelnbn, (w + 1) * sizeof(int));
560 listel[w] = listel2[i];
561 listelnbn[w] = listel2nbn[i];
562 for (j = 0; j < listel2nbn[i]; j++) {
563 listelno = (int *)realloc(listelno, (g + 1) * sizeof(int));
564 listelno[g] = tabl[i][j];
565 g++;
566 }
567 w++;
568 }
569 }
570
571 /*********filtering of buffer of nodes**************/
572 /*----(some elements are removed from buffer:
573 - type 1,2 : elements with only one node on the interface----*/
574 t = 0;
575 k = 0;
576 m = 0;
577 cnelem2 = (int *)malloc(sizeof(int));
578 for (i = 0; i < *nng; i++) {
579 lus = nbelem[i];
580 for (j = 0; j < lus; j++) {
581 m = cnelem3[k];
582
583 if ((listel2nbn[m] > 1) || ((listel2nbn[m] == 1) && (*nng == 1))) {
584 cnelem2 = (int *)realloc(cnelem2, (t + 1) * sizeof(int));
585 cnelem2[t] = cnelem[k];
586 t++;
587 } else {
588 nbelem[i] = nbelem[i] - 1;
589 }
590 k++;
591 }
592 }
593
594 dimno = t;
595
596 /********send of buffers to Rad2rad**************/
597 id = *igd;
598
599 init_buf[0] = *igd;
600 init_buf[1] = *nng;
601 init_buf[2] = dimno;
602 init_buf[3] = w;
603 init_buf[4] = g;
604 init_buf[5] = *print;
605 lbufel = w * sizeof(int);
606 lbufa = dimno * sizeof(int);
607 lbufb = g * sizeof(int);
608
609 writer(fidw, (void *)init_buf, 6 * sizeof(int));
610 writer(fidw, (void *)nodid, lbuf1);
611 writer(fidw, (void *)bcs, lbuf1);
612 writer(fidw, (void *)crd, 3 * lbuf);
613 writer(fidw, (void *)nbelem, lbuf1);
614 writer(fidw, (void *)cnelem2, lbufa);
615 writer(fidw, (void *)listel, lbufel);
616 writer(fidw, (void *)listelnbn, lbufel);
617 writer(fidw, (void *)listelno, lbufb);
618
619 /*********Deallocation****************************/
620 free(nbelem);
621 free(cnelem);
622 free(tabl);
623 free(nodid);
624 free(crd);
625 free(listel2);
626 free(listel2nbn);
627 free(listel);
628 free(listelnbn);
629 free(listelno);
630 }
631}
632
633void _FCALL INIT_LINK_C (int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *info, int *typ, int *cdt, int *cdr, int *print, int *rddl, int *nlink, my_real_c *dx){
634 init_link_c(igd, nng, itab, nodbuf, x,addcnel,cnel,ixc,ofc,info,typ,cdt,cdr,print,rddl,nlink,dx);
635}
636
637void _FCALL init_link_c_(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *info, int *typ, int *cdt, int *cdr, int *print, int *rddl, int *nlink, my_real_c *dx){
638 init_link_c(igd, nng, itab, nodbuf, x,addcnel,cnel,ixc,ofc,info,typ,cdt,cdr,print,rddl,nlink,dx);
639}
640
641void _FCALL init_link_c__(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *info, int *typ, int *cdt, int *cdr, int *print, int *rddl, int *nlink, my_real_c *dx){
642 init_link_c(igd, nng, itab, nodbuf, x,addcnel,cnel,ixc,ofc,info,typ,cdt,cdr,print,rddl,nlink,dx);
643}
644
645// -------------------------------------------------------------
646void init_link_nl_c(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *print, my_real_c *dx, int *ndof_nl, int *nb_tot_dof, int *nlnk){
647
648 int i, j, tt, nn, lbuf, lbuf1, init_buf[6], id;
649 int *nodid, *bcs;
650 my_real_c *crd;
651
652 /************************coupling for non local dof***************************/
653 /*****************************************************************************/
654 flagrot = (int *)malloc(*nlnk * 2 * sizeof(int));
655 lbuf = *nb_tot_dof * sizeof(my_real_c);
656 crd = (my_real_c *)malloc(3 * lbuf);
657 lbuf1 = *nb_tot_dof * sizeof(int);
658 nodid = (int *)malloc(lbuf1);
659 bcs = (int *)malloc(lbuf1);
660
661 tt = 0;
662 for (i = 0; i < *nng; i++) {
663 nn = nodbuf[i] - 1;
664 for (j = 0; j < ndof_nl[i]; j++) {
665 crd[3 * tt] = x[3 * nn] - dx[3 * nn];
666 crd[3 * tt + 1] = x[3 * nn + 1] - dx[3 * nn + 1];
667 crd[3 * tt + 2] = x[3 * nn + 2] - dx[3 * nn + 2];
668 nodid[tt] = itab[nn] + 10000 * j;
669 bcs[tt] = 0;
670 tt++;
671 }
672 }
673
674 id = *igd;
675 init_buf[0] = *igd;
676 init_buf[1] = *nb_tot_dof;
677 init_buf[2] = 0;
678 init_buf[3] = 0;
679 init_buf[4] = 0;
680 init_buf[5] = *print;
681
682 writer(fidw, (void *)init_buf, 6 * sizeof(int));
683 writer(fidw, (void *)nodid, lbuf1);
684 writer(fidw, (void *)bcs, lbuf1);
685 writer(fidw, (void *)crd, 3 * lbuf);
686
687 /*********Deallocation****************************/
688 free(crd);
689 free(nodid);
690 free(bcs);
691}
692
693void _FCALL INIT_LINK_NL_C (int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *print, my_real_c *dx, int *ndof_nl, int *nb_tot_dof, int *nlnk){
694 init_link_nl_c(igd, nng, itab, nodbuf, x,print,dx,ndof_nl,nb_tot_dof,nlnk);
695}
696
697void _FCALL init_link_nl_c_ (int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *print, my_real_c *dx, int *ndof_nl, int *nb_tot_dof, int *nlnk){
698 init_link_nl_c(igd, nng, itab, nodbuf, x,print,dx,ndof_nl,nb_tot_dof,nlnk);
699}
700
701void _FCALL init_link_nl_c__ (int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *print, my_real_c *dx, int *ndof_nl, int *nb_tot_dof, int *nlnk){
702 init_link_nl_c(igd, nng, itab, nodbuf, x,print,dx,ndof_nl,nb_tot_dof,nlnk);
703}
704
705
706void init_buf_spmd_c(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *tlel, int *lel, int *lelnb, int *tleln, int *leln, int *nbelem, int *tcnel, int *cnelem2, int *wgt, int *tcneldb, int *cnelemdb, int *info, int *typ, int *nglob)
707{
708 int i, j, t, nn, lbuf, lbuf1, init_buf[5], lbufa, lbufb, lbufel, dimno, k, capt, g, m, w, nbel, weight, zz, zz2;
709 int *nodid, *cnelem, *cnelem3, *listel, *listelnbn, *listel2, *listel2nbn, *listelno, **tabl, nbn, lus;
710 my_real_c *crd;
711
712 lbuf = *nng * sizeof(my_real_c);
713 crd = (my_real_c *)malloc(3 * lbuf);
714 lbuf1 = *nng * sizeof(int);
715 dimno = 0;
716 nbel = 0;
717 t = 0;
718 k = 0;
719 zz = 0;
720 zz2 = 0;
721 nodid = (int *)malloc(lbuf1);
722 cnelem = (int *)malloc(sizeof(int));
723 cnelem3 = (int *)malloc(sizeof(int));
724 listel2 = (int *)malloc(sizeof(int));
725 tabl = (int **)malloc(sizeof(int *));
726 listel2nbn = (int *)malloc(sizeof(int));
727
728 /********Creation of buffers************/
729 for (i = 0; i < *nng; i++) {
730 nn = nodbuf[i] - 1;
731 crd[3 * i] = x[3 * nn];
732 crd[3 * i + 1] = x[3 * nn + 1];
733 crd[3 * i + 2] = x[3 * nn + 2];
734 nodid[i] = itab[nn];
735 weight = wgt[nn];
736 nbelem[i] = addcnel[nn + 2] - addcnel[nn + 1];
737 cnelem = (int *)realloc(cnelem, (dimno + nbelem[i]) * sizeof(int));
738 cnelem3 = (int *)realloc(cnelem3, (dimno + nbelem[i]) * sizeof(int));
739
740 for (j = 0; j < nbelem[i]; j++) {
741 capt = 0;
742 cnelem[dimno + j] = cnel[addcnel[nn + 1] + j];
743
744 for (k = 0; k < t; k++) {
745 if (cnelem[dimno + j] == listel2[k]) {
746 capt = 1;
747 tabl[k] = (int *)realloc(tabl[k], (listel2nbn[k] + 1) * sizeof(int));
748 tabl[k][listel2nbn[k]] = nodid[i];
749 listel2nbn[k]++;
750 cnelem3[dimno + j] = k;
751 }
752 }
753
754 if (capt == 0) {
755 listel2 = (int *)realloc(listel2, (t + 1) * sizeof(int));
756 listel2nbn = (int *)realloc(listel2nbn, (t + 1) * sizeof(int));
757 tabl = (int **)realloc(tabl, (t + 1) * sizeof(int *));
758 tabl[t] = (int *)malloc(sizeof(int));
759 listel2[t] = cnelem[dimno + j];
760 listel2nbn[t] = 1;
761 tabl[t][0] = nodid[i];
762 cnelem3[dimno + j] = t;
763 t++;
764 }
765 }
766 dimno = dimno + nbelem[i];
767 }
768
769 /********sorting of element buffer************/
770 g = 0;
771 w = 0;
772 listel = (int *)(malloc(sizeof(int)));
773 listelnbn = (int *)(malloc(sizeof(int)));
774 listelno = (int *)(malloc(sizeof(int)));
775 for (i = 0; i < t; i++) {
776 if ((listel2nbn[i] > 1) || ((listel2nbn[i] == 1) && (*nglob == 1))) {
777 listel = (int *)realloc(listel, (w + 1) * sizeof(int));
778 listelnbn = (int *)realloc(listelnbn, (w + 1) * sizeof(int));
779 listel[w] = listel2[i];
780 lel[w] = listel[w];
781 listelnbn[w] = listel2nbn[i];
782 lelnb[w] = listel2nbn[i];
783 for (j = 0; j < listel2nbn[i]; j++) {
784 listelno = (int *)realloc(listelno, (g + 1) * sizeof(int));
785 listelno[g] = tabl[i][j];
786 leln[g] = listelno[g];
787 g++;
788 }
789 w++;
790 }
791 }
792
793 *tlel = w;
794 *tleln = g;
795
796 /*********filtering of buffer of nodes**************/
797 t = 0;
798 k = 0;
799 m = 0;
800
801 for (i = 0; i < *nng; i++) {
802 nn = nodbuf[i] - 1;
803 weight = wgt[nn];
804 lus = nbelem[i];
805 for (j = 0; j < lus; j++) {
806 m = cnelem3[k];
807
808 if ((listel2nbn[m] > 1) || ((listel2nbn[m] == 1) && (*nglob == 1))) {
809 if (weight == 1) {
810 cnelem2[zz] = cnelem[k];
811 zz++;
812 }
813 if (weight == 0) {
814 cnelemdb[zz2] = cnelem[k];
815 zz2++;
816 }
817 } else {
818 nbelem[i] = nbelem[i] - 1;
819 }
820 k++;
821 }
822 }
823
824 dimno = t;
825 *tcnel = zz;
826 *tcneldb = zz2;
827
828 /*********Deallocation****************************/
829 free(cnelem);
830 free(tabl);
831 free(nodid);
832 free(crd);
833 free(listel2);
834 free(listel2nbn);
835 free(listel);
836 free(listelnbn);
837 free(listelno);
838}
839
840void _FCALL INIT_BUF_SPMD_C(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *tlel, int *lel, int *lelnb, int *tleln, int *leln, int *nbelem, int *tcnel, int *cnelem2, int *wgt, int *tcneldb, int *cnelemdb, int *info, int *typ, int *nglob){
841 init_buf_spmd_c(igd, nng, itab, nodbuf, x,addcnel,cnel,ixc,ofc,tlel,lel,lelnb,tleln,leln,nbelem,tcnel,cnelem2,wgt,tcneldb,cnelemdb,info,typ,nglob);
842}
843
844void _FCALL init_buf_spmd_c_(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *tlel, int *lel, int *lelnb, int *tleln, int *leln, int *nbelem, int *tcnel, int *cnelem2, int *wgt, int *tcneldb, int *cnelemdb, int *info, int *typ, int *nglob){
845 init_buf_spmd_c(igd, nng, itab, nodbuf, x,addcnel,cnel,ixc,ofc,tlel,lel,lelnb,tleln,leln,nbelem,tcnel,cnelem2,wgt,tcneldb,cnelemdb,info,typ,nglob);
846}
847
848void _FCALL init_buf_spmd_c__(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *tlel, int *lel, int *lelnb, int *tleln, int *leln, int *nbelem, int *tcnel, int *cnelem2, int *wgt, int *tcneldb, int *cnelemdb, int *info, int *typ, int *nglob){
849 init_buf_spmd_c(igd, nng, itab, nodbuf, x,addcnel,cnel,ixc,ofc,tlel,lel,lelnb,tleln,leln,nbelem,tcnel,cnelem2,wgt,tcneldb,cnelemdb,info,typ,nglob);
850}
851
852
853void init_link_spmd_c(int *igd, int *nng, int *dbnod, int *nbproc, int *ibuf, int *dbibuf, int *dbnbuf, int *ddbuf, my_real_c *rbuf, int *dim, int *ibufnb, int *ibufcnel, int *nbel, int *dimel, int *ibufel, int *ibufelnbnod, int *ibufelnod, int *dimb, int *ibufcneldb, int *ibufnbeldb, int *typ, int *bcs, int *print, int *rddl, int *nl, int *nlnk, int *iex){
854
855 int i, j, lbuf, lbuf1, lbufb, lbufp, init_buf[8], lbufa, lbufel, lbufdimel, lbufc, offset, offsetb, offsett, iproc;
856
857 nspmd = *nbproc;
858
859 init_buf[0] = *igd;
860 init_buf[1] = *nng;
861 init_buf[2] = *dim;
862 init_buf[3] = *nbel;
863 init_buf[4] = *dimel;
864 init_buf[5] = *print;
865 init_buf[6] = *dbnod;
866 init_buf[7] = *dimb;
867 flagrot = (int *)malloc((*nl + 1) * sizeof(int));
868 iroddl = *rddl;
869
870 writer(fidw, (void *)init_buf, 8 * sizeof(int));
871 lbuf = *nng * sizeof(my_real_c);
872 lbuf1 = *nng * sizeof(int);
873 lbufb = *dbnod * sizeof(int);
874 lbufp = *nbproc * sizeof(int);
875 lbufa = *dim * sizeof(int);
876 lbufc = *dimb * sizeof(int);
877 lbufel = *nbel * sizeof(int);
878 lbufdimel = *dimel * sizeof(int);
879
880 /*************determination of the master for db nodes******************************/
881 if (*iex == 1)
882 {
883 masterdb = malloc(*nlnk * sizeof(int *));
884 }
885
886 offset = 0;
887 offsetb = 0;
888 offsett = 0;
889 masterdb[*iex - 1] = malloc((*nng + (*dbnod)) * sizeof(int));
890 for (iproc = 0; iproc < nspmd; iproc++)
891 {
892 for (i = 0; i < ddbuf[iproc]; i++)
893 masterdb[*iex - 1][offset + i] = offsetb + i;
894 offset += ddbuf[iproc];
895 offsetb += ddbuf[iproc];
896 for (i = 0; i < dbnbuf[iproc]; i++)
897 for (j = 0; j < *nng; j++)
898 {
899 if (ibuf[j] == dbibuf[offsett + i])
900 masterdb[*iex - 1][offset + i] = j;
901 }
902 offset += dbnbuf[iproc];
903 offsett += dbnbuf[iproc];
904 }
905 /*************************************************************************************/
906
907 writer(fidw, (void *)ibuf, lbuf1);
908 writer(fidw, (void *)bcs, lbuf1);
909 writer(fidw, (void *)rbuf, 3 * lbuf);
910 writer(fidw, (void *)dbibuf, lbufb);
911 writer(fidw, (void *)dbnbuf, lbufp);
912 writer(fidw, (void *)ddbuf, lbufp);
913
914 /****infos on elements (sent only for coupling type 1 and 2)*********************/
915 if (*typ < 4)
916 {
917 writer(fidw, (void *)ibufnb, lbuf1);
918 writer(fidw, (void *)ibufcnel, lbufa);
919 writer(fidw, (void *)ibufel, lbufel);
920 writer(fidw, (void *)ibufelnbnod, lbufel);
921 writer(fidw, (void *)ibufelnod, lbufdimel);
922 writer(fidw, (void *)ibufnbeldb, lbufb);
923 writer(fidw, (void *)ibufcneldb, lbufc);
924 }
925 /*********************************************************************************/
926}
927
928void _FCALL INIT_LINK_SPMD_C(int *igd, int *nng, int *dbnod, int *nbproc, int *ibuf, int *dbibuf, int *dbnbuf, int *ddbuf, my_real_c *rbuf, int *dim, int *ibufnb, int *ibufcnel, int *nbel, int *dimel, int *ibufel, int *ibufelnbnod, int *ibufelnod, int *dimb, int *ibufcneldb, int *ibufnbeldb, int *typ, int *bcs, int *print, int *rddl, int *nl, int *nlnk, int *iex){
929 init_link_spmd_c(igd,nng,dbnod,nbproc,ibuf,dbibuf,dbnbuf,ddbuf,rbuf,dim,ibufnb,ibufcnel,nbel,dimel,ibufel,ibufelnbnod,ibufelnod,dimb,ibufcneldb,ibufnbeldb,typ,bcs,print,rddl,nl,nlnk,iex);
930}
931
932void _FCALL init_link_spmd_c_(int *igd, int *nng, int *dbnod, int *nbproc, int *ibuf, int *dbibuf, int *dbnbuf, int *ddbuf, my_real_c *rbuf, int *dim, int *ibufnb, int *ibufcnel, int *nbel, int *dimel, int *ibufel, int *ibufelnbnod, int *ibufelnod, int *dimb, int *ibufcneldb, int *ibufnbeldb, int *typ, int *bcs, int *print, int *rddl, int *nl, int *nlnk, int *iex){
933 init_link_spmd_c(igd,nng,dbnod,nbproc,ibuf,dbibuf,dbnbuf,ddbuf,rbuf,dim,ibufnb,ibufcnel,nbel,dimel,ibufel,ibufelnbnod,ibufelnod,dimb,ibufcneldb,ibufnbeldb,typ,bcs,print,rddl,nl,nlnk,iex);
934}
935
936void _FCALL init_link_spmd_c__(int *igd, int *nng, int *dbnod, int *nbproc, int *ibuf, int *dbibuf, int *dbnbuf, int *ddbuf, my_real_c *rbuf, int *dim, int *ibufnb, int *ibufcnel, int *nbel, int *dimel, int *ibufel, int *ibufelnbnod, int *ibufelnod, int *dimb, int *ibufcneldb, int *ibufnbeldb, int *typ, int *bcs, int *print, int *rddl, int *nl, int *nlnk, int *iex){
937 init_link_spmd_c(igd,nng,dbnod,nbproc,ibuf,dbibuf,dbnbuf,ddbuf,rbuf,dim,ibufnb,ibufcnel,nbel,dimel,ibufel,ibufelnbnod,ibufelnod,dimb,ibufcneldb,ibufnbeldb,typ,bcs,print,rddl,nl,nlnk,iex);
938}
939
940void send_ibuf_c(int *ibuf, int *len){
941 writer(fidw, (void *) ibuf, *len*sizeof(int));
942}
943
944void _FCALL SEND_IBUF_C(int *ibuf, int *len){
945 send_ibuf_c(ibuf, len);
946}
947
948void _FCALL send_ibuf_c_(int *ibuf, int *len){
949 send_ibuf_c(ibuf, len);
950}
951
952void _FCALL send_ibuf_c__(int *ibuf, int *len){
953 send_ibuf_c(ibuf, len);
954}
955
956/************************************************************************/
957
958void send_fbuf_c(my_real_c *fbuf, int *len){
959 writer(fidw, (void *) fbuf, *len*sizeof(my_real_c));
960}
961
962void _FCALL SEND_FBUF_C(my_real_c *fbuf, int *len){
963 send_fbuf_c(fbuf, len);
964}
965
966void send_fbuf_c_(my_real_c *fbuf, int *len){
967 send_fbuf_c(fbuf, len);
968}
969
970void send_fbuf_c__(my_real_c *fbuf, int *len){
971 send_fbuf_c(fbuf, len);
972}
973
974
975/************************************************************************/
976
977void send_fbufdp_c(double *fbuf, int *len){
978 writer(fidw, (void *) fbuf, *len*sizeof(double));
979}
980
981void _FCALL SEND_FBUFDP_C(double *fbuf, int *len){
982 send_fbufdp_c(fbuf, len);
983}
984
985void send_fbufdp_c_(double *fbuf, int *len){
986 send_fbufdp_c(fbuf, len);
987}
988
989void send_fbufdp_c__(double *fbuf, int *len){
990 send_fbufdp_c(fbuf, len);
991}
992
993/***************************************************************************/
994
995void get_fbuf_c(my_real_c *fbuf, int *len){
996 readr(fidr, (void *) fbuf, *len*sizeof(my_real_c));
997}
998
999void _FCALL GET_FBUF_C(my_real_c *fbuf, int *len){
1000 get_fbuf_c(fbuf, len);
1001}
1002
1003void get_fbuf_c_(my_real_c *fbuf, int *len){
1004 get_fbuf_c(fbuf, len);
1005}
1006
1007void get_fbuf_c__(my_real_c *fbuf, int *len){
1008 get_fbuf_c(fbuf, len);
1009}
1010
1011/***************************************************************************/
1012
1013void get_fbufdp_c(double *fbuf, int *len){
1014 readr(fidr, (void *) fbuf, *len*sizeof(double));
1015}
1016
1017void _FCALL GET_FBUFDP_C(double *fbuf, int *len){
1018 get_fbufdp_c(fbuf, len);
1019}
1020
1021void get_fbufdp_c_(double *fbuf, int *len){
1022 get_fbufdp_c(fbuf, len);
1023}
1024
1025void get_fbufdp_c__(double *fbuf, int *len){
1026 get_fbufdp_c(fbuf, len);
1027}
1028
1029/******************************************************************************/
1030
1031void get_ibuf_c(int *ibuf, int *len){
1032 readr(fidr, (void *) ibuf, *len*sizeof(int));
1033}
1034
1035void _FCALL GET_IBUF_C(int *ibuf, int *len){
1036 get_ibuf_c(ibuf, len);
1037}
1038
1039void get_ibuf_c_(int *ibuf, int *len){
1040 get_ibuf_c(ibuf, len);
1041}
1042
1043void get_ibuf_c__(int *ibuf, int *len){
1044 get_ibuf_c(ibuf, len);
1045}
1046
1047
1048void send_mass_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in){
1049 int i, nn, lbuf, flag;
1050 my_real_c *mbuf, *ibuf;
1051
1052 writer(fidw, (void *)idp, sizeof(int));
1053 readr(fidr, (void *)&flag, sizeof(int));
1054 flagrot[*idp] = flag;
1055
1056 lbuf = *nng * sizeof(my_real_c);
1057 mbuf = (my_real_c *)malloc(lbuf);
1058 if (flagrot[*idp])
1059 ibuf = (my_real_c *)malloc(lbuf);
1060
1061 for (i = 0; i < *nng; i++)
1062 {
1063 nn = nodbuf[i] - 1;
1064 mbuf[i] = ms[nn];
1065 if (flagrot[*idp])
1066 ibuf[i] = in[nn];
1067 }
1068 writer(fidw, (void *)mbuf, lbuf);
1069 if (flagrot[*idp])
1070 writer(fidw, (void *)ibuf, lbuf);
1071
1072 free(mbuf);
1073 if (flagrot[*idp])
1074 free(ibuf);
1075}
1076
1077void _FCALL SEND_MASS_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in){
1078 send_mass_c(idp, nng, nodbuf, ms, in);
1079}
1080
1081void send_mass_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in){
1082 send_mass_c(idp, nng, nodbuf, ms, in);
1083}
1084
1085void send_mass_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in){
1086 send_mass_c(idp, nng, nodbuf, ms, in);
1087}
1088
1089//-------------------------------------------------------------
1090void send_mass_nl_c(int *idp, int *nng, int *iadd_nl, my_real_c *ms){
1091 int i, j, nn, lbuf, flag;
1092 my_real_c *mbuf;
1093
1094 writer(fidw, (void *)idp, sizeof(int));
1095 readr(fidr, (void *)&flag, sizeof(int));
1096 flagrot[*idp] = 0;
1097
1098 lbuf = *nng * sizeof(my_real_c);
1099 mbuf = (my_real_c *)malloc(lbuf);
1100
1101 for (i = 0; i < *nng; i++) {
1102 mbuf[i] = ms[iadd_nl[i] - 1];
1103 }
1104
1105 writer(fidw, (void *)mbuf, lbuf);
1106 free(mbuf);
1107}
1108
1109void _FCALL SEND_MASS_NL_C(int *idp, int *nng, int *iadd_nl, my_real_c *ms){
1110 send_mass_nl_c(idp, nng, iadd_nl, ms);
1111}
1112
1113void send_mass_nl_c_(int *idp, int *nng, int *iadd_nl, my_real_c *ms){
1114 send_mass_nl_c(idp, nng, iadd_nl, ms);
1115}
1116
1117void send_mass_nl_c__(int *idp, int *nng, int *iadd_nl, my_real_c *ms){
1118 send_mass_nl_c(idp, nng, iadd_nl, ms);
1119}
1120
1121void send_mass_rby_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *npby, int *nrbody, my_real_c *rby, int *tag, int *add_rby, int *nnpby, int *nrby){
1122 int i, k, l, nn, lbuf, flag, *cbuf;
1123 my_real_c *mbuf, *ibuf, *m2buf, *matrix_buf;
1124
1125 writer(fidw, (void *)idp, sizeof(int));
1126 readr(fidr, (void *)&flag, sizeof(int));
1127 flagrot[*idp] = flag;
1128
1129 lbuf = *nng * sizeof(my_real_c);
1130 mbuf = (my_real_c *)malloc(lbuf);
1131 m2buf = (my_real_c *)malloc(lbuf);
1132 cbuf = (int *)malloc(lbuf);
1133 if (flagrot[*idp]) {
1134 ibuf = (my_real_c *)malloc(lbuf);
1135 matrix_buf = (my_real_c *)malloc(9 * lbuf);
1136 }
1137
1138 for (i = 0; i < *nng; i++) {
1139 nn = nodbuf[i] - 1;
1140 mbuf[i] = ms[nn];
1141 if (flagrot[*idp]) ibuf[i] = in[nn];
1142 for (k = 0; k < *nrbody; k++) {
1143 if (npby[*nnpby * k] == nn + 1) {
1144 tag[*add_rby + i] = k;
1145 cbuf[i] = npby[*nnpby * k + 2];
1146 m2buf[i] = rby[*nrby * k + 14];
1147 for (l = 0; l < 9; l++) {
1148 matrix_buf[9 * i + l] = rby[*nrby * k + 16 + l];
1149 }
1150 }
1151 }
1152 }
1153
1154 writer(fidw, (void *)mbuf, lbuf);
1155 if (flagrot[*idp]) writer(fidw, (void *)ibuf, lbuf);
1156 writer(fidw, (void *)cbuf, lbuf);
1157 writer(fidw, (void *)m2buf, lbuf);
1158 writer(fidw, (void *)matrix_buf, 9 * lbuf);
1159
1160 free(mbuf);
1161 free(m2buf);
1162 free(matrix_buf);
1163 if (flagrot[*idp]) free(ibuf);
1164 free(cbuf);
1165}
1166
1167void _FCALL SEND_MASS_RBY_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *npby, int *nrbody, my_real_c *rby, int *tag, int *add_rby, int *nnpby, int *nrby){
1168 send_mass_rby_c(idp, nng, nodbuf, ms, in, npby, nrbody, rby, tag, add_rby, nnpby, nrby);
1169}
1170
1171void send_mass_rby_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *npby, int *nrbody, my_real_c *rby, int *tag, int *add_rby, int *nnpby, int *nrby){
1172 send_mass_rby_c(idp, nng, nodbuf, ms, in, npby, nrbody, rby, tag, add_rby, nnpby, nrby);
1173}
1174
1175void send_mass_rby_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *npby, int *nrbody, my_real_c *rby, int *tag, int *add_rby, int *nnpby, int *nrby){
1176 send_mass_rby_c(idp, nng, nodbuf, ms, in, npby, nrbody, rby, tag, add_rby, nnpby, nrby);
1177}
1178
1179
1180//-------------------------------------------------------------
1181void init_activ_c(int *activ){
1182 readr(fidr, (void *) activ, sizeof(int));
1183}
1184
1185
1186void _FCALL INIT_ACTIV_C(int *activ){
1187 init_activ_c(activ);
1188}
1189
1190void init_activ_c_(int *activ){
1191 init_activ_c(activ);
1192}
1193
1194void init_activ_c__(int *activ){
1195 init_activ_c(activ);}
1196
1197//-------------------------------------------------------------
1198void send_mass_spmd_c(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *iroddl){
1199int lbuf, flag;
1200 writer(fidw, (void *) idp, sizeof(int));;
1201 readr(fidr, (void *) &flag, sizeof(int));
1202 flagrot[*idp]=flag;
1203 *iroddl=flag;
1204 lbuf = *nng*sizeof(my_real_c);
1205 writer(fidw, (void *) buf1, lbuf);
1206 if (flagrot[*idp]) writer(fidw, (void *) buf2, lbuf);
1207}
1208
1209void _FCALL SEND_MASS_SPMD_C(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *iroddl){
1210 send_mass_spmd_c(idp, nng, buf1, buf2, iroddl);
1211}
1212
1213void send_mass_spmd_c_(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *iroddl){
1214 send_mass_spmd_c(idp, nng, buf1, buf2, iroddl);
1215}
1216
1217void send_mass_spmd_c__(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *iroddl){
1218 send_mass_spmd_c(idp, nng, buf1, buf2, iroddl);
1219}
1220
1221
1222//-------------------------------------------------------------
1223void send_mass_rby_spmd_c(int *idp,int *nng,my_real_c *buf1,my_real_c *buf2,int *buf3,my_real_c *buf4,my_real_c *buf5,int *iroddl){
1224int lbuf, flag;
1225
1226 writer(fidw, (void *) idp, sizeof(int));;
1227 readr(fidr, (void *) &flag, sizeof(int));
1228 flagrot[*idp]=flag;
1229 *iroddl=flag;
1230 lbuf = *nng*sizeof(my_real_c);
1231 writer(fidw, (void *) buf1, lbuf);
1232 if (flagrot[*idp]) writer(fidw, (void *) buf2, lbuf);
1233 writer(fidw, (void *) buf3, lbuf);
1234 writer(fidw, (void *) buf4, lbuf);
1235 writer(fidw, (void *) buf5, 9*lbuf);
1236
1237}
1238
1239void _FCALL SEND_MASS_RBY_SPMD_C(int *idp,int *nng,my_real_c *buf1,my_real_c *buf2,int *buf3,my_real_c *buf4,my_real_c *buf5,int *iroddl){
1240 send_mass_rby_spmd_c(idp,nng,buf1,buf2,buf3,buf4,buf5,iroddl);
1241}
1242
1243void send_mass_rby_spmd_c_(int *idp,int *nng,my_real_c *buf1,my_real_c *buf2,int *buf3,my_real_c *buf4,my_real_c *buf5,int *iroddl){
1244 send_mass_rby_spmd_c(idp,nng,buf1,buf2,buf3,buf4,buf5,iroddl);
1245}
1246
1247void send_mass_rby_spmd_c__(int *idp,int *nng,my_real_c *buf1,my_real_c *buf2,int *buf3,my_real_c *buf4,my_real_c *buf5,int *iroddl){
1248 send_mass_rby_spmd_c(idp,nng,buf1,buf2,buf3,buf4,buf5,iroddl);
1249}
1250
1251
1252
1253void get_mass_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in){
1254int i, nn, lbuf;
1255my_real_c *mbuf, *ibuf;
1256
1257 writer(fidw, (void *) idp, sizeof(int));
1258
1259 lbuf = *nng*sizeof(my_real_c);
1260 mbuf = (my_real_c *) malloc(lbuf);
1261 if (flagrot[*idp]) ibuf = (my_real_c *) malloc(lbuf);
1262
1263 readr(fidr, (void *) mbuf, lbuf);
1264 if (flagrot[*idp]) readr(fidr, (void *) ibuf, lbuf);
1265
1266 for (i = 0; i < *nng; i++)
1267 {
1268 nn = nodbuf[i]-1;
1269 ms[nn] = mbuf[i];
1270 if (flagrot[*idp]) in[nn] = ibuf[i];
1271 }
1272 free(mbuf);
1273 if (flagrot[*idp]) free(ibuf);
1274}
1275
1276void _FCALL GET_MASS_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in){
1277 get_mass_c(idp, nng, nodbuf, ms, in);
1278}
1279
1280void get_mass_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in){
1281 get_mass_c(idp, nng, nodbuf, ms, in);
1282}
1283
1284void get_mass_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in){
1285 get_mass_c(idp, nng, nodbuf, ms, in);
1286}
1287
1288
1289//-------------------------------------------------------------
1290void get_mass_rby_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, my_real_c *x, int *npby, int *nrbody, my_real_c *rby, int *nnpby, int *nrby){
1291 int i, k, l, nn, lbuf, idrby;
1292 my_real_c *mbuf, *ibuf, *xbuf, *matrix_buf;
1293
1294 writer(fidw, (void *)idp, sizeof(int));
1295
1296 lbuf = *nng * sizeof(my_real_c);
1297 mbuf = (my_real_c *)malloc(lbuf);
1298 xbuf = (my_real_c *)malloc(3 * lbuf);
1299 if (flagrot[*idp]) {
1300 ibuf = (my_real_c *)malloc(lbuf);
1301 matrix_buf = (my_real_c *)malloc(9 * lbuf);
1302 }
1303
1304 readr(fidr, (void *)mbuf, lbuf);
1305 if (flagrot[*idp]) readr(fidr, (void *)ibuf, lbuf);
1306 readr(fidr, (void *)xbuf, 3 * lbuf);
1307 readr(fidr, (void *)matrix_buf, 9 * lbuf);
1308
1309 for (i = 0; i < *nng; i++) {
1310 nn = nodbuf[i] - 1;
1311 ms[nn] = mbuf[i];
1312 if (flagrot[*idp]) in[nn] = ibuf[i];
1313 x[3 * nn] = xbuf[3 * i];
1314 x[3 * nn + 1] = xbuf[3 * i + 1];
1315 x[3 * nn + 2] = xbuf[3 * i + 2];
1316 for (k = 0; k < *nrbody; k++) {
1317 if (npby[*nnpby * k] == nn + 1) {
1318 for (l = 0; l < 9; l++) {
1319 rby[*nrby * k + 16 + l] = matrix_buf[9 * i + l];
1320 }
1321 }
1322 }
1323 }
1324
1325 free(mbuf);
1326 if (flagrot[*idp]) free(ibuf);
1327 free(xbuf);
1328}
1329
1330void _FCALL GET_MASS_RBY_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, my_real_c *x, int *npby, int *nrbody, my_real_c *rby, int *nnpby, int *nrby){
1331 get_mass_rby_c(idp, nng, nodbuf, ms, in, x, npby, nrbody, rby, nnpby, nrby);
1332}
1333
1334void get_mass_rby_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, my_real_c *x, int *npby, int *nrbody, my_real_c *rby, int *nnpby, int *nrby){
1335 get_mass_rby_c(idp, nng, nodbuf, ms, in, x, npby, nrbody, rby, nnpby, nrby);
1336}
1337void get_mass_rby_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, my_real_c *x, int *npby, int *nrbody, my_real_c *rby, int *nnpby, int *nrby){
1338 get_mass_rby_c(idp, nng, nodbuf, ms, in, x, npby, nrbody, rby, nnpby, nrby);
1339}
1340
1341
1342//-------------------------------------------------------------
1343void get_mass_spmd_c(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2){
1344 int lbuf;
1345 writer(fidw, (void *) idp, sizeof(int));
1346 lbuf = *nng*sizeof(my_real_c);
1347 readr(fidr, (void *) buf1, lbuf);
1348 if (flagrot[*idp]) readr(fidr, (void *) buf2, lbuf);
1349}
1350
1351void _FCALL GET_MASS_SPMD_C(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2){
1352 get_mass_spmd_c(idp, nng, buf1, buf2);
1353}
1354
1355void get_mass_spmd_c_(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2){
1356 get_mass_spmd_c(idp, nng, buf1, buf2);
1357}
1358
1359void get_mass_spmd_c__(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2){
1360get_mass_spmd_c(idp, nng, buf1, buf2);
1361}
1362
1363//-------------------------------------------------------------
1364void get_mass_rby_spmd_c(int *idp,int *nng,my_real_c *buf1,my_real_c *buf2,my_real_c *buf3,my_real_c *buf4){
1365int lbuf;
1366
1367 writer(fidw, (void *) idp, sizeof(int));
1368 lbuf = *nng*sizeof(my_real_c);
1369 readr(fidr, (void *) buf1, lbuf);
1370 if (flagrot[*idp]) readr(fidr, (void *) buf2, lbuf);
1371 readr(fidr, (void *) buf3, 3*lbuf);
1372 readr(fidr, (void *) buf4, 9*lbuf);
1373}
1374
1375void _FCALL GET_MASS_RBY_SPMD_C(int *idp,int *nng,my_real_c *buf1,my_real_c *buf2,my_real_c *buf3,my_real_c *buf4){
1376 get_mass_rby_spmd_c(idp,nng,buf1,buf2,buf3,buf4);
1377}
1378
1379void get_mass_rby_spmd_c_(int *idp,int *nng,my_real_c *buf1,my_real_c *buf2,my_real_c *buf3,my_real_c *buf4){
1380 get_mass_rby_spmd_c(idp,nng,buf1,buf2,buf3,buf4);
1381}
1382
1383void get_mass_rby_spmd_c__(int *idp,int *nng,my_real_c *buf1,my_real_c *buf2,my_real_c *buf3,my_real_c *buf4){
1384 get_mass_rby_spmd_c(idp,nng,buf1,buf2,buf3,buf4);
1385}
1386
1387
1388//-------------------------------------------------------------
1389void check_dtnoda_c(int *i7kglo){
1390 if(i7flag == 0)
1391 {
1392 writer(fidw, (void *)i7kglo, sizeof(int));
1393 readr (fidr, (void *)i7kglo, sizeof(int));
1394 i7flag = *i7kglo;
1395 }
1396}
1397
1398void check_dtnoda_c_(int *i7kglo){
1399 check_dtnoda_c(i7kglo);
1400}
1401
1402void _FCALL CHECK_DTNODA_C(int *i7kglo){
1403 check_dtnoda_c(i7kglo);
1404}
1405
1406void check_dtnoda_c__(int *i7kglo){
1407 check_dtnoda_c(i7kglo);
1408}
1409
1410
1411void send_data_c(int *idp, int *nng, int *nodbuf,
1412 my_real_c *fx, my_real_c *fr, my_real_c *stx, my_real_c *str,
1413 my_real_c *vx, my_real_c *vr, my_real_c *ms, my_real_c *in,
1414 double *dx, my_real_c *x, int *typ, int *npas, my_real_c *rby,
1415 int *tag_rby, int *add_rby, int *rbylnk, int *kin, double *dr,
1416 my_real_c *dt2, int *iex, int *off_sph, int *numsph_glo, int *nrby){
1417
1418 int buflen, lbuf, rest, next, chunk;
1419 int i, j, k, nn, nm, offset;
1420
1421 rest = *nng;
1422 if (*iex == 1) off_link = 0;
1423
1424 if (*typ != 7) {
1425 chunk = rest / nthreads;
1426 #pragma omp parallel for schedule(static, chunk) if (chunk > 350) private(k, i, j, nm, nn)
1427 for (next = 0; next < rest; next++) {
1428 i = off_link + next;
1429 k = 3 * i;
1430 nm = nodbuf[next] - 1;
1431 nn = 3 * nm;
1432 for (j = 0; j < 3; j++) {
1433 com->fx_buf[k + j] = fx[nn + j];
1434 com->fr_buf[k + j] = fr[nn + j];
1435 if ((*typ <= 4) || (*npas == 0)) {
1436 com->vx_buf[k + j] = vx[nn + j];
1437 }
1438 if (*typ == 5) {
1439 if (*kin == 1) {
1440 dr[3 * next + j] += *dt2 * vr[nn + j];
1441 com->dx_buf[2 * k + j] = dx[nn + j];
1442 com->dx_buf[2 * k + j + 3] = dr[3 * next + j];
1443 } else {
1444 com->dx_buf[k + j] = dx[nn + j];
1445 }
1446 }
1447 }
1448 com->mass_buf[i] = ms[nm];
1449 if (*typ == 5) com->sx_buf[i] = stx[nm];
1450 if (flagrot[*idp]) {
1451 if (*typ == 5) com->sr_buf[i] = str[nm];
1452 com->iner_buf[i] = in[nm];
1453 if (*rbylnk == 1)
1454 for (j = 0; j < 9; j++)
1455 com->iner_rby_buf[9 * i + j] = rby[*nrby * tag_rby[*add_rby + next] + j + 16];
1456 if ((*typ <= 4) || (*npas == 0))
1457 for (j = 0; j < 3; j++) com->vr_buf[k + j] = vr[nn + j];
1458 }
1459 /************ change of state - activation or deactivation of SPH - coordinates are transmitted instead of forces **************/
1460 if (flg_sphinout == 1) {
1461 com->iactv[i] = 0;
1462 if (*numsph_glo > 0)
1463 if (off_sph[nm] != 0) {
1464 /* printf("deactivation %d %d - %e %e %e\n",nm,off_sph[nm],x[nn],x[nn+1],x[nn+2]); */
1465 for (j = 0; j < 3; j++) {
1466 com->fx_buf[k + j] = x[nn + j];
1467 }
1468 com->iactv[i] = off_sph[nm];
1469 }
1470 }
1471 }
1472 off_link += rest;
1473 }
1474}
1475
1476
1477void _FCALL SEND_DATA_C(int *idp, int *nng, int *nodbuf,
1478 my_real_c *fx, my_real_c *fr, my_real_c *stx, my_real_c *str,
1479 my_real_c *vx, my_real_c *vr, my_real_c *ms, my_real_c *in,
1480 double *dx, my_real_c *x, int *typ, int *npas, my_real_c *rby,
1481 int *tag_rby, int *add_rby, int *rbylnk, int *kin, double *dr,
1482 my_real_c *dt2, int *iex, int *off_sph, int *numsph_glo, int *nrby){
1483 send_data_c(idp, nng, nodbuf,
1484 fx, fr, stx, str,
1485 vx, vr, ms, in,
1486 dx, x, typ, npas, rby,
1487 tag_rby, add_rby, rbylnk, kin, dr,
1488 dt2, iex, off_sph, numsph_glo, nrby);
1489}
1490
1491void send_data_c_(int *idp, int *nng, int *nodbuf,
1492 my_real_c *fx, my_real_c *fr, my_real_c *stx, my_real_c *str,
1493 my_real_c *vx, my_real_c *vr, my_real_c *ms, my_real_c *in,
1494 double *dx, my_real_c *x, int *typ, int *npas, my_real_c *rby,
1495 int *tag_rby, int *add_rby, int *rbylnk, int *kin, double *dr,
1496 my_real_c *dt2, int *iex, int *off_sph, int *numsph_glo, int *nrby){
1497 send_data_c(idp, nng, nodbuf,
1498 fx, fr, stx, str,
1499 vx, vr, ms, in,
1500 dx, x, typ, npas, rby,
1501 tag_rby, add_rby, rbylnk, kin, dr,
1502 dt2, iex, off_sph, numsph_glo, nrby);
1503}
1504
1505void send_data_c__(int *idp, int *nng, int *nodbuf,
1506 my_real_c *fx, my_real_c *fr, my_real_c *stx, my_real_c *str,
1507 my_real_c *vx, my_real_c *vr, my_real_c *ms, my_real_c *in,
1508 double *dx, my_real_c *x, int *typ, int *npas, my_real_c *rby,
1509 int *tag_rby, int *add_rby, int *rbylnk, int *kin, double *dr,
1510 my_real_c *dt2, int *iex, int *off_sph, int *numsph_glo, int *nrby){
1511 send_data_c(idp, nng, nodbuf,
1512 fx, fr, stx, str,
1513 vx, vr, ms, in,
1514 dx, x, typ, npas, rby,
1515 tag_rby, add_rby, rbylnk, kin, dr,
1516 dt2, iex, off_sph, numsph_glo, nrby);
1517}
1518
1519
1520//-------------------------------------------------------------
1521void send_data_nl_c(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *vx, my_real_c *ms, int *npas, int *iex){
1522 int rest, next, chunk;
1523 int i;
1524
1525 rest = *nng;
1526 chunk = rest / nthreads;
1527
1528 #pragma omp parallel for schedule(static, chunk) if (chunk > 350) private(i)
1529 for (next = 0; next < rest; next++) {
1530 i = next;
1531 com->mass_buf[off_link + i] = ms[iadd_nl[i] - 1];
1532 com->fx_buf[3 * (off_link + i)] = fx[iadd_nl[i] - 1];
1533 }
1534
1535 if (*npas == 0) {
1536 #pragma omp parallel for schedule(static, chunk) if (chunk > 350) private(i)
1537 for (next = 0; next < rest; next++) {
1538 i = next;
1539 com->vx_buf[3 * (off_link + i)] = vx[iadd_nl[i] - 1];
1540 }
1541 }
1542
1543 off_link += rest;
1544}
1545
1546void _FCALL SEND_DATA_NL_C(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *vx, my_real_c *ms, int *npas, int *iex){
1547 send_data_nl_c(idp, nng, iadd_nl, fx, vx, ms, npas, iex);
1548}
1549
1550void send_data_nl_c_(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *vx, my_real_c *ms, int *npas, int *iex){
1551 send_data_nl_c(idp, nng, iadd_nl, fx, vx, ms, npas, iex);
1552}
1553
1554void send_data_nl_c__(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *vx, my_real_c *ms, int *npas, int *iex){
1555 send_data_nl_c(idp, nng, iadd_nl, fx, vx, ms, npas, iex);
1556}
1557
1558
1559//-------------------------------------------------------------
1560void send_data_spmd_c(int *idp, int *nng,
1561 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3,
1562 my_real_c *bufr4, my_real_c *bufr5, my_real_c *bufr6,
1563 double *bufr7, my_real_c *bufr8, my_real_c *bufr9,
1564 my_real_c *buf_rby, int *flg_rby, int *typ, int *npas, int *iex){
1565 int buflen, lbuf, rest, next, nn, nm, i, j, k, chunk;
1566
1567 rest = *nng;
1568 if (*iex == 1)
1569 off_link = 0;
1570
1571 if (*typ != 7) {
1572 chunk = rest / nthreads;
1573 #pragma omp parallel for schedule(static, chunk) if (chunk > 350) private(k, i, nn, nm)
1574 for (next = 0; next < rest; next++) {
1575 i = off_link + next;
1576 k = 3 * i;
1577 nm = next;
1578 nn = 3 * next;
1579 for (j = 0; j < 3; j++) {
1580 com->fx_buf[k + j] = bufr1[nn + j];
1581 com->fr_buf[k + j] = bufr2[nn + j];
1582 if ((*typ <= 4) || (*npas == 0))
1583 com->vx_buf[k + j] = bufr5[nn + j];
1584 com->dx_buf[k + j] = bufr7[nn + j];
1585 }
1586 com->mass_buf[i] = bufr8[nm];
1587 if (*typ == 5)
1588 com->sx_buf[i] = bufr3[nm];
1589 if (flagrot[*idp]) {
1590 if (*typ == 5)
1591 com->sr_buf[i] = bufr4[nm];
1592 com->iner_buf[i] = bufr9[nm];
1593 if (*flg_rby == 1)
1594 for (j = 0; j < 9; j++)
1595 com->iner_rby_buf[9 * i + j] = buf_rby[9 * next + j];
1596 if ((*typ <= 4) || (*npas == 0))
1597 for (j = 0; j < 3; j++)
1598 com->vr_buf[k + j] = bufr6[nn + j];
1599 }
1600 }
1601 off_link += rest;
1602 }
1603}
1604
1605/******************************************************************/
1606void _FCALL SEND_DATA_SPMD_C(int *idp, int *nng,
1607 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3,
1608 my_real_c *bufr4, my_real_c *bufr5, my_real_c *bufr6,
1609 double *bufr7, my_real_c *bufr8, my_real_c *bufr9,
1610 my_real_c *buf_rby, int *flg_rby, int *typ, int *npas, int *iex){
1611 send_data_spmd_c(idp, nng, bufr1, bufr2, bufr3, bufr4, bufr5, bufr6, bufr7, bufr8, bufr9, buf_rby, flg_rby, typ, npas, iex);
1612}
1613
1614void send_data_spmd_c_(int *idp, int *nng,
1615 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3,
1616 my_real_c *bufr4, my_real_c *bufr5, my_real_c *bufr6,
1617 double *bufr7, my_real_c *bufr8, my_real_c *bufr9,
1618 my_real_c *buf_rby, int *flg_rby, int *typ, int *npas, int *iex){
1619 send_data_spmd_c(idp, nng, bufr1, bufr2, bufr3, bufr4, bufr5, bufr6, bufr7, bufr8, bufr9, buf_rby, flg_rby, typ, npas, iex);
1620}
1621
1622void send_data_spmd_c__(int *idp, int *nng,
1623 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3,
1624 my_real_c *bufr4, my_real_c *bufr5, my_real_c *bufr6,
1625 double *bufr7, my_real_c *bufr8, my_real_c *bufr9,
1626 my_real_c *buf_rby, int *flg_rby, int *typ, int *npas, int *iex){
1627 send_data_spmd_c(idp, nng, bufr1, bufr2, bufr3, bufr4, bufr5, bufr6, bufr7, bufr8, bufr9, buf_rby, flg_rby, typ, npas, iex);
1628}
1629
1630
1631//-------------------------------------------------------------
1632void get_stiff_c(int *idp, int *nng, int *nodbuf,
1633 my_real_c *ms, my_real_c *ir,
1634 my_real_c *stx, my_real_c *str,
1635 int *typ, int *npas, int *iex){
1636 int buflen, lbuf, rest, next;
1637 int i, j, k, nn, nm, offset, chunk;
1638 my_real_c df, dm;
1639
1640 rest = *nng;
1641 if (*iex == 1)
1642 off_link = 0;
1643
1644 if (*typ == 5) {
1645 chunk = rest / nthreads;
1646 #pragma omp parallel for schedule(static, chunk) if (chunk > 350) private(i, k, nm, nn)
1647 for (next = 0; next < rest; next++) {
1648 i = off_link + next;
1649 k = 3 * i;
1650 nm = (nodbuf[next] - 1);
1651 nn = 3 * nm;
1652 if (*npas == 0)
1653 ms[nm] = com->mass_buf[i];
1654 stx[nm] = com->sx_buf[i];
1655 if (flagrot[*idp]) {
1656 if (*npas == 0)
1657 ir[nm] = com->iner_buf[i];
1658 str[nm] = com->sr_buf[i];
1659 }
1660 }
1661 }
1662 off_link += rest;
1663}
1664/******************************************************************/
1665void _FCALL GET_STIFF_C(int *idp, int *nng, int *nodbuf,
1666 my_real_c *ms, my_real_c *ir,
1667 my_real_c *stx, my_real_c *str,
1668 int *typ, int *npas, int *iex){
1669 get_stiff_c(idp, nng, nodbuf, ms, ir, stx, str, typ, npas, iex);
1670}
1671
1672void get_stiff_c_(int *idp, int *nng, int *nodbuf,
1673 my_real_c *ms, my_real_c *ir,
1674 my_real_c *stx, my_real_c *str,
1675 int *typ, int *npas, int *iex){
1676 get_stiff_c(idp, nng, nodbuf, ms, ir, stx, str, typ, npas, iex);
1677}
1678
1679void get_stiff_c__(int *idp, int *nng, int *nodbuf,
1680 my_real_c *ms, my_real_c *ir,
1681 my_real_c *stx, my_real_c *str,
1682 int *typ, int *npas, int *iex){
1683 get_stiff_c(idp, nng, nodbuf, ms, ir, stx, str, typ, npas, iex);
1684}
1685
1686
1687//-------------------------------------------------------------
1688void get_stiff_spmd_c(int *idp, int *nng,
1689 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4,
1690 int *typ, int *npas, int *iex, int *nglob){
1691 int buflen, lbuf, rest, next, nm, nn, i, k, chunk;
1692 my_real_c df, dm;
1693
1694 rest = *nglob;
1695 if (*iex == 1)
1696 off_link = 0;
1697
1698 if (*typ == 5) {
1699 chunk = rest / nthreads;
1700 #pragma omp parallel for schedule(static, chunk) if (chunk > 350) private(i, k, nm, nn)
1701 for (next = 0; next < rest; next++) {
1702 i = off_link + masterdb[*iex - 1][next];
1703 k = 3 * i;
1704 nm = next;
1705 nn = 3 * nm;
1706 if (*npas == 0)
1707 bufr1[nm] = com->mass_buf[i];
1708 bufr2[nm] = com->sx_buf[i];
1709 if (flagrot[*idp]) {
1710 if (*npas == 0)
1711 bufr3[nm] = com->iner_buf[i];
1712 bufr4[nm] = com->sr_buf[i];
1713 }
1714 }
1715 }
1716 off_link += *nng;
1717}
1718
1719void _FCALL GET_STIFF_SPMD_C(int *idp, int *nng,
1720 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4,
1721 int *typ, int *npas, int *iex, int *nglob){
1722 get_stiff_spmd_c(idp, nng, bufr1, bufr2, bufr3, bufr4, typ, npas, iex, nglob);
1723}
1724
1725void get_stiff_spmd_c_(int *idp, int *nng,
1726 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4,
1727 int *typ, int *npas, int *iex, int *nglob){
1728 get_stiff_spmd_c(idp, nng, bufr1, bufr2, bufr3, bufr4, typ, npas, iex, nglob);
1729}
1730
1731void get_stiff_spmd_c__(int *idp, int *nng,
1732 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4,
1733 int *typ, int *npas, int *iex, int *nglob){
1734 get_stiff_spmd_c(idp, nng, bufr1, bufr2, bufr3, bufr4, typ, npas, iex, nglob);
1735}
1736
1737//-------------------------------------------------------------
1738void get_force_c(int *idp, int *nng, int *nodbuf, my_real_c *wf,
1739 my_real_c *wm, my_real_c *wf2, my_real_c *wm2, my_real_c *v,
1740 my_real_c *vr, my_real_c *fx, my_real_c *fr, my_real_c *ms,
1741 my_real_c *in, my_real_c *x, double *xdp, my_real_c *dx,
1742 int *typ, int *kin, int *wgt, int *iex, int *iresp, double *tfext){
1743
1744 int buflen, lbuf, rest, next, weight;
1745 int i, j, k, nn, nm, chunk;
1746 my_real_c df, dm, wfl, wf2l, wml, wm2l;
1747
1748 rest = *nng;
1749 wfl = 0;
1750 wf2l = 0;
1751 wml = 0;
1752 wm2l = 0;
1753
1754 if (*iex == 1)
1755 off_link = 0;
1756
1757 if (*typ != 7) {
1758 chunk = rest / nthreads;
1759 #pragma omp parallel for schedule(static, chunk) if (chunk > 350) private(i, k, nm, nn, weight, j, dm, df) reduction(+:wfl, wf2l, wml, wm2l)
1760 for (next = 0; next < rest; next++) {
1761 i = off_link + next;
1762 k = 3 * i;
1763 nm = (nodbuf[next] - 1);
1764 nn = 3 * nm;
1765 weight = wgt[nm];
1766 if ((*typ == 5) && (*kin == 1))
1767 ms[nm] = com->mass_buf[i];
1768 if ((*typ == 5) && (*kin == 1))
1769 in[nm] = com->iner_buf[i];
1770 for (j = 0; j < 3; j++) {
1771 if (*typ < 4)
1772 v[nn + j] = com->vx_buf[k + j];
1773 /************ Activation/deactivation of SPH particles ***********/
1774 if (flg_sphinout == 1) {
1775 if (com->iactv[i] == 1) { /* activation of particle */
1776 x[nn + j] = com->fx_buf[k + j];
1777 if (*iresp == 1) {
1778 xdp[nn + j] = com->fx_buf[k + j];
1779 }
1780 com->fx_buf[k + j] = 0;
1781 v[nn + j] = com->vx_buf[k + j];
1782 dx[nn + j] = com->dx_buf[k + j];
1783 weight = 0;
1784 } else {
1785 if (com->iactv[i] == -1) { /* deactivation of particle */
1786 x[nn + j] = com->fx_buf[k + j];
1787 if (*iresp == 1)
1788 xdp[nn + j] = com->fx_buf[k + j];
1789 com->fx_buf[k + j] = 0;
1790 v[nn + j] = 0;
1791 dx[nn + j] = 0;
1792 weight = 0;
1793 }
1794 }
1795 }
1796 df = weight * (com->fx_buf[k + j] * ms[nm] - fx[nn + j]);
1797 fx[nn + j] = com->fx_buf[k + j] * ms[nm];
1798 wfl += df * v[nn + j] / 2.0;
1799 if (ms[nm] > 0)
1800 wf2l += df * fx[nn + j] / (2.0 * ms[nm]);
1801 if (flagrot[*idp]) {
1802 if (*typ < 4)
1803 vr[nn + j] = com->vr_buf[k + j];
1804 dm = weight * (com->fr_buf[k + j] * in[nm] - fr[nn + j]);
1805 fr[nn + j] = com->fr_buf[k + j] * in[nm];
1806 wml += dm * vr[nn + j] / 2.0;
1807 if (in[nm] > 0)
1808 wm2l += dm * fr[nn + j] / (2.0 * in[nm]);
1809 }
1810 }
1811 }
1812
1813 *wf += wfl;
1814 *wf2 += wf2l;
1815 *wm += wml;
1816 *wm2 += wm2l;
1817 off_link += rest;
1818 }
1819}
1820
1821//-----------------------------------------------------
1822void _FCALL GET_FORCE_C(int *idp, int *nng, int *nodbuf, my_real_c *wf,
1823 my_real_c *wm, my_real_c *wf2, my_real_c *wm2, my_real_c *v,
1824 my_real_c *vr, my_real_c *fx, my_real_c *fr, my_real_c *ms,
1825 my_real_c *in, my_real_c *x, double *xdp, my_real_c *dx,
1826 int *typ, int *kin, int *wgt, int *iex, int *iresp, double *tfext){
1827 get_force_c(idp, nng, nodbuf, wf,
1828 wm, wf2, wm2, v,
1829 vr, fx, fr, ms,
1830 in, x, xdp, dx,
1831 typ, kin, wgt, iex, iresp, tfext);
1832}
1833void get_force_c_(int *idp, int *nng, int *nodbuf, my_real_c *wf,
1834 my_real_c *wm, my_real_c *wf2, my_real_c *wm2, my_real_c *v,
1835 my_real_c *vr, my_real_c *fx, my_real_c *fr, my_real_c *ms,
1836 my_real_c *in, my_real_c *x, double *xdp, my_real_c *dx,
1837 int *typ, int *kin, int *wgt, int *iex, int *iresp, double *tfext){
1838 get_force_c(idp, nng, nodbuf, wf,
1839 wm, wf2, wm2, v,
1840 vr, fx, fr, ms,
1841 in, x, xdp, dx,
1842 typ, kin, wgt, iex, iresp, tfext);
1843}
1844
1845void get_force_c__(int *idp, int *nng, int *nodbuf, my_real_c *wf,
1846 my_real_c *wm, my_real_c *wf2, my_real_c *wm2, my_real_c *v,
1847 my_real_c *vr, my_real_c *fx, my_real_c *fr, my_real_c *ms,
1848 my_real_c *in, my_real_c *x, double *xdp, my_real_c *dx,
1849 int *typ, int *kin, int *wgt, int *iex, int *iresp, double *tfext){
1850 get_force_c(idp, nng, nodbuf, wf,
1851 wm, wf2, wm2, v,
1852 vr, fx, fr, ms,
1853 in, x, xdp, dx,
1854 typ, kin, wgt, iex, iresp, tfext);
1855}
1856
1857
1858//-----------------------------------------------------
1859void get_force_nl_c(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *ms, int *iex){
1860int rest, next;
1861int i, chunk;
1862
1863 rest = *nng;
1864
1865 if (*iex == 1) off_link = 0;
1866
1867 chunk = rest / nthreads;
1868 #pragma omp parallel for schedule(static,chunk) if (chunk>350) private(i)
1869 for (next = 0; next < rest; next++)
1870 {
1871 i = next;
1872 fx[iadd_nl[i]-1] = com->fx_buf[3*(off_link+i)]*ms[iadd_nl[i]-1];
1873 }
1874
1875 off_link += rest;
1876}
1877
1878void _FCALL GET_FORCE_NL_C(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *ms, int *iex){
1879 get_force_nl_c(idp, nng, iadd_nl, fx, ms, iex);
1880}
1881
1882void get_force_nl_c_(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *ms, int *iex){
1883 get_force_nl_c(idp, nng, iadd_nl, fx, ms, iex);
1884}
1885
1886void get_force_nl_c__(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *ms, int *iex){
1887 get_force_nl_c(idp, nng, iadd_nl, fx, ms, iex);
1888}
1889
1890
1891//-----------------------------------------------------
1892void get_force_spmd_c(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, int *typ, int *iex, int *nglob)
1893{
1894 int buflen, lbuf, rest, next, chunk, i, j, k, nn, nm;
1895
1896 rest = *nglob;
1897 if (*iex == 1)
1898 off_link = 0;
1899
1900 if (*typ != 7) {
1901 chunk = rest / nthreads;
1902 #pragma omp parallel for schedule(static, chunk) if (chunk > 350) private(i, k, nm, nn)
1903 for (next = 0; next < rest; next++) {
1904 i = off_link + masterdb[*iex - 1][next];
1905 k = 3 * i;
1906 nm = next;
1907 nn = 3 * nm;
1908 for (j = 0; j < 3; j++) {
1909 if (*typ < 4)
1910 bufr3[nn + j] = com->vx_buf[k + j];
1911 bufr1[nn + j] = com->fx_buf[k + j];
1912 if (flagrot[*idp]) {
1913 if (*typ < 4)
1914 bufr4[nn + j] = com->vr_buf[k + j];
1915 bufr2[nn + j] = com->fr_buf[k + j];
1916 }
1917 }
1918 }
1919 off_link += *nng;
1920 }
1921}
1922
1923void _FCALL GET_FORCE_SPMD_C(int *idp, int *nng,
1924 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3,
1925 my_real_c *bufr4, int *typ, int *iex, int *nglob){
1926 get_force_spmd_c(idp, nng, bufr1, bufr2, bufr3, bufr4, typ, iex, nglob);
1927}
1928
1929void get_force_spmd_c_(int *idp, int *nng,
1930 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3,
1931 my_real_c *bufr4, int *typ, int *iex, int *nglob){
1932 get_force_spmd_c(idp, nng, bufr1, bufr2, bufr3, bufr4, typ, iex, nglob);
1933}
1934
1935void get_force_spmd_c__(int *idp, int *nng,
1936 my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3,
1937 my_real_c *bufr4, int *typ, int *iex, int *nglob){
1938 get_force_spmd_c(idp, nng, bufr1, bufr2, bufr3, bufr4, typ, iex, nglob);
1939}
1940
1941//-----------------------------------------------------
1942static void do_activ_c(int *iflg){
1943 readr(fidr, (void *) iflg, sizeof(int));
1944}
1945
1946void _FCALL DO_ACTIV_C(int *iflg){
1947 do_activ_c(iflg);
1948}
1949
1950void do_activ_c_(int *iflg){
1951 do_activ_c(iflg);
1952}
1953
1954void do_activ_c__(int *iflg){
1955 do_activ_c(iflg);
1956}
1957
1958
1959//-----------------------------------------------------
1960void send_mass_kine_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *iex, int *offset){
1961 int buflen, lbuf, rest, next;
1962 int i, j, k, nn, nm, chunk;
1963
1964 rest = *nng;
1965
1966 chunk = rest / nthreads;
1967 #pragma omp parallel for schedule(static, chunk) if (chunk > 350) private(k, i, nm, nn)
1968 for (next = 0; next < rest; next++) {
1969 i = *offset + next;
1970 k = 3 * i;
1971 nm = nodbuf[next] - 1;
1972 nn = 3 * nm;
1973 com->mass_buf[i] = ms[nm];
1974 if (flagrot[*idp]) com->iner_buf[i] = in[nm];
1975 }
1976}
1977
1978void _FCALL SEND_MASS_KINE_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *iex, int *offset){
1979 send_mass_kine_c(idp, nng, nodbuf, ms, in, iex, offset);
1980}
1981
1982void send_mass_kine_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *iex, int *offset){
1983 send_mass_kine_c(idp, nng, nodbuf, ms, in, iex, offset);
1984}
1985
1986void send_mass_kine_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *iex, int *offset){
1987 send_mass_kine_c(idp, nng, nodbuf, ms, in, iex, offset);
1988}
1989
1990
1991//---------------------------------------------
1992void get_displ_c(int *idp, int *nng, int *nodbuf, my_real_c *x){
1993 int buflen, lbuf, rest, next;
1994 int i, j, k, nn, nm;
1995
1996 writer(fidw, (void *)idp, sizeof(int));
1997
1998 rest = *nng;
1999 next = 0;
2000 while (rest > 0) {
2001 buflen = (rest / nbufvar > 0 ? nbufvar : rest % nbufvar);
2002 lbuf = buflen * sizeof(my_real_c);
2003 readr(fidr, (void *)dx_buf, 3 * lbuf);
2004
2005 for (i = 0; i < buflen; i++, next++) {
2006 k = 3 * i;
2007 nm = (nodbuf[next] - 1);
2008 nn = 3 * nm;
2009 for (j = 0; j < 3; j++)
2010 x[nn + j] = dx_buf[k + j];
2011 }
2012 rest -= buflen;
2013 }
2014}
2015
2016void _FCALL GET_DISPL_C(int *idp, int *nng, int *nodbuf, my_real_c *x){
2017 get_displ_c(idp, nng, nodbuf, x);
2018}
2019
2020void get_displ_c_(int *idp, int *nng, int *nodbuf, my_real_c *x){
2021 get_displ_c(idp, nng, nodbuf, x);
2022}
2023
2024void get_displ_c__(int *idp, int *nng, int *nodbuf, my_real_c *x){
2025 get_displ_c(idp, nng, nodbuf, x);
2026}
2027
2028
2029//---------------------------------------------
2030void get_displ_spmd_c(int *idp, int *nng, my_real_c *bufr){
2031 int buflen, lbuf, rest, next;
2032
2033 writer(fidw, (void *)idp, sizeof(int));
2034
2035 rest = *nng;
2036 next = 0;
2037 while (rest > 0) {
2038 buflen = (rest / nbufvar > 0 ? nbufvar : rest % nbufvar);
2039 lbuf = buflen * sizeof(my_real_c);
2040 readr(fidr, (void *)&bufr[3 * next], 3 * lbuf);
2041 next += buflen;
2042 rest -= buflen;
2043 }
2044}
2045
2046void _FCALL GET_DISPL_SPMD_C(int *idp, int *nng, my_real_c *bufr){
2047 get_displ_spmd_c(idp, nng, bufr);
2048}
2049
2050void get_displ_spmd_c_(int *idp, int *nng, my_real_c *bufr){
2051 get_displ_spmd_c(idp, nng, bufr);
2052}
2053
2054void get_displ_spmd_c__(int *idp, int *nng, my_real_c *bufr){
2055 get_displ_spmd_c(idp, nng, bufr);
2056}
2057
2058
2059//-------------------------------------------------------------
2060static void close_r2r_pipe_c()
2061{
2062#ifdef _WIN64
2063 CloseHandle(fidr);
2064 CloseHandle(fidw);
2065#else
2066 close(fidr);
2067 close(fidw);
2068#endif
2069}
2076
2077/***************Routines for socket communication***********************/
2078
2080#ifdef DNC
2081 int num,i,nb,flags,compt,capt,compt2,port2,finished;
2082 struct hostent *hp;
2083 struct linger so_linger;
2084 char str[32];
2085
2086#ifdef _WIN64
2087 SOCKET sock;
2088 SOCKADDR_IN server, *serv;
2089
2090 WSADATA WSAData;
2091 WSAStartup(MAKEWORD(2,0), &WSAData);
2092
2093 struct addrinfo hints, *res;
2094 int err;
2095#else
2096 struct hostent *gethostbyname();
2097 struct sockaddr_in server;
2098 int sock;
2099#endif
2100 char nom[512];
2101 char PUF[512];
2102
2103
2104#ifdef _WIN64
2105
2106 gethostname(PUF,512);
2107 hp = gethostbyname(PUF);
2108
2109 memcpy ( &(server.sin_addr.s_addr), hp->h_addr, hp->h_length);
2110 server.sin_family = AF_INET;
2111
2112#else
2113
2114 gethostname(PUF,sizeof(PUF));
2115 hp = gethostbyname(PUF);
2116
2117 memcpy ( &(server.sin_addr.s_addr), hp->h_addr, hp->h_length);
2118 server.sin_family = AF_INET;
2119#endif
2120
2121 sock = socket (AF_INET,SOCK_STREAM,0);
2122 compt = 0;
2123 compt2 = 0;
2124 capt = -1;
2125 finished = 0;
2126
2127 /********************Iteration on ports to find a free one***************/
2128
2129 while (finished == 0){
2130
2131 while ((capt == -1)&&(compt < 3)){
2132 port2 = SERV_TCP_PORT1-compt;
2133 sock = socket (AF_INET,SOCK_STREAM,0);
2134 so_linger.l_onoff = TRUE;
2135 so_linger.l_linger = 0;
2136
2137
2138#ifdef _WIN64
2139 if (setsockopt(sock, SOL_SOCKET, SO_LINGER,(char *) &so_linger, sizeof(so_linger))==-1)
2140 {perror("setsockopt linger");exit(1);}
2141
2142 printf("port:%i\n",port2);
2143 fflush(stdout);
2144 server.sin_port = htons(port2);
2145 capt = connect(sock, (struct sockaddr *) &server, sizeof(server));
2146#else
2147 if (setsockopt(sock, SOL_SOCKET, SO_LINGER, &so_linger, sizeof(so_linger))==-1)
2148 {perror("setsockopt linger");exit(1);}
2149
2150 server.sin_port = htons(port2);
2151 capt = connect(sock, (struct sockaddr *)&server, sizeof(server));
2152#endif
2153
2154 if ( capt != -1) finished = 1;
2155
2156 if ( capt == -1) {
2157 compt++;
2158#ifdef _WIN32
2159 closesocket(sock);
2160#else
2161 close(sock);
2162#endif
2163 }
2164 }
2165
2166 if ( compt >= 3) {
2167
2168 if (compt2 == 0){
2169 printf("\n Can't connect to rad2rad : waiting ...\n");}
2170#ifdef _WIN32
2171 closesocket(sock);
2172 Sleep(700);
2173#else
2174 close(sock);
2175 sleep(2);
2176#endif
2177
2178 compt=0;
2179 compt2++;
2180
2181 if (compt2 >= 10){
2182 printf("\n ERROR : Can't connect to rad2rad after 10 naps\n\n");
2183 exit(1);}
2184 }
2185 }
2186
2187 *sd = sock;
2188#endif
2189}
2190
2193
2196
2199
2200
2201//-------------------------------------------------------------
2202void send_sock_init_c(int *iroot,int *len,int *ispmd,int *sd,int *maxproc,int *imach){
2203 int num,i,nb,code,spmd,vers,compt2,imachine,flag_error;
2204#ifdef _WIN64
2205 SOCKET sock;
2206#else
2207 int sock;
2208#endif
2209 char nom[512];
2210 char PUF[512];
2211#ifdef DNC
2212
2213 sock=*sd;
2214 num = *ispmd;
2215 nb = *maxproc;
2216 vers = 12180 + R4R8_C;
2217 imachine = *imach;
2218
2219 for (i = 0; i < *len; i++)
2220 {
2221 root[i] = (char) iroot[i];
2222 }
2223
2224 if (send(sock,(send_type)root,70*sizeof(char), 0) == -1){
2225 perror("send name");
2226 exit(1);}
2227
2228 if (send(sock,(send_type)&nb,sizeof(nb), 0) == -1){
2229 perror("send nb proc");
2230 exit(1);}
2231
2232 if (send(sock,(send_type)&vers,sizeof(vers), 0) == -1){
2233 perror("send version");
2234 exit(1);}
2235
2236 if (send(sock,(send_type)&imachine,sizeof(vers), 0) == -1){
2237 perror("send imach");
2238 exit(1);}
2239
2240 if (recv(sock,(send_type)&flag_error,sizeof(flag_error), 0) <= 0){
2241 perror("recv rad2rad message");
2242 exit(1);}
2243 if (flag_error == 1) {printf("\n error message sent by rad2rad\n");exit(1);}
2244
2245 if (nb != 0){
2246 if (recv(sock,(send_type)nom,sizeof(nom), 0) <= 0){
2247 perror("recv top");
2248 exit(1);
2249 }
2250 }
2251#endif
2252}
2253
2254void _FCALL SEND_SOCK_INIT_C(int *iroot, int *len, int *ispmd, int *sd, int *maxproc, int *imach){
2255 send_sock_init_c(iroot,len,ispmd,sd,maxproc,imach);
2256}
2257
2258void send_sock_init_c_(int *iroot, int *len, int *ispmd, int *sd, int *maxproc, int *imach){
2259 send_sock_init_c(iroot,len,ispmd,sd,maxproc,imach);
2260}
2261
2262void send_sock_init_c__(int *iroot, int *len, int *ispmd, int *sd, int *maxproc, int *imach){
2263 send_sock_init_c(iroot,len,ispmd,sd,maxproc,imach);
2264}
2265
2266
2267//-------------------------------------------------------------
2268void connection_sock_c(int *ispmd, int *sd, char *addr){
2269#ifdef DNC
2270 int nb, port2, compt, capt;
2271 struct hostent *hp;
2272 struct linger so_linger;
2273
2274#ifdef _WIN64
2275 SOCKET sock;
2276 SOCKADDR_IN server;
2277#else
2278 struct hostent *gethostbyname();
2279 struct sockaddr_in server;
2280 int sock;
2281#endif
2282
2283 char nom[512];
2284 char PUF[512];
2285
2286 gethostname(PUF, sizeof(PUF));
2287 hp = gethostbyname(addr);
2288 nb = *ispmd;
2289
2290 memcpy(&(server.sin_addr.s_addr), hp->h_addr, hp->h_length);
2291 server.sin_family = AF_INET;
2292
2293 compt = 0;
2294 capt = -1;
2295
2296/********************Iteration on ports to find a free one***************/
2297 while ((capt == -1) && compt < 3) {
2298 port2 = SERV_TCP_PORT1 - compt;
2299 sock = socket(AF_INET, SOCK_STREAM, 0);
2300 server.sin_port = htons(port2);
2301 so_linger.l_onoff = TRUE;
2302 so_linger.l_linger = 0;
2303 if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (send_type)&so_linger, sizeof(so_linger)) == -1) {
2304 perror("setsockopt linger");
2305 exit(1);
2306 }
2307 capt = connect(sock, (struct sockaddr *)&server, sizeof(server));
2308 if (capt == -1) {
2309 compt++;
2310#ifdef _WIN64
2311 closesocket(sock);
2312#else
2313 close(sock);
2314#endif
2315 }
2316 }
2317
2318 if (compt >= 3) {
2319 perror("Can't connect socket...");
2320#ifdef _WIN64
2321 closesocket(sock);
2322#else
2323 close(sock);
2324#endif
2325 exit(1);
2326 }
2327
2328/**************************************************************************************/
2329
2330 if (send(sock, (send_type)&nb, sizeof(nb), 0) == -1) {
2331 perror("send ispmd");
2332 exit(1);
2333 }
2334
2335 *sd = sock;
2336 sock = *sd;
2337#endif
2338}
2339
2340void _FCALL CONNECTION_SOCK_C(int *ispmd, int *sd, char *addr){
2341 connection_sock_c(ispmd,sd,addr);
2342}
2343
2344void connection_sock_c_(int *ispmd, int *sd, char *addr){
2345 connection_sock_c(ispmd,sd,addr);
2346}
2347
2348void connection_sock_c__(int *ispmd, int *sd, char *addr){
2349 connection_sock_c(ispmd,sd,addr);
2350}
2351
2352
2353//-------------------------------------------------------------
2354void mess_sock_c(int *sd){
2355#ifdef _WIN64
2356 SOCKET sock;
2357#else
2358 int sock;
2359#endif
2360 char nom[512];
2361
2362 sock = *sd;
2363
2364 if (recv(sock, (send_type)nom, 3 * sizeof(char), 0) == -1) {
2365 perror("recv norm");
2366 exit(1);
2367 }
2368}
2369
2370void _FCALL MESS_SOCK_C(int *sd){
2371 mess_sock_c(sd);}
2372
2373void mess_sock_c_(int *sd){
2374 mess_sock_c(sd);
2375}
2376
2377void mess_sock_c__(int *sd){
2378 mess_sock_c(sd);
2379}
2380
2381
2382//-------------------------------------------------------------
2383void send_sock_c(int *sd){
2384
2385#ifdef _WIN64
2386 SOCKET sock;
2387#else
2388 int sock;
2389#endif
2390 char nom[512];
2391
2392 sock=*sd;
2393
2394 if (send(sock,(send_type)buftop,3*sizeof(char), 0) == -1){
2395 perror("send norm");
2396 exit(1);}
2397}
2398
2399void _FCALL SEND_SOCK_C(int *sd){
2400 send_sock_c(sd);}
2401
2402void send_sock_c_(int *sd){
2403 send_sock_c(sd);
2404}
2405
2406void send_sock_c__(int *sd){
2407 send_sock_c(sd);
2408}
2409
2410
2411//--------------------------------------------------------------
2412void get_sock_ibuf_c(int *sd, int *ibuf, int *len){
2413#ifdef _WIN64
2414 SOCKET sock;
2415#else
2416 int sock;
2417#endif
2418 sock=*sd;
2419 if (recv(sock,(send_type)ibuf,*len*sizeof(int), 0) == -1){
2420 perror("send sock ibuf ");
2421 exit(1);}
2422}
2423void _FCALL GET_SOCK_IBUF_C(int *sd, int *ibuf, int *len){
2424
2425 get_sock_ibuf_c(sd, ibuf, len);
2426}
2427
2428void get_sock_ibuf_c_(int *sd, int *ibuf, int *len){
2429
2430 get_sock_ibuf_c(sd, ibuf, len);
2431}
2432
2433void get_sock_ibuf_c__(int *sd, int *ibuf, int *len){
2434 get_sock_ibuf_c(sd, ibuf, len);
2435}
2436
2437
2438//--------------------------------------------------------------
2439void send_sock_ibuf_c(int *sd, int *ibuf, int *len){
2440#ifdef _WIN64
2441 SOCKET sock;
2442#else
2443 int sock;
2444#endif
2445 sock=*sd;
2446 if (send(sock,(send_type)ibuf,*len*sizeof(int), 0) == -1){
2447 perror("send sock ibuf ");
2448 exit(1);}
2449}
2450void _FCALL SEND_SOCK_IBUF_C(int *sd, int *ibuf, int *len){
2451 send_sock_ibuf_c(sd, ibuf, len);
2452}
2453
2454void send_sock_ibuf_c_(int *sd, int *ibuf, int *len){
2455 send_sock_ibuf_c(sd, ibuf, len);
2456}
2457
2458void send_sock_ibuf_c__(int *sd, int *ibuf, int *len){
2459 send_sock_ibuf_c(sd, ibuf, len);
2460}
2461
2462
2463//---------------------------------------------
2464void send_sock_rbuf_c(int *sd, my_real_c *rbuf, int *len){
2465
2466#ifdef _WIN64
2467 SOCKET sock;
2468#else
2469 int sock;
2470#endif
2471 sock=*sd;
2472 if (send(sock,(send_type)rbuf,*len*sizeof(my_real_c), 0) == -1){
2473 perror("send sock rbuf ");
2474 exit(1);}
2475}
2476
2477void _FCALL SEND_SOCK_RBUF_C(int *sd, my_real_c *rbuf, int *len){
2478 send_sock_rbuf_c(sd, rbuf, len);
2479}
2480
2481void send_sock_rbuf_c_(int *sd, my_real_c *rbuf, int *len){
2482 send_sock_rbuf_c(sd, rbuf, len);
2483}
2484
2485void send_sock_rbuf_c__(int *sd, my_real_c *rbuf, int *len){
2486 send_sock_rbuf_c(sd, rbuf, len);
2487}
2488
2489
2490//---------------------------------------------
2491void get_sock_rbuf_c(int *sd, my_real_c *rbuf, int *len){
2492
2493#ifdef _WIN64
2494 SOCKET sock;
2495#else
2496 int sock;
2497#endif
2498 sock=*sd;
2499 if (recv(sock,(send_type)rbuf,*len*sizeof(my_real_c), 0) == -1){
2500 perror("send sock rbuf ");
2501 exit(1);}
2502}
2503void _FCALL GET_SOCK_RBUF_C(int *sd, my_real_c *rbuf, int *len){
2504 get_sock_rbuf_c(sd, rbuf, len);
2505}
2506
2507void get_sock_rbuf_c_(int *sd, my_real_c *rbuf, int *len){
2508 get_sock_rbuf_c(sd, rbuf, len);
2509}
2510
2511void get_sock_rbuf_c__(int *sd, my_real_c *rbuf, int *len){
2512 get_sock_rbuf_c(sd, rbuf, len);
2513}
2514
2515
2516//---------------------------------------------
2517void send_sock_mess_c(int *sd, char *mess, int *len){
2518
2519#ifdef _WIN64
2520 SOCKET sock;
2521#else
2522 int sock;
2523#endif
2524 sock=*sd;
2525 if (send(sock,(send_type)mess,*len*sizeof(char), 0) == -1){
2526 perror("send sock mess ");
2527 exit(1);}
2528}
2529
2530void _FCALL SEND_SOCK_MESS_C(int *sd, char *mess, int *len){
2531 send_sock_mess_c(sd, mess, len);
2532}
2533
2534void send_sock_mess_c_(int *sd, char *mess, int *len){
2535 send_sock_mess_c(sd, mess, len);
2536}
2537
2538void send_sock_mess_c__(int *sd, char *mess, int *len){
2539 send_sock_mess_c(sd, mess, len);
2540}
2541
2542
2543//-------------------------------------
2544void get_sock_mess_c(int *sd, char *mess, int *len){
2545
2546#ifdef _WIN64
2547 SOCKET sock;
2548#else
2549 int sock;
2550#endif
2551 sock=*sd;
2552 if (recv(sock,(send_type)mess,*len*sizeof(char), 0) == -1){
2553 perror("send sock mess ");
2554 exit(1);}
2555}
2556
2557void _FCALL GET_SOCK_MESS_C(int *sd, char *mess, int *len){
2558 get_sock_mess_c(sd, mess, len);
2559}
2560
2561void get_sock_mess_c_(int *sd, char *mess, int *len){
2562 get_sock_mess_c(sd, mess, len);
2563}
2564
2565void get_sock_mess_c__(int *sd, char *mess, int *len){
2566 get_sock_mess_c(sd, mess, len);
2567}
2568
2569
2570//------------------------------------------------è
2571void close_sock_c(int *sd){
2572
2573#ifdef _WIN64
2574 SOCKET sock;
2575#else
2576 int sock;
2577#endif
2578
2579 sock=*sd;
2580
2581#ifdef _WIN64
2582 closesocket(sock);
2583 UnmapViewOfFile(shmv);
2584 CloseHandle(shmidv);
2585 if ((flag_siu == 0)||((flag_siu==1)&&(ispmd_glob==0))) CloseHandle(sem_int);
2586#else
2587 close(sock);
2588 if (flag_siu == 0) {sem_destroy(&sem_int);}
2589 else if ((flag_siu==1)&&(ispmd_glob==0)) {sem_close(sem_glob);sem_unlink(semaphore_int);}
2590#endif
2591}
2592
2593void _FCALL CLOSE_SOCK_C(int *sd){
2594 close_sock_c(sd);
2595}
2596
2597void close_sock_c_(int *sd){
2598 close_sock_c(sd);
2599}
2600
2601void close_sock_c__(int *sd){
2602 close_sock_c(sd);
2603}
2604
2605/****************************************/
2606
2607void get_name_c(char *name){
2608 gethostname(name,512);
2609}
2610
2611void _FCALL GET_NAME_C(char *name){
2612 get_name_c(name);
2613}
2614
2615void get_name_c_(char *name){
2616 get_name_c(name);
2617}
2618
2619void get_name_c__(char *name){
2620 get_name_c(name);
2621}
2622
2623/**************************************/
2624
2625void exch_itag_c(int *idp, int *nng, int *nodbuf,
2626 int *itag, int *itag2, int *iex, int *offset,
2627 int *flag){
2628
2629int buflen, lbuf, rest, next;
2630int i, j, k, nn, nm, chunk,nmods,nmod;
2631
2632 rest = *nng;
2633 nmod = 0;
2634
2635 /*chunk = rest / nthreads;
2636 #pragma omp parallel for schedule(static,chunk) if (chunk>350) private(k,i,nm,nn)*/
2637 for (next = 0; next < rest; next++)
2638 {
2639 i = *offset + next;
2640 nm = nodbuf[next]-1;
2641 if (*flag == 0) /* *emission* */
2642 {com->itags[i] =itag[nm];
2643 com->itags2[i] =itag2[nm];}
2644 else if (*flag == 1) /* *reception* */
2645 {itag[nm] += com->itagr[i];
2646 itag2[nm] += com->itagr2[i];}
2647
2648 }
2649}
2650
2651void _FCALL EXCH_ITAG_C(int *idp, int *nng, int *nodbuf,
2652 int *itag, int *itag2, int *iex, int *offset,
2653 int *flag){
2654 exch_itag_c(idp, nng, nodbuf, itag, itag2, iex, offset, flag);
2655}
2656
2657void exch_itag_c_(int *idp, int *nng, int *nodbuf,
2658 int *itag, int *itag2, int *iex, int *offset,
2659 int *flag){
2660 exch_itag_c(idp, nng, nodbuf, itag, itag2, iex, offset, flag);
2661}
2662
2663void exch_itag_c__(int *idp, int *nng, int *nodbuf,
2664 int *itag, int *itag2, int *iex, int *offset,
2665 int *flag){
2666 exch_itag_c(idp, nng, nodbuf, itag, itag2, iex, offset, flag);
2667}
2668
2669
2670//-------------------------------------------------------------
2671void realloc_shmvs_c(int newsize)
2672{
2673 int i, *shmloc, new_tot_size, old_tot_size;
2674
2675 old_tot_size = shmvr_size + shmvs_size;
2676 newsize = my_max(newsize, old_tot_size + 150);
2677 new_tot_size = shmvr_size + newsize;
2678
2679 shmloc = malloc(old_tot_size * sizeof(int));
2680 for (i = 0; i < old_tot_size; i++)
2681 shmloc[i] = shmv[i];
2682
2683#ifdef _WIN64
2684 UnmapViewOfFile(shmv);
2685 CloseHandle(shmidv);
2686 compt_resize++;
2687 sprintf(add_shmv, "Adress_shmv_%d_%d_%d_%d", proc_id, ispmd_glob, r2r_id, compt_resize);
2688 shmidv = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, new_tot_size * sizeof(int), add_shmv);
2689 shmv = MapViewOfFile(shmidv, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
2690#elif 1
2691 munmap(shmv, old_tot_size * sizeof(int));
2692 if (ftruncate(shmidv, new_tot_size * sizeof(int)) == -1) {
2693 perror("ftruncate");
2694 exit(1);
2695 }
2696 shmv = mmap(NULL, new_tot_size * sizeof(int), PROT_WRITE | PROT_READ, MAP_SHARED, shmidv, 0);
2697 if (shmv == MAP_FAILED) {
2698 perror("mmap");
2699 exit(1);
2700 }
2701#endif
2702
2703 for (i = 0; i < new_tot_size; i++)
2704 shmv[i] = 0;
2705 for (i = 0; i < old_tot_size; i++)
2706 shmv[i] = shmloc[i];
2707
2708 shmvs_size = newsize;
2709 com->tagelr = shmv;
2710 com->tagels = shmv + shmvr_size;
2711 free(shmloc);
2712}
2713
2714//----------------------------------------
2715void realloc_shmvr_c(int newsize) {
2716 int i, new_tot_size, old_tot_size;
2717
2718 old_tot_size = shmvr_size + shmvs_size;
2719 newsize = my_max(newsize, old_tot_size + 150);
2720 new_tot_size = shmvs_size + newsize;
2721
2722#ifdef _WIN64
2723 UnmapViewOfFile(shmv);
2724 CloseHandle(shmidv);
2725 compt_resize++;
2726 sprintf(add_shmv, "Adress_shmv_%d_%d_%d_%d", proc_id, ispmd_glob, r2r_id, compt_resize);
2727 shmidv = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, new_tot_size * sizeof(int), add_shmv);
2728 shmv = MapViewOfFile(shmidv, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
2729#elif 1
2730 munmap(shmv, old_tot_size * sizeof(int));
2731 if (ftruncate(shmidv, new_tot_size * sizeof(int)) == -1) {
2732 perror("ftruncate");
2733 exit(1);
2734 }
2735 shmv = mmap(NULL, new_tot_size * sizeof(int), PROT_WRITE | PROT_READ, MAP_SHARED, shmidv, 0);
2736 if (shmv == MAP_FAILED) {
2737 perror("mmap");
2738 exit(1);
2739 }
2740#endif
2741
2742 shmvr_size = newsize;
2743 com->tagelr = shmv;
2744 com->tagels = shmv + shmvr_size;
2745}
2746
2747
2748//------------------------------------------------
2749void exch_tagel_c(int *ntagel, int *tagel, int *flag)
2750{
2751 int i;
2752
2753 if (((*ntagel) * 3 > shmvr_size) && (*flag == 1))
2754 realloc_shmvr_c((*ntagel) * 3);
2755 if (((*ntagel) * 3 > shmvs_size) && (*flag == 0))
2756 realloc_shmvs_c((*ntagel) * 3);
2757
2758 for (i = 0; i < (*ntagel) * 3; i++)
2759 {
2760 if (*flag == 0) /* *send* */
2761 {
2762 com->tagels[com->buf[2] + i] = tagel[i];
2763 }
2764 else if (*flag == 1) /* *receive* */
2765 {
2766 tagel[i] = com->tagelr[i];
2767 }
2768 }
2769
2770 if (*flag == 0)
2771 com->buf[2] += (*ntagel) * 3;
2772}
2773
2774void _FCALL EXCH_TAGEL_C(int *ntagel, int *tagel, int *flag){
2775 exch_tagel_c(ntagel,tagel,flag);
2776}
2777
2778void exch_tagel_c_(int *ntagel, int *tagel, int *flag){
2779 exch_tagel_c(ntagel,tagel,flag);
2780}
2781
2782void exch_tagel_c__(int *ntagel, int *tagel, int *flag){
2783 exch_tagel_c(ntagel,tagel,flag);
2784}
2785
2786//---------------------------------------------------------------
2787void get_shmbuf_c(int *val1, int *val2){
2788 *val1 = com->buf[*val2-1];
2789}
2790
2791void _FCALL GET_SHMBUF_C(int *val1, int *val2){
2792 get_shmbuf_c(val1,val2);
2793}
2794
2795void get_shmbuf_c_(int *val1, int *val2){
2796 get_shmbuf_c(val1,val2);
2797}
2798
2799void get_shmbuf_c__(int *val1, int *val2){
2800 get_shmbuf_c(val1,val2);
2801}
2802
2803
2804//---------------------------------------
2805void send_shmbuf_c(int *val1,int *val2){
2806 com->buf[*val2-1] = *val1;
2807}
2808
2809void _FCALL SEND_SHMBUF_C(int *val1,int *val2){
2810 send_shmbuf_c(val1,val2);}
2811
2812void send_shmbuf_c_(int *val1,int *val2){
2813 send_shmbuf_c(val1,val2);
2814}
2815
2816void send_shmbuf_c__(int *val1,int *val2){
2817 send_shmbuf_c(val1,val2);
2818}
2819
#define PIPE_BUF
Definition abfpipe.h:57
#define TRUE
Definition cblas_test.h:10
#define _FCALL
initmumps id
static int flag_siu
Definition rad2rad_c.c:129
void send_sock_mess_c(int *sd, char *mess, int *len)
Definition rad2rad_c.c:2517
static int r2r_id
Definition rad2rad_c.c:126
void init_link_c(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *info, int *typ, int *cdt, int *cdr, int *print, int *rddl, int *nlink, my_real_c *dx)
Definition rad2rad_c.c:451
static int nspmd
Definition rad2rad_c.c:126
void send_mass_kine_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *iex, int *offset)
Definition rad2rad_c.c:1960
void _FCALL CONNECTION_SOCK_INIT_C(int *sd)
Definition rad2rad_c.c:2191
void opensem_c(int *iroot, int *len, int *ispmd, int *nthr, int *ppid)
Definition rad2rad_c.c:246
void get_displ_c_(int *idp, int *nng, int *nodbuf, my_real_c *x)
Definition rad2rad_c.c:2020
void get_name_c__(char *name)
Definition rad2rad_c.c:2619
void send_sock_ibuf_c__(int *sd, int *ibuf, int *len)
Definition rad2rad_c.c:2458
void connection_sock_init_c(int *sd)
Definition rad2rad_c.c:2079
#define SERV_TCP_PORT1
Definition rad2rad_c.c:86
void r2r_unlock_threads__(int *nthr)
Definition rad2rad_c.c:400
void send_mass_rby_spmd_c__(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *buf3, my_real_c *buf4, my_real_c *buf5, int *iroddl)
Definition rad2rad_c.c:1247
void r2r_sem__()
Definition rad2rad_c.c:446
void openshm_c_()
Definition rad2rad_c.c:360
void send_sock_rbuf_c__(int *sd, my_real_c *rbuf, int *len)
Definition rad2rad_c.c:2485
void get_force_c(int *idp, int *nng, int *nodbuf, my_real_c *wf, my_real_c *wm, my_real_c *wf2, my_real_c *wm2, my_real_c *v, my_real_c *vr, my_real_c *fx, my_real_c *fr, my_real_c *ms, my_real_c *in, my_real_c *x, double *xdp, my_real_c *dx, int *typ, int *kin, int *wgt, int *iex, int *iresp, double *tfext)
Definition rad2rad_c.c:1738
void send_mass_nl_c__(int *idp, int *nng, int *iadd_nl, my_real_c *ms)
Definition rad2rad_c.c:1117
void exch_itag_c__(int *idp, int *nng, int *nodbuf, int *itag, int *itag2, int *iex, int *offset, int *flag)
Definition rad2rad_c.c:2663
void get_sock_rbuf_c(int *sd, my_real_c *rbuf, int *len)
Definition rad2rad_c.c:2491
static int ispmd_glob
Definition rad2rad_c.c:126
char root[ROOTLEN]
Definition rad2rad_c.c:124
void send_mass_rby_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *npby, int *nrbody, my_real_c *rby, int *tag, int *add_rby, int *nnpby, int *nrby)
Definition rad2rad_c.c:1175
static int nbufvar
Definition rad2rad_c.c:130
void _FCALL init_buf_spmd_c__(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *tlel, int *lel, int *lelnb, int *tleln, int *leln, int *nbelem, int *tcnel, int *cnelem2, int *wgt, int *tcneldb, int *cnelemdb, int *info, int *typ, int *nglob)
Definition rad2rad_c.c:848
void _FCALL OPENSHM_C()
Definition rad2rad_c.c:356
void get_fbuf_c__(my_real_c *fbuf, int *len)
Definition rad2rad_c.c:1007
void get_shmbuf_c(int *val1, int *val2)
Definition rad2rad_c.c:2787
static int i7flag
Definition rad2rad_c.c:129
void get_shmbuf_c_(int *val1, int *val2)
Definition rad2rad_c.c:2795
void get_ibuf_c_(int *ibuf, int *len)
Definition rad2rad_c.c:1039
void send_fbuf_c__(my_real_c *fbuf, int *len)
Definition rad2rad_c.c:970
void close_sock_c_(int *sd)
Definition rad2rad_c.c:2597
void mess_sock_c(int *sd)
Definition rad2rad_c.c:2354
void send_mass_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in)
Definition rad2rad_c.c:1085
void _FCALL SEND_IBUF_C(int *ibuf, int *len)
Definition rad2rad_c.c:944
void send_sock_c__(int *sd)
Definition rad2rad_c.c:2406
void r2r_block__()
Definition rad2rad_c.c:425
void _FCALL MESS_SOCK_C(int *sd)
Definition rad2rad_c.c:2370
void get_name_c(char *name)
Definition rad2rad_c.c:2607
void get_fbuf_c(my_real_c *fbuf, int *len)
Definition rad2rad_c.c:995
void _FCALL GET_STIFF_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *ir, my_real_c *stx, my_real_c *str, int *typ, int *npas, int *iex)
Definition rad2rad_c.c:1665
static int nthreads
Definition rad2rad_c.c:126
void send_shmbuf_c_(int *val1, int *val2)
Definition rad2rad_c.c:2812
void _FCALL GET_NAME_C(char *name)
Definition rad2rad_c.c:2611
static int proc_id
Definition rad2rad_c.c:126
void init_link_nl_c(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *print, my_real_c *dx, int *ndof_nl, int *nb_tot_dof, int *nlnk)
Definition rad2rad_c.c:646
void _FCALL GET_MASS_RBY_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, my_real_c *x, int *npby, int *nrbody, my_real_c *rby, int *nnpby, int *nrby)
Definition rad2rad_c.c:1330
void mess_sock_c_(int *sd)
Definition rad2rad_c.c:2373
void get_stiff_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *ir, my_real_c *stx, my_real_c *str, int *typ, int *npas, int *iex)
Definition rad2rad_c.c:1672
static int shmvs_size
Definition rad2rad_c.c:127
void _FCALL send_ibuf_c_(int *ibuf, int *len)
Definition rad2rad_c.c:948
void opensem_c__(int *iroot, int *len, int *ispmd, int *nthr, int *ppid)
Definition rad2rad_c.c:280
void get_mass_rby_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, my_real_c *x, int *npby, int *nrbody, my_real_c *rby, int *nnpby, int *nrby)
Definition rad2rad_c.c:1290
static int id_dom
Definition rad2rad_c.c:126
static my_real_c ms_buf[PIPE_BUF]
Definition rad2rad_c.c:138
void get_mass_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in)
Definition rad2rad_c.c:1253
void r2r_unlock_threads_c(int *nthr)
Definition rad2rad_c.c:369
void exch_tagel_c_(int *ntagel, int *tagel, int *flag)
Definition rad2rad_c.c:2778
void do_activ_c_(int *iflg)
Definition rad2rad_c.c:1950
void _FCALL SEND_DATA_NL_C(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *vx, my_real_c *ms, int *npas, int *iex)
Definition rad2rad_c.c:1546
void _FCALL SEND_SOCK_IBUF_C(int *sd, int *ibuf, int *len)
Definition rad2rad_c.c:2450
void get_displ_c(int *idp, int *nng, int *nodbuf, my_real_c *x)
Definition rad2rad_c.c:1992
void get_ibuf_c__(int *ibuf, int *len)
Definition rad2rad_c.c:1043
void _FCALL GET_FBUF_C(my_real_c *fbuf, int *len)
Definition rad2rad_c.c:999
void close_r2r_pipe_c__()
Definition rad2rad_c.c:2074
void send_data_c_(int *idp, int *nng, int *nodbuf, my_real_c *fx, my_real_c *fr, my_real_c *stx, my_real_c *str, my_real_c *vx, my_real_c *vr, my_real_c *ms, my_real_c *in, double *dx, my_real_c *x, int *typ, int *npas, my_real_c *rby, int *tag_rby, int *add_rby, int *rbylnk, int *kin, double *dr, my_real_c *dt2, int *iex, int *off_sph, int *numsph_glo, int *nrby)
Definition rad2rad_c.c:1491
void _FCALL DO_ACTIV_C(int *iflg)
Definition rad2rad_c.c:1946
static int * flagrot
Definition rad2rad_c.c:128
void check_dtnoda_c_(int *i7kglo)
Definition rad2rad_c.c:1398
void _FCALL GET_SOCK_IBUF_C(int *sd, int *ibuf, int *len)
Definition rad2rad_c.c:2423
void _FCALL init_link_c__(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *info, int *typ, int *cdt, int *cdr, int *print, int *rddl, int *nlink, my_real_c *dx)
Definition rad2rad_c.c:641
void send_mass_spmd_c(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *iroddl)
Definition rad2rad_c.c:1198
struct region * com2
Definition rad2rad_c.c:121
void get_sock_ibuf_c(int *sd, int *ibuf, int *len)
Definition rad2rad_c.c:2412
void close_r2r_pipe_c_()
Definition rad2rad_c.c:2072
void do_activ_c__(int *iflg)
Definition rad2rad_c.c:1954
void _FCALL OPENFIFO_C(int *iroot, int *len, int *fdw, int *fdr, int *sd, int *ispmd, int *nthr, int *ppid)
Definition rad2rad_c.c:233
void get_force_spmd_c__(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, int *typ, int *iex, int *nglob)
Definition rad2rad_c.c:1935
void get_displ_c__(int *idp, int *nng, int *nodbuf, my_real_c *x)
Definition rad2rad_c.c:2024
void openshm_c__()
Definition rad2rad_c.c:364
void _FCALL INIT_LINK_SPMD_C(int *igd, int *nng, int *dbnod, int *nbproc, int *ibuf, int *dbibuf, int *dbnbuf, int *ddbuf, my_real_c *rbuf, int *dim, int *ibufnb, int *ibufcnel, int *nbel, int *dimel, int *ibufel, int *ibufelnbnod, int *ibufelnod, int *dimb, int *ibufcneldb, int *ibufnbeldb, int *typ, int *bcs, int *print, int *rddl, int *nl, int *nlnk, int *iex)
Definition rad2rad_c.c:928
void _FCALL CLOSE_SOCK_C(int *sd)
Definition rad2rad_c.c:2593
void send_sock_rbuf_c_(int *sd, my_real_c *rbuf, int *len)
Definition rad2rad_c.c:2481
sem_t sem_int
Definition rad2rad_c.c:149
static my_real_c in_buf[PIPE_BUF]
Definition rad2rad_c.c:139
void get_force_nl_c__(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *ms, int *iex)
Definition rad2rad_c.c:1886
static void do_activ_c(int *iflg)
Definition rad2rad_c.c:1942
void realloc_shmvs_c(int newsize)
Definition rad2rad_c.c:2671
void send_mass_rby_spmd_c_(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *buf3, my_real_c *buf4, my_real_c *buf5, int *iroddl)
Definition rad2rad_c.c:1243
void get_displ_spmd_c__(int *idp, int *nng, my_real_c *bufr)
Definition rad2rad_c.c:2054
static my_real_c sr_buf[PIPE_BUF]
Definition rad2rad_c.c:134
void get_fbufdp_c_(double *fbuf, int *len)
Definition rad2rad_c.c:1021
void send_mass_rby_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *npby, int *nrbody, my_real_c *rby, int *tag, int *add_rby, int *nnpby, int *nrby)
Definition rad2rad_c.c:1171
void _FCALL init_link_c_(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *info, int *typ, int *cdt, int *cdr, int *print, int *rddl, int *nlink, my_real_c *dx)
Definition rad2rad_c.c:637
void send_sock_ibuf_c_(int *sd, int *ibuf, int *len)
Definition rad2rad_c.c:2454
static my_real_c in_rby_buf[3 *BUFSIZE]
Definition rad2rad_c.c:140
void get_displ_spmd_c_(int *idp, int *nng, my_real_c *bufr)
Definition rad2rad_c.c:2050
void _FCALL SEND_MASS_KINE_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *iex, int *offset)
Definition rad2rad_c.c:1978
void r2r_block_c()
Definition rad2rad_c.c:406
void mess_sock_c__(int *sd)
Definition rad2rad_c.c:2377
void exch_itag_c(int *idp, int *nng, int *nodbuf, int *itag, int *itag2, int *iex, int *offset, int *flag)
Definition rad2rad_c.c:2625
void r2r_unlock_threads_c_(int *nthr)
Definition rad2rad_c.c:396
void _FCALL GET_DISPL_C(int *idp, int *nng, int *nodbuf, my_real_c *x)
Definition rad2rad_c.c:2016
void get_sock_rbuf_c__(int *sd, my_real_c *rbuf, int *len)
Definition rad2rad_c.c:2511
void connection_sock_c_(int *ispmd, int *sd, char *addr)
Definition rad2rad_c.c:2344
void get_mass_rby_spmd_c(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, my_real_c *buf3, my_real_c *buf4)
Definition rad2rad_c.c:1364
void _FCALL init_buf_spmd_c_(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *tlel, int *lel, int *lelnb, int *tleln, int *leln, int *nbelem, int *tcnel, int *cnelem2, int *wgt, int *tcneldb, int *cnelemdb, int *info, int *typ, int *nglob)
Definition rad2rad_c.c:844
void get_force_c__(int *idp, int *nng, int *nodbuf, my_real_c *wf, my_real_c *wm, my_real_c *wf2, my_real_c *wm2, my_real_c *v, my_real_c *vr, my_real_c *fx, my_real_c *fr, my_real_c *ms, my_real_c *in, my_real_c *x, double *xdp, my_real_c *dx, int *typ, int *kin, int *wgt, int *iex, int *iresp, double *tfext)
Definition rad2rad_c.c:1845
void send_mass_spmd_c_(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *iroddl)
Definition rad2rad_c.c:1213
void openfifo_c_(int *iroot, int *len, int *fdw, int *fdr, int *sd, int *ispmd, int *nthr, int *ppid)
Definition rad2rad_c.c:237
void get_mass_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in)
Definition rad2rad_c.c:1284
static my_real_c sx_buf[PIPE_BUF]
Definition rad2rad_c.c:133
void check_dtnoda_c(int *i7kglo)
Definition rad2rad_c.c:1389
void _FCALL GET_MASS_SPMD_C(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2)
Definition rad2rad_c.c:1351
void close_sock_c__(int *sd)
Definition rad2rad_c.c:2601
static int off_link
Definition rad2rad_c.c:126
void _FCALL SEND_FBUFDP_C(double *fbuf, int *len)
Definition rad2rad_c.c:981
void _FCALL INIT_ACTIV_C(int *activ)
Definition rad2rad_c.c:1186
void openshm_c()
Definition rad2rad_c.c:284
void get_mass_rby_spmd_c_(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, my_real_c *buf3, my_real_c *buf4)
Definition rad2rad_c.c:1379
void _FCALL SEND_MASS_NL_C(int *idp, int *nng, int *iadd_nl, my_real_c *ms)
Definition rad2rad_c.c:1109
void _FCALL SEND_FBUF_C(my_real_c *fbuf, int *len)
Definition rad2rad_c.c:962
void get_stiff_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *ir, my_real_c *stx, my_real_c *str, int *typ, int *npas, int *iex)
Definition rad2rad_c.c:1632
void init_link_spmd_c(int *igd, int *nng, int *dbnod, int *nbproc, int *ibuf, int *dbibuf, int *dbnbuf, int *ddbuf, my_real_c *rbuf, int *dim, int *ibufnb, int *ibufcnel, int *nbel, int *dimel, int *ibufel, int *ibufelnbnod, int *ibufelnod, int *dimb, int *ibufcneldb, int *ibufnbeldb, int *typ, int *bcs, int *print, int *rddl, int *nl, int *nlnk, int *iex)
Definition rad2rad_c.c:853
void get_sock_ibuf_c_(int *sd, int *ibuf, int *len)
Definition rad2rad_c.c:2428
void connection_sock_init_c_(int *sd)
Definition rad2rad_c.c:2194
void send_sock_ibuf_c(int *sd, int *ibuf, int *len)
Definition rad2rad_c.c:2439
void r2r_sem_c_()
Definition rad2rad_c.c:442
void openfifo_c__(int *iroot, int *len, int *fdw, int *fdr, int *sd, int *ispmd, int *nthr, int *ppid)
Definition rad2rad_c.c:241
void send_fbufdp_c_(double *fbuf, int *len)
Definition rad2rad_c.c:985
void send_mass_spmd_c__(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *iroddl)
Definition rad2rad_c.c:1217
void _FCALL GET_MASS_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in)
Definition rad2rad_c.c:1276
struct region * com
Definition rad2rad_c.c:121
void send_sock_c_(int *sd)
Definition rad2rad_c.c:2402
void _FCALL INIT_LINK_C(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *info, int *typ, int *cdt, int *cdr, int *print, int *rddl, int *nlink, my_real_c *dx)
Definition rad2rad_c.c:633
void get_fbuf_c_(my_real_c *fbuf, int *len)
Definition rad2rad_c.c:1003
void r2r_sem_c()
Definition rad2rad_c.c:430
void _FCALL SEND_MASS_RBY_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *npby, int *nrbody, my_real_c *rby, int *tag, int *add_rby, int *nnpby, int *nrby)
Definition rad2rad_c.c:1167
void get_displ_spmd_c(int *idp, int *nng, my_real_c *bufr)
Definition rad2rad_c.c:2030
void get_sock_mess_c__(int *sd, char *mess, int *len)
Definition rad2rad_c.c:2565
#define my_max(a, b)
Definition rad2rad_c.c:97
static int iroddl
Definition rad2rad_c.c:126
void send_data_c(int *idp, int *nng, int *nodbuf, my_real_c *fx, my_real_c *fr, my_real_c *stx, my_real_c *str, my_real_c *vx, my_real_c *vr, my_real_c *ms, my_real_c *in, double *dx, my_real_c *x, int *typ, int *npas, my_real_c *rby, int *tag_rby, int *add_rby, int *rbylnk, int *kin, double *dr, my_real_c *dt2, int *iex, int *off_sph, int *numsph_glo, int *nrby)
Definition rad2rad_c.c:1411
void send_mass_kine_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *iex, int *offset)
Definition rad2rad_c.c:1982
void _FCALL GET_MASS_RBY_SPMD_C(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, my_real_c *buf3, my_real_c *buf4)
Definition rad2rad_c.c:1375
void get_stiff_spmd_c_(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, int *typ, int *npas, int *iex, int *nglob)
Definition rad2rad_c.c:1725
void _FCALL GET_STIFF_SPMD_C(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, int *typ, int *npas, int *iex, int *nglob)
Definition rad2rad_c.c:1719
void send_mass_kine_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *iex, int *offset)
Definition rad2rad_c.c:1986
#define send_type
Definition rad2rad_c.c:79
void get_stiff_spmd_c__(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, int *typ, int *npas, int *iex, int *nglob)
Definition rad2rad_c.c:1731
void send_sock_mess_c__(int *sd, char *mess, int *len)
Definition rad2rad_c.c:2538
void _FCALL GET_FBUFDP_C(double *fbuf, int *len)
Definition rad2rad_c.c:1017
void send_mass_rby_spmd_c(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *buf3, my_real_c *buf4, my_real_c *buf5, int *iroddl)
Definition rad2rad_c.c:1223
void _FCALL init_link_nl_c_(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *print, my_real_c *dx, int *ndof_nl, int *nb_tot_dof, int *nlnk)
Definition rad2rad_c.c:697
char fifo_1[NAMESIZE]
Definition rad2rad_c.c:123
void connection_sock_c__(int *ispmd, int *sd, char *addr)
Definition rad2rad_c.c:2348
void _FCALL R2R_BLOCK_C()
Definition rad2rad_c.c:417
void get_force_spmd_c(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, int *typ, int *iex, int *nglob)
Definition rad2rad_c.c:1892
static int fidw
Definition rad2rad_c.c:151
void _FCALL INIT_LINK_NL_C(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *print, my_real_c *dx, int *ndof_nl, int *nb_tot_dof, int *nlnk)
Definition rad2rad_c.c:693
void _FCALL CLOSE_R2R_PIPE_C()
Definition rad2rad_c.c:2070
void get_force_spmd_c_(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, int *typ, int *iex, int *nglob)
Definition rad2rad_c.c:1929
void _FCALL SEND_SHMBUF_C(int *val1, int *val2)
Definition rad2rad_c.c:2809
void _FCALL OPENSEM_C(int *iroot, int *len, int *ispmd, int *nthr, int *ppid)
Definition rad2rad_c.c:272
int shmidv
Definition rad2rad_c.c:150
void init_buf_spmd_c(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *tlel, int *lel, int *lelnb, int *tleln, int *leln, int *nbelem, int *tcnel, int *cnelem2, int *wgt, int *tcneldb, int *cnelemdb, int *info, int *typ, int *nglob)
Definition rad2rad_c.c:706
void send_sock_init_c__(int *iroot, int *len, int *ispmd, int *sd, int *maxproc, int *imach)
Definition rad2rad_c.c:2262
void get_fbufdp_c(double *fbuf, int *len)
Definition rad2rad_c.c:1013
static my_real_c vx_buf[BUFSIZE]
Definition rad2rad_c.c:135
void send_sock_rbuf_c(int *sd, my_real_c *rbuf, int *len)
Definition rad2rad_c.c:2464
void init_activ_c(int *activ)
Definition rad2rad_c.c:1181
void send_sock_c(int *sd)
Definition rad2rad_c.c:2383
void send_data_nl_c_(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *vx, my_real_c *ms, int *npas, int *iex)
Definition rad2rad_c.c:1550
void send_fbuf_c_(my_real_c *fbuf, int *len)
Definition rad2rad_c.c:966
void send_fbuf_c(my_real_c *fbuf, int *len)
Definition rad2rad_c.c:958
struct region * rptr
Definition rad2rad_c.c:121
void get_mass_spmd_c_(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2)
Definition rad2rad_c.c:1355
void close_sock_c(int *sd)
Definition rad2rad_c.c:2571
char semaphore_int[NAMESIZE]
Definition rad2rad_c.c:123
void _FCALL send_ibuf_c__(int *ibuf, int *len)
Definition rad2rad_c.c:952
void _FCALL SEND_DATA_C(int *idp, int *nng, int *nodbuf, my_real_c *fx, my_real_c *fr, my_real_c *stx, my_real_c *str, my_real_c *vx, my_real_c *vr, my_real_c *ms, my_real_c *in, double *dx, my_real_c *x, int *typ, int *npas, my_real_c *rby, int *tag_rby, int *add_rby, int *rbylnk, int *kin, double *dr, my_real_c *dt2, int *iex, int *off_sph, int *numsph_glo, int *nrby)
Definition rad2rad_c.c:1477
void connection_sock_init_c__(int *sd)
Definition rad2rad_c.c:2197
void get_sock_mess_c(int *sd, char *mess, int *len)
Definition rad2rad_c.c:2544
void _FCALL GET_DISPL_SPMD_C(int *idp, int *nng, my_real_c *bufr)
Definition rad2rad_c.c:2046
void get_fbufdp_c__(double *fbuf, int *len)
Definition rad2rad_c.c:1025
void _FCALL SEND_MASS_SPMD_C(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *iroddl)
Definition rad2rad_c.c:1209
void _FCALL GET_IBUF_C(int *ibuf, int *len)
Definition rad2rad_c.c:1035
void r2r_block_c_()
Definition rad2rad_c.c:421
void send_data_spmd_c__(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, my_real_c *bufr5, my_real_c *bufr6, double *bufr7, my_real_c *bufr8, my_real_c *bufr9, my_real_c *buf_rby, int *flg_rby, int *typ, int *npas, int *iex)
Definition rad2rad_c.c:1622
void _FCALL SEND_SOCK_RBUF_C(int *sd, my_real_c *rbuf, int *len)
Definition rad2rad_c.c:2477
void send_data_nl_c(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *vx, my_real_c *ms, int *npas, int *iex)
Definition rad2rad_c.c:1521
static int flg_sphinout
Definition rad2rad_c.c:129
void send_fbufdp_c__(double *fbuf, int *len)
Definition rad2rad_c.c:989
void send_mass_nl_c_(int *idp, int *nng, int *iadd_nl, my_real_c *ms)
Definition rad2rad_c.c:1113
void _FCALL CONNECTION_SOCK_C(int *ispmd, int *sd, char *addr)
Definition rad2rad_c.c:2340
void _FCALL SEND_DATA_SPMD_C(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, my_real_c *bufr5, my_real_c *bufr6, double *bufr7, my_real_c *bufr8, my_real_c *bufr9, my_real_c *buf_rby, int *flg_rby, int *typ, int *npas, int *iex)
Definition rad2rad_c.c:1606
void get_force_nl_c(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *ms, int *iex)
Definition rad2rad_c.c:1859
void _FCALL GET_FORCE_C(int *idp, int *nng, int *nodbuf, my_real_c *wf, my_real_c *wm, my_real_c *wf2, my_real_c *wm2, my_real_c *v, my_real_c *vr, my_real_c *fx, my_real_c *fr, my_real_c *ms, my_real_c *in, my_real_c *x, double *xdp, my_real_c *dx, int *typ, int *kin, int *wgt, int *iex, int *iresp, double *tfext)
Definition rad2rad_c.c:1822
static int compt_resize
Definition rad2rad_c.c:129
void exch_itag_c_(int *idp, int *nng, int *nodbuf, int *itag, int *itag2, int *iex, int *offset, int *flag)
Definition rad2rad_c.c:2657
void get_mass_spmd_c__(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2)
Definition rad2rad_c.c:1359
void _FCALL EXCH_ITAG_C(int *idp, int *nng, int *nodbuf, int *itag, int *itag2, int *iex, int *offset, int *flag)
Definition rad2rad_c.c:2651
void get_stiff_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *ir, my_real_c *stx, my_real_c *str, int *typ, int *npas, int *iex)
Definition rad2rad_c.c:1679
void send_mass_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in)
Definition rad2rad_c.c:1081
sem_t * sem_glob
Definition rad2rad_c.c:149
void _FCALL init_link_spmd_c_(int *igd, int *nng, int *dbnod, int *nbproc, int *ibuf, int *dbibuf, int *dbnbuf, int *ddbuf, my_real_c *rbuf, int *dim, int *ibufnb, int *ibufcnel, int *nbel, int *dimel, int *ibufel, int *ibufelnbnod, int *ibufelnod, int *dimb, int *ibufcneldb, int *ibufnbeldb, int *typ, int *bcs, int *print, int *rddl, int *nl, int *nlnk, int *iex)
Definition rad2rad_c.c:932
static void close_r2r_pipe_c()
Definition rad2rad_c.c:2060
void get_shmbuf_c__(int *val1, int *val2)
Definition rad2rad_c.c:2799
void exch_tagel_c(int *ntagel, int *tagel, int *flag)
Definition rad2rad_c.c:2749
void send_shmbuf_c__(int *val1, int *val2)
Definition rad2rad_c.c:2816
void get_mass_spmd_c(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2)
Definition rad2rad_c.c:1343
void send_sock_init_c(int *iroot, int *len, int *ispmd, int *sd, int *maxproc, int *imach)
Definition rad2rad_c.c:2202
static int fidr
Definition rad2rad_c.c:151
void get_sock_mess_c_(int *sd, char *mess, int *len)
Definition rad2rad_c.c:2561
void get_stiff_spmd_c(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, int *typ, int *npas, int *iex, int *nglob)
Definition rad2rad_c.c:1688
char fifo_2[NAMESIZE]
Definition rad2rad_c.c:123
void send_ibuf_c(int *ibuf, int *len)
Definition rad2rad_c.c:940
void get_sock_ibuf_c__(int *sd, int *ibuf, int *len)
Definition rad2rad_c.c:2433
void _FCALL SEND_MASS_C(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in)
Definition rad2rad_c.c:1077
static my_real_c fx_buf[BUFSIZE]
Definition rad2rad_c.c:131
void _FCALL SEND_SOCK_MESS_C(int *sd, char *mess, int *len)
Definition rad2rad_c.c:2530
void send_data_spmd_c(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, my_real_c *bufr5, my_real_c *bufr6, double *bufr7, my_real_c *bufr8, my_real_c *bufr9, my_real_c *buf_rby, int *flg_rby, int *typ, int *npas, int *iex)
Definition rad2rad_c.c:1560
void send_shmbuf_c(int *val1, int *val2)
Definition rad2rad_c.c:2805
struct region * rptw
Definition rad2rad_c.c:121
void send_sock_mess_c_(int *sd, char *mess, int *len)
Definition rad2rad_c.c:2534
void _FCALL GET_FORCE_NL_C(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *ms, int *iex)
Definition rad2rad_c.c:1878
static int shmvr_size
Definition rad2rad_c.c:127
void _FCALL R2R_SEM_C()
Definition rad2rad_c.c:438
void get_sock_rbuf_c_(int *sd, my_real_c *rbuf, int *len)
Definition rad2rad_c.c:2507
void _FCALL GET_SOCK_MESS_C(int *sd, char *mess, int *len)
Definition rad2rad_c.c:2557
void send_data_spmd_c_(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, my_real_c *bufr5, my_real_c *bufr6, double *bufr7, my_real_c *bufr8, my_real_c *bufr9, my_real_c *buf_rby, int *flg_rby, int *typ, int *npas, int *iex)
Definition rad2rad_c.c:1614
void init_activ_c__(int *activ)
Definition rad2rad_c.c:1194
#define NAMESIZE
Definition rad2rad_c.c:93
void realloc_shmvr_c(int newsize)
Definition rad2rad_c.c:2715
void _FCALL SEND_SOCK_C(int *sd)
Definition rad2rad_c.c:2399
void get_mass_rby_spmd_c__(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, my_real_c *buf3, my_real_c *buf4)
Definition rad2rad_c.c:1383
void _FCALL GET_SOCK_RBUF_C(int *sd, my_real_c *rbuf, int *len)
Definition rad2rad_c.c:2503
static my_real_c vr_buf[BUFSIZE]
Definition rad2rad_c.c:136
void _FCALL init_link_nl_c__(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *print, my_real_c *dx, int *ndof_nl, int *nb_tot_dof, int *nlnk)
Definition rad2rad_c.c:701
void opensem_c_(int *iroot, int *len, int *ispmd, int *nthr, int *ppid)
Definition rad2rad_c.c:276
void send_data_c__(int *idp, int *nng, int *nodbuf, my_real_c *fx, my_real_c *fr, my_real_c *stx, my_real_c *str, my_real_c *vx, my_real_c *vr, my_real_c *ms, my_real_c *in, double *dx, my_real_c *x, int *typ, int *npas, my_real_c *rby, int *tag_rby, int *add_rby, int *rbylnk, int *kin, double *dr, my_real_c *dt2, int *iex, int *off_sph, int *numsph_glo, int *nrby)
Definition rad2rad_c.c:1505
void get_ibuf_c(int *ibuf, int *len)
Definition rad2rad_c.c:1031
void _FCALL CHECK_DTNODA_C(int *i7kglo)
Definition rad2rad_c.c:1402
void _FCALL SEND_MASS_RBY_SPMD_C(int *idp, int *nng, my_real_c *buf1, my_real_c *buf2, int *buf3, my_real_c *buf4, my_real_c *buf5, int *iroddl)
Definition rad2rad_c.c:1239
#define ROOTLEN
Definition rad2rad_c.c:92
#define buftop
Definition rad2rad_c.c:95
static double dx_buf[4 *BUFSIZE]
Definition rad2rad_c.c:137
void send_data_nl_c__(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *vx, my_real_c *ms, int *npas, int *iex)
Definition rad2rad_c.c:1554
void send_mass_rby_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, int *npby, int *nrbody, my_real_c *rby, int *tag, int *add_rby, int *nnpby, int *nrby)
Definition rad2rad_c.c:1121
void get_mass_rby_c__(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, my_real_c *x, int *npby, int *nrbody, my_real_c *rby, int *nnpby, int *nrby)
Definition rad2rad_c.c:1337
void _FCALL GET_SHMBUF_C(int *val1, int *val2)
Definition rad2rad_c.c:2791
void _FCALL INIT_BUF_SPMD_C(int *igd, int *nng, int *itab, int *nodbuf, my_real_c *x, int *addcnel, int *cnel, int *ixc, int *ofc, int *tlel, int *lel, int *lelnb, int *tleln, int *leln, int *nbelem, int *tcnel, int *cnelem2, int *wgt, int *tcneldb, int *cnelemdb, int *info, int *typ, int *nglob)
Definition rad2rad_c.c:840
void send_fbufdp_c(double *fbuf, int *len)
Definition rad2rad_c.c:977
void _FCALL GET_FORCE_SPMD_C(int *idp, int *nng, my_real_c *bufr1, my_real_c *bufr2, my_real_c *bufr3, my_real_c *bufr4, int *typ, int *iex, int *nglob)
Definition rad2rad_c.c:1923
void check_dtnoda_c__(int *i7kglo)
Definition rad2rad_c.c:1406
void get_force_nl_c_(int *idp, int *nng, int *iadd_nl, my_real_c *fx, my_real_c *ms, int *iex)
Definition rad2rad_c.c:1882
#define BUFSIZE
Definition rad2rad_c.c:94
static int ** masterdb
Definition rad2rad_c.c:128
void exch_tagel_c__(int *ntagel, int *tagel, int *flag)
Definition rad2rad_c.c:2782
void _FCALL R2R_UNLOCK_THREADS_C(int *nthr)
Definition rad2rad_c.c:392
void _FCALL init_link_spmd_c__(int *igd, int *nng, int *dbnod, int *nbproc, int *ibuf, int *dbibuf, int *dbnbuf, int *ddbuf, my_real_c *rbuf, int *dim, int *ibufnb, int *ibufcnel, int *nbel, int *dimel, int *ibufel, int *ibufelnbnod, int *ibufelnod, int *dimb, int *ibufcneldb, int *ibufnbeldb, int *typ, int *bcs, int *print, int *rddl, int *nl, int *nlnk, int *iex)
Definition rad2rad_c.c:936
void send_mass_nl_c(int *idp, int *nng, int *iadd_nl, my_real_c *ms)
Definition rad2rad_c.c:1090
void init_activ_c_(int *activ)
Definition rad2rad_c.c:1190
char add_shmv[NAMESIZE]
Definition rad2rad_c.c:124
static int * shmv
Definition rad2rad_c.c:127
static my_real_c fr_buf[BUFSIZE]
Definition rad2rad_c.c:132
void send_sock_init_c_(int *iroot, int *len, int *ispmd, int *sd, int *maxproc, int *imach)
Definition rad2rad_c.c:2258
void _FCALL SEND_SOCK_INIT_C(int *iroot, int *len, int *ispmd, int *sd, int *maxproc, int *imach)
Definition rad2rad_c.c:2254
void connection_sock_c(int *ispmd, int *sd, char *addr)
Definition rad2rad_c.c:2268
void get_mass_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in)
Definition rad2rad_c.c:1280
void get_name_c_(char *name)
Definition rad2rad_c.c:2615
void send_mass_c(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in)
Definition rad2rad_c.c:1048
void get_mass_rby_c_(int *idp, int *nng, int *nodbuf, my_real_c *ms, my_real_c *in, my_real_c *x, int *npby, int *nrbody, my_real_c *rby, int *nnpby, int *nrby)
Definition rad2rad_c.c:1334
void get_force_c_(int *idp, int *nng, int *nodbuf, my_real_c *wf, my_real_c *wm, my_real_c *wf2, my_real_c *wm2, my_real_c *v, my_real_c *vr, my_real_c *fx, my_real_c *fr, my_real_c *ms, my_real_c *in, my_real_c *x, double *xdp, my_real_c *dx, int *typ, int *kin, int *wgt, int *iex, int *iresp, double *tfext)
Definition rad2rad_c.c:1833
void _FCALL EXCH_TAGEL_C(int *ntagel, int *tagel, int *flag)
Definition rad2rad_c.c:2774
void openfifo_c(int *iroot, int *len, int *fdw, int *fdr, int *sd, int *ispmd, int *nthr, int *ppid)
Definition rad2rad_c.c:158
int writer(int pipe, char *buf, int nbytes)
int readr(int pipe, char *buf, int nbytes)
Definition sys_pipes_c.c:86
*fortran !University of Stuttgart All rights reserved Inc All rights reserved ! $COPYRIGHT$ !Additional copyrights may follow ! $HEADER$ !WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING !Do ***not ***copy this file to the directory where your Fortran !fortran application is compiled unless it is absolutely necessary !Most !modern Fortran compilers now support the I command line flag
Definition mpif.h:26
character *2 function nl()
Definition message.F:2354
int * itagr2
Definition rad2rad_c.c:112
my_real_c * fr_buf
Definition rad2rad_c.c:101
my_real_c * mass_buf
Definition rad2rad_c.c:106
int * buf
Definition rad2rad_c.c:110
my_real_c * sx_buf
Definition rad2rad_c.c:102
int * itagr
Definition rad2rad_c.c:111
int * tagels
Definition rad2rad_c.c:116
my_real_c * iner_buf
Definition rad2rad_c.c:107
my_real_c * iner_rby_buf
Definition rad2rad_c.c:108
int * tagelr
Definition rad2rad_c.c:115
my_real_c * vr_buf
Definition rad2rad_c.c:105
int * iactv
Definition rad2rad_c.c:117
int * itags2
Definition rad2rad_c.c:114
double * dx_buf
Definition rad2rad_c.c:109
my_real_c * sr_buf
Definition rad2rad_c.c:103
my_real_c * fx_buf
Definition rad2rad_c.c:100
int * itags
Definition rad2rad_c.c:113
my_real_c * vx_buf
Definition rad2rad_c.c:104
void fatal(char *msg)
Definition sys_pipes_c.c:76
void syserr_fatal(char *msg)
Definition sys_pipes_c.c:69