ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/mpi_implementation/mpiForceField.c
Revision: 150
Committed: Fri Oct 18 21:20:29 2002 UTC (22 years, 6 months ago) by mmeineke
Content type: text/plain
File size: 1102 byte(s)
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 chuckv 142 #include <stdio.h>
2     #include <stdlib.h>
3 mmeineke 150 #include <string.h>
4 chuckv 142 #include <mpi.h>
5    
6     #include <mpiForceField.h>
7 mmeineke 150
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     }