Multi-lable bug fixed in CommInit
This commit is contained in:
1 parent
ce9717e29d
commit
2332188d17
1 file changed
+1
-215
+1
-215
@@ -495,8 +495,7 @@ 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(){
|
||||
@@ -660,219 +659,6 @@ 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;
|
||||
//......................................................................................
|
||||
int sendCountID_x, sendCountID_y, sendCountID_z, sendCountID_X, sendCountID_Y, sendCountID_Z;
|
||||
int sendCountID_xy, sendCountID_yz, sendCountID_xz, sendCountID_Xy, sendCountID_Yz, sendCountID_xZ;
|
||||
int sendCountID_xY, sendCountID_yZ, sendCountID_Xz, sendCountID_XY, sendCountID_YZ, sendCountID_XZ;
|
||||
//......................................................................................
|
||||
int recvCountID_x, recvCountID_y, recvCountID_z, recvCountID_X, recvCountID_Y, recvCountID_Z;
|
||||
int recvCountID_xy, recvCountID_yz, recvCountID_xz, recvCountID_Xy, recvCountID_Yz, recvCountID_xZ;
|
||||
int recvCountID_xY, recvCountID_yZ, recvCountID_Xz, recvCountID_XY, recvCountID_YZ, recvCountID_XZ;
|
||||
//......................................................................................
|
||||
//......................................................................................
|
||||
sendCountID_x = sendCountID_y = sendCountID_z = sendCountID_X = sendCountID_Y = sendCountID_Z = 0;
|
||||
sendCountID_xy = sendCountID_yz = sendCountID_xz = sendCountID_Xy = sendCountID_Yz = sendCountID_xZ = 0;
|
||||
sendCountID_xY = sendCountID_yZ = sendCountID_Xz = sendCountID_XY = sendCountID_YZ = sendCountID_XZ = 0;
|
||||
//......................................................................................
|
||||
for (int k=1; k<Nz-1; k++){
|
||||
for (int j=1; j<Ny-1; j++){
|
||||
for (int i=1; i<Nx-1; i++){
|
||||
// Check the phase ID
|
||||
// CountIDs for the six faces
|
||||
if (i==1) sendCountID_x++;
|
||||
if (j==1) sendCountID_y++;
|
||||
if (k==1) sendCountID_z++;
|
||||
if (i==Nx-2) sendCountID_X++;
|
||||
if (j==Ny-2) sendCountID_Y++;
|
||||
if (k==Nz-2) sendCountID_Z++;
|
||||
// CountIDs for the twelve edges
|
||||
if (i==1 && j==1) sendCountID_xy++;
|
||||
if (i==1 && j==Ny-2) sendCountID_xY++;
|
||||
if (i==Nx-2 && j==1) sendCountID_Xy++;
|
||||
if (i==Nx-2 && j==Ny-2) sendCountID_XY++;
|
||||
|
||||
if (i==1 && k==1) sendCountID_xz++;
|
||||
if (i==1 && k==Nz-2) sendCountID_xZ++;
|
||||
if (i==Nx-2 && k==1) sendCountID_Xz++;
|
||||
if (i==Nx-2 && k==Nz-2) sendCountID_XZ++;
|
||||
|
||||
if (j==1 && k==1) sendCountID_yz++;
|
||||
if (j==1 && k==Nz-2) sendCountID_yZ++;
|
||||
if (j==Ny-2 && k==1) sendCountID_Yz++;
|
||||
if (j==Ny-2 && k==Nz-2) sendCountID_YZ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
recvCountID_x = sendCountID_x;
|
||||
recvCountID_X = sendCountID_X;
|
||||
recvCountID_y = sendCountID_y;
|
||||
recvCountID_Y = sendCountID_Y;
|
||||
recvCountID_z = sendCountID_z;
|
||||
recvCountID_Z = sendCountID_Z;
|
||||
recvCountID_xy = sendCountID_xy;
|
||||
recvCountID_xY = sendCountID_xY;
|
||||
recvCountID_Xy = sendCountID_Xy;
|
||||
recvCountID_XY = sendCountID_XY;
|
||||
recvCountID_xz = sendCountID_xz;
|
||||
recvCountID_xZ = sendCountID_xZ;
|
||||
recvCountID_Xz = sendCountID_Xz;
|
||||
recvCountID_XZ = sendCountID_XZ;
|
||||
recvCountID_yz = sendCountID_yz;
|
||||
recvCountID_yZ = sendCountID_yZ;
|
||||
recvCountID_Yz = sendCountID_Yz;
|
||||
recvCountID_YZ = sendCountID_YZ;
|
||||
// send buffers
|
||||
sendID_x = new char [sendCountID_x];
|
||||
sendID_y = new char [sendCountID_y];
|
||||
sendID_z = new char [sendCountID_z];
|
||||
sendID_X = new char [sendCountID_X];
|
||||
sendID_Y = new char [sendCountID_Y];
|
||||
sendID_Z = new char [sendCountID_Z];
|
||||
sendID_xy = new char [sendCountID_xy];
|
||||
sendID_yz = new char [sendCountID_yz];
|
||||
sendID_xz = new char [sendCountID_xz];
|
||||
sendID_Xy = new char [sendCountID_Xy];
|
||||
sendID_Yz = new char [sendCountID_Yz];
|
||||
sendID_xZ = new char [sendCountID_xZ];
|
||||
sendID_xY = new char [sendCountID_xY];
|
||||
sendID_yZ = new char [sendCountID_yZ];
|
||||
sendID_Xz = new char [sendCountID_Xz];
|
||||
sendID_XY = new char [sendCountID_XY];
|
||||
sendID_YZ = new char [sendCountID_YZ];
|
||||
sendID_XZ = new char [sendCountID_XZ];
|
||||
//......................................................................................
|
||||
// recv buffers
|
||||
recvID_x = new char [recvCountID_x];
|
||||
recvID_y = new char [recvCountID_y];
|
||||
recvID_z = new char [recvCountID_z];
|
||||
recvID_X = new char [recvCountID_X];
|
||||
recvID_Y = new char [recvCountID_Y];
|
||||
recvID_Z = new char [recvCountID_Z];
|
||||
recvID_xy = new char [recvCountID_xy];
|
||||
recvID_yz = new char [recvCountID_yz];
|
||||
recvID_xz = new char [recvCountID_xz];
|
||||
recvID_Xy = new char [recvCountID_Xy];
|
||||
recvID_xZ = new char [recvCountID_xZ];
|
||||
recvID_xY = new char [recvCountID_xY];
|
||||
recvID_yZ = new char [recvCountID_yZ];
|
||||
recvID_Yz = new char [recvCountID_Yz];
|
||||
recvID_Xz = new char [recvCountID_Xz];
|
||||
recvID_XY = new char [recvCountID_XY];
|
||||
recvID_YZ = new char [recvCountID_YZ];
|
||||
recvID_XZ = new char [recvCountID_XZ];
|
||||
//......................................................................................
|
||||
int sendtag,recvtag;
|
||||
sendtag = recvtag = 7;
|
||||
|
||||
// Pack and send the updated ID values
|
||||
PackID(sendList_x, sendCountID_x ,sendID_x, id);
|
||||
PackID(sendList_X, sendCountID_X ,sendID_X, id);
|
||||
PackID(sendList_y, sendCountID_y ,sendID_y, id);
|
||||
PackID(sendList_Y, sendCountID_Y ,sendID_Y, id);
|
||||
PackID(sendList_z, sendCountID_z ,sendID_z, id);
|
||||
PackID(sendList_Z, sendCountID_Z ,sendID_Z, id);
|
||||
PackID(sendList_xy, sendCountID_xy ,sendID_xy, id);
|
||||
PackID(sendList_Xy, sendCountID_Xy ,sendID_Xy, id);
|
||||
PackID(sendList_xY, sendCountID_xY ,sendID_xY, id);
|
||||
PackID(sendList_XY, sendCountID_XY ,sendID_XY, id);
|
||||
PackID(sendList_xz, sendCountID_xz ,sendID_xz, id);
|
||||
PackID(sendList_Xz, sendCountID_Xz ,sendID_Xz, id);
|
||||
PackID(sendList_xZ, sendCountID_xZ ,sendID_xZ, id);
|
||||
PackID(sendList_XZ, sendCountID_XZ ,sendID_XZ, id);
|
||||
PackID(sendList_yz, sendCountID_yz ,sendID_yz, id);
|
||||
PackID(sendList_Yz, sendCountID_Yz ,sendID_Yz, id);
|
||||
PackID(sendList_yZ, sendCountID_yZ ,sendID_yZ, id);
|
||||
PackID(sendList_YZ, sendCountID_YZ ,sendID_YZ, id);
|
||||
//......................................................................................
|
||||
MPI_Sendrecv(sendID_x,sendCountID_x,MPI_CHAR,rank_x(),sendtag,
|
||||
recvID_X,recvCountID_X,MPI_CHAR,rank_X(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_X,sendCountID_X,MPI_CHAR,rank_X(),sendtag,
|
||||
recvID_x,recvCountID_x,MPI_CHAR,rank_x(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_y,sendCountID_y,MPI_CHAR,rank_y(),sendtag,
|
||||
recvID_Y,recvCountID_Y,MPI_CHAR,rank_Y(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_Y,sendCountID_Y,MPI_CHAR,rank_Y(),sendtag,
|
||||
recvID_y,recvCountID_y,MPI_CHAR,rank_y(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_z,sendCountID_z,MPI_CHAR,rank_z(),sendtag,
|
||||
recvID_Z,recvCountID_Z,MPI_CHAR,rank_Z(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_Z,sendCountID_Z,MPI_CHAR,rank_Z(),sendtag,
|
||||
recvID_z,recvCountID_z,MPI_CHAR,rank_z(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_xy,sendCountID_xy,MPI_CHAR,rank_xy(),sendtag,
|
||||
recvID_XY,recvCountID_XY,MPI_CHAR,rank_XY(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_XY,sendCountID_XY,MPI_CHAR,rank_XY(),sendtag,
|
||||
recvID_xy,recvCountID_xy,MPI_CHAR,rank_xy(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_Xy,sendCountID_Xy,MPI_CHAR,rank_Xy(),sendtag,
|
||||
recvID_xY,recvCountID_xY,MPI_CHAR,rank_xY(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_xY,sendCountID_xY,MPI_CHAR,rank_xY(),sendtag,
|
||||
recvID_Xy,recvCountID_Xy,MPI_CHAR,rank_Xy(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_xz,sendCountID_xz,MPI_CHAR,rank_xz(),sendtag,
|
||||
recvID_XZ,recvCountID_XZ,MPI_CHAR,rank_XZ(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_XZ,sendCountID_XZ,MPI_CHAR,rank_XZ(),sendtag,
|
||||
recvID_xz,recvCountID_xz,MPI_CHAR,rank_xz(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_Xz,sendCountID_Xz,MPI_CHAR,rank_Xz(),sendtag,
|
||||
recvID_xZ,recvCountID_xZ,MPI_CHAR,rank_xZ(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_xZ,sendCountID_xZ,MPI_CHAR,rank_xZ(),sendtag,
|
||||
recvID_Xz,recvCountID_Xz,MPI_CHAR,rank_Xz(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_yz,sendCountID_yz,MPI_CHAR,rank_yz(),sendtag,
|
||||
recvID_YZ,recvCountID_YZ,MPI_CHAR,rank_YZ(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_YZ,sendCountID_YZ,MPI_CHAR,rank_YZ(),sendtag,
|
||||
recvID_yz,recvCountID_yz,MPI_CHAR,rank_yz(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_Yz,sendCountID_Yz,MPI_CHAR,rank_Yz(),sendtag,
|
||||
recvID_yZ,recvCountID_yZ,MPI_CHAR,rank_yZ(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv(sendID_yZ,sendCountID_yZ,MPI_CHAR,rank_yZ(),sendtag,
|
||||
recvID_Yz,recvCountID_Yz,MPI_CHAR,rank_Yz(),recvtag,Comm,MPI_STATUS_IGNORE);
|
||||
//......................................................................................
|
||||
UnpackID(recvList_x, recvCountID_x ,recvID_x, id);
|
||||
UnpackID(recvList_X, recvCountID_X ,recvID_X, id);
|
||||
UnpackID(recvList_y, recvCountID_y ,recvID_y, id);
|
||||
UnpackID(recvList_Y, recvCountID_Y ,recvID_Y, id);
|
||||
UnpackID(recvList_z, recvCountID_z ,recvID_z, id);
|
||||
UnpackID(recvList_Z, recvCountID_Z ,recvID_Z, id);
|
||||
UnpackID(recvList_xy, recvCountID_xy ,recvID_xy, id);
|
||||
UnpackID(recvList_Xy, recvCountID_Xy ,recvID_Xy, id);
|
||||
UnpackID(recvList_xY, recvCountID_xY ,recvID_xY, id);
|
||||
UnpackID(recvList_XY, recvCountID_XY ,recvID_XY, id);
|
||||
UnpackID(recvList_xz, recvCountID_xz ,recvID_xz, id);
|
||||
UnpackID(recvList_Xz, recvCountID_Xz ,recvID_Xz, id);
|
||||
UnpackID(recvList_xZ, recvCountID_xZ ,recvID_xZ, id);
|
||||
UnpackID(recvList_XZ, recvCountID_XZ ,recvID_XZ, id);
|
||||
UnpackID(recvList_yz, recvCountID_yz ,recvID_yz, id);
|
||||
UnpackID(recvList_Yz, recvCountID_Yz ,recvID_Yz, id);
|
||||
UnpackID(recvList_yZ, recvCountID_yZ ,recvID_yZ, id);
|
||||
UnpackID(recvList_YZ, recvCountID_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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user