1 |
#include <stdio.h> |
2 |
#include <stdlib.h> |
3 |
#include <string.h> |
4 |
#include <mpi.h> |
5 |
|
6 |
#include <mpiForceField.h> |
7 |
|
8 |
|
9 |
|
10 |
void sendFrcStruct( void *frcStruct, MPI_Datatype structType ){ |
11 |
|
12 |
int mpiError; |
13 |
|
14 |
mpiError = MPI_Bcast(frcStruct,1,structType,0,MPI_COMM_WORLD); |
15 |
if (mpiError != MPI_SUCCESS){ |
16 |
mpiError = MPI_Finalize(); |
17 |
if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
18 |
exit (0); |
19 |
} |
20 |
} |
21 |
|
22 |
|
23 |
void recieveFrcStruct( void *frcStruct, MPI_Datatype structType ){ |
24 |
|
25 |
int mpiError; |
26 |
|
27 |
mpiError = MPI_Bcast(frcStruct,1,structType,0,MPI_COMM_WORLD); |
28 |
if (mpiError != MPI_SUCCESS){ |
29 |
mpiError = MPI_Finalize(); |
30 |
if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
31 |
exit (0); |
32 |
} |
33 |
} |
34 |
|
35 |
void ffInterfaceExit( char* errMsg ){ |
36 |
|
37 |
int mpiError; |
38 |
int myNode; |
39 |
|
40 |
MPI_Comm_rank( MPI_COMM_WORLD, &myNode); |
41 |
|
42 |
if( errMsg != NULL ){ |
43 |
fprintf( stderr, |
44 |
"Force Field Parameter MPI error at node %d\n" |
45 |
" => %s\n", |
46 |
myNode, errMsg ); |
47 |
} |
48 |
|
49 |
mpiError = MPI_Finalize(); |
50 |
if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
51 |
exit (0); |
52 |
} |