/********************************************************
%
% Written by:
% --
% John L. Weatherwax 2006-05-31
%
% email: wax@alum.mit.edu
%
% Please send comments and especially bug reports to the
% above email address.
%
%-----
This stores processor specific information about the global grid in which
it is operating.
*/
/* The maximum number of bodies to simulate (per processor) */
#define MAX_N_BODIES 1000000
/* The number of mesh points in both X and Y (per processor) for charge to mesh interpolation ...
currently not implemented ... */
#define NUMB_MESH_X 100
#define NUMB_MESH_Y 100
struct PROC_INFO
{
/* Processor independent information ... is the SAME in each processor */
int NP; /* the total number of processors */
int Ms,Ns; /* the number of processors composing the ROWs and COLUMNs of the virtual grid */
double bx,by; /* the spatial dimensions covered by each processor ... the box dimensions */
int Nb; /* the total number of bodies/particles to simulate */
/* Processor specific information ... is different depending on the processor */
int my_rank,my_row,my_col; /* rank/row/column in global virtual grid */
int my_Rdiag,my_Ldiag; /* corresponding right/left diagonal this processor falls on ... needed for message passing along diagonal */
double my_cx,my_cy; /* spatial location of the virtual center of the box */
double my_lx,my_ly; /* spatial location of the lower left corner of the box */
double my_ux,my_uy; /* spatial location of the upper right corner of the box */
int isFaceExternal[4]; /* do the North=0, East=1, South=2, and West=3 faces of this processor border the GLOBAL domain */
/* The following hold coordinates (x & y) representing the 4 corners of a physical box,
which denotes the region of space this processor should "oversee" all particles in.
This includes regions outside the 80 Angstrom initial particle confinement if necessary.
Also by convention, a processor will oversee any particles that fall ON its
left (East) or bottom (South) face.
*/
double gdNW[2],gdNE[2],gdSE[2],gdSW[2];
/* a processor specific filename ... for output */
char pFilename[150];
/* The particle data structures:
NbPP is the number of bodies (particles) held by THIS processor
p is the position of each body,
v is the velocity of each body, and
f is the force applied to each body
Note: rather than sort out how MPI passes C - structs I'll just
declare each component of the variables of interest in its {\em own} array.
*/
int NbPP;
double px[MAX_N_BODIES],py[MAX_N_BODIES]; /* positions */
double vx[MAX_N_BODIES],vy[MAX_N_BODIES]; /* velocities */
double fx[MAX_N_BODIES],fy[MAX_N_BODIES]; /* forces */
double m[MAX_N_BODIES]; /* masses */
/* the neighbors of this processor in the periodic processor grid ...
used for the required addressing of message passing of the particles during import */
int neighbor[9];
/* a data structure used in computing which particles will be exported (and to where)
during the import/export step of the Midpoint algorithm:
1=yes=>this particle is exported to the corresponding neighbor
0=no=>this particle is not exported to the corresponding neighbor */
int pExportQ[MAX_N_BODIES][9];
/* Storage required for the MPI_Send/MPI_Recv when we pass particles from processor to processor
*/
/* the NUMBER of particles that will be EXPORTED to each of my NEIGHBORS */
int numToExport[9]; /*={0,0,0,0,-1,0,0,0,0};*/
/* the particles DATA that will be EXPORTED to each of my NEIGHBORS */
double *partDataToExport[9]; /*={0,0,0,0,0,0,0,0,0};*/
/* the NUMBER of particles that will be RECEIVED from each of my NEIGHBORS */
int numToReceive[9]; /*={0,0,0,0,-1,0,0,0,0};*/
/* the particles DATA that will be RECEIVED from each of my NEIGHBORS */
double *partDataToReceive[9]; /*={0,0,0,0,0,0,0,0,0};*/
/* the ACCUMULATED forces on the imported particles W.R.T. the particles in this home box */
double *forcesOnReceivedPart[9]; /* forces ON the particles received FROM the given neighbor */
double *forcesOnExportedPart[9]; /* forces exported back to their corresponding neighbors */
/* a data structure used in computing which particles will be evicted (and to where)
after position update within each home box
1=yes=>this particle is evicted to the corresponding neighbor
0=no=>this particle is not evicted to the corresponding neighbor */
int pEvictQ[MAX_N_BODIES][9];
/* Storage required for the MPI_Send/MPI_Recv when we pass particles from processor to processor
*/
/* the NUMBER of particles that will be EVICTED to each of my NEIGHBORS */
int numToEvict[9];
/* the particles DATA that will be EVICTED to each of my NEIGHBORS */
double *partDataToEvict[9];
/* the NUMBER of particles (Refugees) that will be RECEIVED from each of my NEIGHBORS ... due to EVICTION */
int numRefugeeToReceive[9];
/* the particles DATA that will be RECEIVED from each of my NEIGHBORS ... do to EVICTION */
double *partRefugeeDataToReceive[9];
/* the underlying mesh used for charge assignment and force extrapolation
How does the mesh grid lines overlap with box boundaries??? ... not implemented ... */
/*double meshCharge[NUMB_MESH_X,NUMB_MESH_Y];*/
};
typedef struct PROC_INFO proc_info;
extern proc_info procInfo;
/* some auxilliary constants representing the neighbors (for convienience) */
enum NEIGHBORS { NW=0, N=1, NE=2, W=3, I=4, E=5, SW=6, S=7, SE=8 };