This commit is contained in:
James E McClure 2014-06-28 21:03:03 -04:00
commit c95f82d0d9

View File

@ -83,9 +83,33 @@ struct Domain{
void CommInit(MPI_Comm comm); void CommInit(MPI_Comm comm);
void BlobComm(MPI_Comm comm); void BlobComm(MPI_Comm comm);
void getBlobConnections(); void AssignBlobConnections(){
getBlobConnections(recvList_x, recvCount_x, rank_x);
getBlobConnections(recvList_y, recvCount_y, rank_y);
getBlobConnections(recvList_z, recvCount_z, rank_z);
getBlobConnections(recvList_X, recvCount_X, rank_X);
getBlobConnections(recvList_Y, recvCount_y, rank_Y);
getBlobConnections(recvList_Z, recvCount_Z, rank_Z);
getBlobConnections(recvList_xy, recvCount_xy, rank_xy);
getBlobConnections(recvList_xY, recvCount_xY, rank_xY);
getBlobConnections(recvList_Xy, recvCount_Xy, rank_Xy);
getBlobConnections(recvList_XY, recvCount_XY, rank_XY);
getBlobConnections(recvList_xz, recvCount_xz, rank_xz);
getBlobConnections(recvList_xZ, recvCount_xZ, rank_xZ);
getBlobConnections(recvList_Xz, recvCount_Xz, rank_Xz);
getBlobConnections(recvList_XZ, recvCount_XZ, rank_XZ);
getBlobConnections(recvList_yz, recvCount_yz, rank_yz);
getBlobConnections(recvList_yZ, recvCount_yZ, rank_yZ);
getBlobConnections(recvList_Yz, recvCount_Yz, rank_Yz);
getBlobConnections(recvList_YZ, recvCount_YZ, rank_YZ);
}
private: private:
int d[26][3] = {{1,0,0},{-1,0,0},{0,1,0},{0,-1,0},{0,0,1},{0,0,-1},
{1,1,0},{1,-1,0},{-1,1,0},{-1,-1,0},{1,0,1},{-1,0,1},
{1,0,-1},{-1,0,-1},{0,1,1},{0,-1,1},{0,1,-1},{0,-1,-1},
{1,1,1},{1,1,-1},{1,-1,1},{1,-1,-1},{-1,1,1},{-1,1,-1},
int getRankForBlock( int i, int j, int k ) int getRankForBlock( int i, int j, int k )
{ {
int i2 = (i+nprocx)%nprocx; int i2 = (i+nprocx)%nprocx;
@ -112,6 +136,48 @@ private:
} }
} }
int VoxelConnection(int n){
int returnVal = -1;
int x,y,z;
// Get the 3-D indices
x = n%Nx;
y = (n/Nx)%Ny;
z = n/(Nx*Ny);
int nodx,nody,nodz;
for (int p=0;p<26;p++){
nodx=x+d[p][0];
// Get the neighbor and guarantee it is in the domain
if (nodx < 0 ){ nodx = 0; }
if (nodx > Nx-1 ){ nodx = Nx-1; }
nody=y+d[p][1];
if (nody < 0 ){ nody = 0; }
if (nody > Ny-1 ){ nody = Ny-1; }
nodz=z+d[p][2];
if (nodz < 0 ){ nodz = 0; }
if (nodz > Nz-1 ){ nodz = Nz-1; }
if (Blobs(nodx,nody,nodz) > returnVal ) returnVal = Blobs(nodx,nody,nodz);
}
return returnVal;
}
void getBlobConnections(int * List, int count, int neighbor){
int idx,n,localValue,neighborValue;
int x,y,z;
for (idx=0; idx<recvCount_x; idx++){
n = recvList_x[idx];
// Get the 3-D indices
x = n%Nx;
y = (n/Nx)%Ny;
z = n/(Nx*Ny);
neighborValue = Blobs(x,y,z);
if (neighborValue > -1){
localValue = VoxelConnection(n);
printf("Blob (%i,%i) connects to neighbor blob (%i,%i)", localValue, rank, neighborValue, neighbor);
}
}
}
}; };
void Domain::InitializeRanks() void Domain::InitializeRanks()
@ -487,13 +553,6 @@ void Domain::BlobComm(MPI_Comm Communicator){
//...................................................................................... //......................................................................................
} }
void Domain::getBlobConnections(){
// BlobGraph(0,nblob) = rank of the connecting blob;
// BlobGraph(1,nblob) = ID of the connecting blob;
}
inline void ReadSpherePacking(int nspheres, double *List_cx, double *List_cy, double *List_cz, double *List_rad) inline void ReadSpherePacking(int nspheres, double *List_cx, double *List_cy, double *List_cz, double *List_rad)
{ {
// Read in the full sphere pack // Read in the full sphere pack