guarantee consistency of halo IDs
This commit is contained in:
parent
66bf045b07
commit
75dbe87583
@ -495,7 +495,8 @@ void Domain::CommInit()
|
||||
recvData_YZ = new double [recvCount_YZ];
|
||||
recvData_XZ = new double [recvCount_XZ];
|
||||
//......................................................................................
|
||||
|
||||
// Guarantee consistency of ID labels in halo
|
||||
CommHaloIDs();
|
||||
}
|
||||
|
||||
void Domain::ReadIDs(){
|
||||
@ -659,6 +660,158 @@ void Domain::CommunicateMeshHalo(DoubleArray &Mesh)
|
||||
UnpackMeshData(recvList_YZ, recvCount_YZ ,recvData_YZ, MeshData);
|
||||
}
|
||||
|
||||
void Domain::PackID(int *list, int count, char *sendbuf, char *ID){
|
||||
// Fill in the phase ID values from neighboring processors
|
||||
// This packs up the values that need to be sent from one processor to another
|
||||
int idx,n;
|
||||
|
||||
for (idx=0; idx<count; idx++){
|
||||
n = list[idx];
|
||||
sendbuf[idx] = ID[n];
|
||||
}
|
||||
}
|
||||
//***************************************************************************************
|
||||
|
||||
void Domain::UnpackID(int *list, int count, char *recvbuf, char *ID){
|
||||
// Fill in the phase ID values from neighboring processors
|
||||
// This unpacks the values once they have been recieved from neighbors
|
||||
int idx,n;
|
||||
|
||||
for (idx=0; idx<count; idx++){
|
||||
n = list[idx];
|
||||
ID[n] = recvbuf[idx];
|
||||
}
|
||||
}
|
||||
|
||||
void Domain::CommHaloIDs(){
|
||||
// Ensure consistency for halo IDs
|
||||
char *sendID_x, *sendID_y, *sendID_z, *sendID_X, *sendID_Y, *sendID_Z;
|
||||
char *sendID_xy, *sendID_yz, *sendID_xz, *sendID_Xy, *sendID_Yz, *sendID_xZ;
|
||||
char *sendID_xY, *sendID_yZ, *sendID_Xz, *sendID_XY, *sendID_YZ, *sendID_XZ;
|
||||
char *recvID_x, *recvID_y, *recvID_z, *recvID_X, *recvID_Y, *recvID_Z;
|
||||
char *recvID_xy, *recvID_yz, *recvID_xz, *recvID_Xy, *recvID_Yz, *recvID_xZ;
|
||||
char *recvID_xY, *recvID_yZ, *recvID_Xz, *recvID_XY, *recvID_YZ, *recvID_XZ;
|
||||
// send buffers
|
||||
sendID_x = new char [sendCount_x];
|
||||
sendID_y = new char [sendCount_y];
|
||||
sendID_z = new char [sendCount_z];
|
||||
sendID_X = new char [sendCount_X];
|
||||
sendID_Y = new char [sendCount_Y];
|
||||
sendID_Z = new char [sendCount_Z];
|
||||
sendID_xy = new char [sendCount_xy];
|
||||
sendID_yz = new char [sendCount_yz];
|
||||
sendID_xz = new char [sendCount_xz];
|
||||
sendID_Xy = new char [sendCount_Xy];
|
||||
sendID_Yz = new char [sendCount_Yz];
|
||||
sendID_xZ = new char [sendCount_xZ];
|
||||
sendID_xY = new char [sendCount_xY];
|
||||
sendID_yZ = new char [sendCount_yZ];
|
||||
sendID_Xz = new char [sendCount_Xz];
|
||||
sendID_XY = new char [sendCount_XY];
|
||||
sendID_YZ = new char [sendCount_YZ];
|
||||
sendID_XZ = new char [sendCount_XZ];
|
||||
//......................................................................................
|
||||
// recv buffers
|
||||
recvID_x = new char [recvCount_x];
|
||||
recvID_y = new char [recvCount_y];
|
||||
recvID_z = new char [recvCount_z];
|
||||
recvID_X = new char [recvCount_X];
|
||||
recvID_Y = new char [recvCount_Y];
|
||||
recvID_Z = new char [recvCount_Z];
|
||||
recvID_xy = new char [recvCount_xy];
|
||||
recvID_yz = new char [recvCount_yz];
|
||||
recvID_xz = new char [recvCount_xz];
|
||||
recvID_Xy = new char [recvCount_Xy];
|
||||
recvID_xZ = new char [recvCount_xZ];
|
||||
recvID_xY = new char [recvCount_xY];
|
||||
recvID_yZ = new char [recvCount_yZ];
|
||||
recvID_Yz = new char [recvCount_Yz];
|
||||
recvID_Xz = new char [recvCount_Xz];
|
||||
recvID_XY = new char [recvCount_XY];
|
||||
recvID_YZ = new char [recvCount_YZ];
|
||||
recvID_XZ = new char [recvCount_XZ];
|
||||
//......................................................................................
|
||||
int sendtag,recvtag;
|
||||
sendtag = recvtag = 7;
|
||||
|
||||
// Pack and send the updated ID values
|
||||
PackID(sendList_x, sendCount_x ,sendID_x, id);
|
||||
PackID(sendList_X, sendCount_X ,sendID_X, id);
|
||||
PackID(sendList_y, sendCount_y ,sendID_y, id);
|
||||
PackID(sendList_Y, sendCount_Y ,sendID_Y, id);
|
||||
PackID(sendList_z, sendCount_z ,sendID_z, id);
|
||||
PackID(sendList_Z, sendCount_Z ,sendID_Z, id);
|
||||
PackID(sendList_xy, sendCount_xy ,sendID_xy, id);
|
||||
PackID(sendList_Xy, sendCount_Xy ,sendID_Xy, id);
|
||||
PackID(sendList_xY, sendCount_xY ,sendID_xY, id);
|
||||
PackID(sendList_XY, sendCount_XY ,sendID_XY, id);
|
||||
PackID(sendList_xz, sendCount_xz ,sendID_xz, id);
|
||||
PackID(sendList_Xz, sendCount_Xz ,sendID_Xz, id);
|
||||
PackID(sendList_xZ, sendCount_xZ ,sendID_xZ, id);
|
||||
PackID(sendList_XZ, sendCount_XZ ,sendID_XZ, id);
|
||||
PackID(sendList_yz, sendCount_yz ,sendID_yz, id);
|
||||
PackID(sendList_Yz, sendCount_Yz ,sendID_Yz, id);
|
||||
PackID(sendList_yZ, sendCount_yZ ,sendID_yZ, id);
|
||||
PackID(sendList_YZ, sendCount_YZ ,sendID_YZ, id);
|
||||
//......................................................................................
|
||||
MPI_Sendrecv(sendID_x,sendCount_x,MPI_CHAR,rank_x(),sendtag,
|
||||
recvID_X,recvCount_X,MPI_CHAR,rank_X(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_X,sendCount_X,MPI_CHAR,rank_X(),sendtag,
|
||||
recvID_x,recvCount_x,MPI_CHAR,rank_x(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_y,sendCount_y,MPI_CHAR,rank_y(),sendtag,
|
||||
recvID_Y,recvCount_Y,MPI_CHAR,rank_Y(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_Y,sendCount_Y,MPI_CHAR,rank_Y(),sendtag,
|
||||
recvID_y,recvCount_y,MPI_CHAR,rank_y(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_z,sendCount_z,MPI_CHAR,rank_z(),sendtag,
|
||||
recvID_Z,recvCount_Z,MPI_CHAR,rank_Z(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_Z,sendCount_Z,MPI_CHAR,rank_Z(),sendtag,
|
||||
recvID_z,recvCount_z,MPI_CHAR,rank_z(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_xy,sendCount_xy,MPI_CHAR,rank_xy(),sendtag,
|
||||
recvID_XY,recvCount_XY,MPI_CHAR,rank_XY(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_XY,sendCount_XY,MPI_CHAR,rank_XY(),sendtag,
|
||||
recvID_xy,recvCount_xy,MPI_CHAR,rank_xy(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_Xy,sendCount_Xy,MPI_CHAR,rank_Xy(),sendtag,
|
||||
recvID_xY,recvCount_xY,MPI_CHAR,rank_xY(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_xY,sendCount_xY,MPI_CHAR,rank_xY(),sendtag,
|
||||
recvID_Xy,recvCount_Xy,MPI_CHAR,rank_Xy(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_xz,sendCount_xz,MPI_CHAR,rank_xz(),sendtag,
|
||||
recvID_XZ,recvCount_XZ,MPI_CHAR,rank_XZ(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_XZ,sendCount_XZ,MPI_CHAR,rank_XZ(),sendtag,
|
||||
recvID_xz,recvCount_xz,MPI_CHAR,rank_xz(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_Xz,sendCount_Xz,MPI_CHAR,rank_Xz(),sendtag,
|
||||
recvID_xZ,recvCount_xZ,MPI_CHAR,rank_xZ(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_xZ,sendCount_xZ,MPI_CHAR,rank_xZ(),sendtag,
|
||||
recvID_Xz,recvCount_Xz,MPI_CHAR,rank_Xz(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_yz,sendCount_yz,MPI_CHAR,rank_yz(),sendtag,
|
||||
recvID_YZ,recvCount_YZ,MPI_CHAR,rank_YZ(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_YZ,sendCount_YZ,MPI_CHAR,rank_YZ(),sendtag,
|
||||
recvID_yz,recvCount_yz,MPI_CHAR,rank_yz(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_Yz,sendCount_Yz,MPI_CHAR,rank_Yz(),sendtag,
|
||||
recvID_yZ,recvCount_yZ,MPI_CHAR,rank_yZ(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_yZ,sendCount_yZ,MPI_CHAR,rank_yZ(),sendtag,
|
||||
recvID_Yz,recvCount_Yz,MPI_CHAR,rank_Yz(),recvtag,comm,MPI_STATUS_IGNORE);
|
||||
//......................................................................................
|
||||
UnpackID(recvList_x, recvCount_x ,recvID_x, id);
|
||||
UnpackID(recvList_X, recvCount_X ,recvID_X, id);
|
||||
UnpackID(recvList_y, recvCount_y ,recvID_y, id);
|
||||
UnpackID(recvList_Y, recvCount_Y ,recvID_Y, id);
|
||||
UnpackID(recvList_z, recvCount_z ,recvID_z, id);
|
||||
UnpackID(recvList_Z, recvCount_Z ,recvID_Z, id);
|
||||
UnpackID(recvList_xy, recvCount_xy ,recvID_xy, id);
|
||||
UnpackID(recvList_Xy, recvCount_Xy ,recvID_Xy, id);
|
||||
UnpackID(recvList_xY, recvCount_xY ,recvID_xY, id);
|
||||
UnpackID(recvList_XY, recvCount_XY ,recvID_XY, id);
|
||||
UnpackID(recvList_xz, recvCount_xz ,recvID_xz, id);
|
||||
UnpackID(recvList_Xz, recvCount_Xz ,recvID_Xz, id);
|
||||
UnpackID(recvList_xZ, recvCount_xZ ,recvID_xZ, id);
|
||||
UnpackID(recvList_XZ, recvCount_XZ ,recvID_XZ, id);
|
||||
UnpackID(recvList_yz, recvCount_yz ,recvID_yz, id);
|
||||
UnpackID(recvList_Yz, recvCount_Yz ,recvID_Yz, id);
|
||||
UnpackID(recvList_yZ, recvCount_yZ ,recvID_yZ, id);
|
||||
UnpackID(recvList_YZ, recvCount_YZ ,recvID_YZ, id);
|
||||
//......................................................................................
|
||||
}
|
||||
|
||||
// Ideally stuff below here should be moved somewhere else -- doesn't really belong here
|
||||
void WriteCheckpoint(const char *FILENAME, const double *cDen, const double *cfq, int Np)
|
||||
{
|
||||
|
@ -176,6 +176,11 @@ public: // Public variables (need to create accessors instead)
|
||||
int PoreCount();
|
||||
|
||||
private:
|
||||
|
||||
void PackID(int *list, int count, char *sendbuf, char *ID);
|
||||
void UnpackID(int *list, int count, char *recvbuf, char *ID);
|
||||
void CommHaloIDs();
|
||||
|
||||
//......................................................................................
|
||||
MPI_Request req1[18], req2[18];
|
||||
MPI_Status stat1[18],stat2[18];
|
||||
@ -197,7 +202,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Class to hold data on a patch
|
||||
template<class TYPE>
|
||||
class PatchData {
|
||||
@ -229,6 +233,7 @@ private:
|
||||
const Patch *d_patch;
|
||||
TYPE *d_data;
|
||||
TYPE *d_gcw;
|
||||
|
||||
};
|
||||
|
||||
void WriteCheckpoint(const char *FILENAME, const double *cDen, const double *cfq, int Np);
|
||||
|
Loading…
Reference in New Issue
Block a user