From 57817dc94aff6402b964ff29dd1a68512326fb7e Mon Sep 17 00:00:00 2001 From: James E McClure Date: Wed, 3 Jun 2015 16:02:47 -0400 Subject: [PATCH] Addings support for parallel signed distance froms segmented -- pieces in place --- common/TwoPhase.h | 37 +++++++++++++++++++++++------------ tests/BlobAnalyzeParallel.cpp | 6 +++--- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/common/TwoPhase.h b/common/TwoPhase.h index 1fffd915..1dec4a6f 100644 --- a/common/TwoPhase.h +++ b/common/TwoPhase.h @@ -289,7 +289,7 @@ public: void UpdateMeshValues(); void UpdateSolid(); void ComputeDelPhi(); - void SSO(DoubleArray &Distance, char *ID, int timesteps); + void SSO(DoubleArray &Distance, char *ID, Domain &Dm, int timesteps); void ColorToSignedDistance(double Beta, double *ColorData, double *DistData); void ComputeLocal(); void ComputeLocalBlob(); @@ -301,7 +301,7 @@ public: }; -inline void TwoPhase::SSO(DoubleArray &Distance, char *ID, int timesteps){ +inline void TwoPhase::SSO(DoubleArray &Distance, char *ID, Domain &Dm, int timesteps){ int Q=26; int q,i,j,k,n; @@ -323,20 +323,27 @@ inline void TwoPhase::SSO(DoubleArray &Distance, char *ID, int timesteps){ double nx,ny,nz,Cqx,Cqy,Cqz,sign,norm; // double f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18; + fillHalo fillData(Dm.rank_info,Nx-2,Ny-2,Nz-2,1,1,1,0,1); + + printf("Number of timesteps is %i \n",timesteps); printf("Mesh is %i,%i,%i \n",Nx,Ny,Nz); while (count < timesteps){ printf("count=%i \n",count); - for (k=0;k 0.0){ @@ -364,20 +373,24 @@ inline void TwoPhase::SSO(DoubleArray &Distance, char *ID, int timesteps){ in = i + D3Q27[q][0]; jn = j + D3Q27[q][1]; kn = k + D3Q27[q][2]; + // make sure the neighbor is in the domain (periodic BC) /* if (in < 0 ) in +=Nx; + * don't need this in parallel since MPI handles the halos if (jn < 0 ) jn +=Ny; if (kn < 0 ) kn +=Nz; if (!(in < Nx) ) in -=Nx; if (!(jn < Ny) ) jn -=Ny; if (!(kn < Nz) ) kn -=Nz; - */ // symmetric boundary + // symmetric boundary if (in < 0 ) in = i; if (jn < 0 ) jn = j; if (kn < 0 ) kn = k; if (!(in < Nx) ) in = i; if (!(jn < Ny) ) jn = k; if (!(kn < Nz) ) kn = k; + */ + // 1-D index nn = kn*Nx*Ny + jn*Nx + in; @@ -668,7 +681,7 @@ void TwoPhase::ComputeLocalBlob(){ int i,j,k,n,label; double vF,vS; vF = 0.0; vS= -1.0; - const RankInfoStruct rank_info(Dm.rank,Dm.nprocx,Dm.nprocy,Dm.nprocz); +// const RankInfoStruct rank_info(Dm.rank,Dm.nprocx,Dm.nprocy,Dm.nprocz); int cube[8][3] = {{0,0,0},{1,0,0},{0,1,0},{1,1,0},{0,0,1},{1,0,1},{0,1,1},{1,1,1}}; // get the maximum label locally -- then compute number of global blobs @@ -681,7 +694,7 @@ void TwoPhase::ComputeLocalBlob(){ nblobs_global+=1; if (Dm.rank==0) printf("Number of blobs is %i \n",nblobs_global); - nblobs_global = ComputeGlobalBlobIDs(Nx-2,Ny-2,Nz-2,rank_info, + nblobs_global = ComputeGlobalBlobIDs(Nx-2,Ny-2,Nz-2,Dm.rank_info, Phase,SDs,vF,vS,BlobLabel); if (Dm.rank==0) printf("Number of blobs is %i \n",nblobs_global); diff --git a/tests/BlobAnalyzeParallel.cpp b/tests/BlobAnalyzeParallel.cpp index c9298b87..af013a5a 100644 --- a/tests/BlobAnalyzeParallel.cpp +++ b/tests/BlobAnalyzeParallel.cpp @@ -151,7 +151,7 @@ int main(int argc, char **argv) int BC=0; // Get the rank info Domain Dm(nx,ny,nz,rank,nprocx,nprocy,nprocz,Lx,Ly,Lz,BC); - const RankInfoStruct rank_info(rank,nprocx,nprocy,nprocz); + // const RankInfoStruct rank_info(rank,nprocx,nprocy,nprocz); TwoPhase Averages(Dm); int N = (nx+2)*(ny+2)*(nz+2); @@ -161,7 +161,7 @@ int main(int argc, char **argv) readRankData( rank, nx+2, ny+2, nz+2, Phase, SignDist ); // Communication the halos - fillHalo fillData(rank_info,nx,ny,nz,1,1,1,0,1); + fillHalo fillData(Dm.rank_info,nx,ny,nz,1,1,1,0,1); fillData.fill(Phase); fillData.fill(SignDist); @@ -170,7 +170,7 @@ int main(int argc, char **argv) double vF=0.0; double vS=0.0; IntArray GlobalBlobID; - int nblobs = ComputeGlobalBlobIDs(nx,ny,nz,rank_info, + int nblobs = ComputeGlobalBlobIDs(nx,ny,nz,Dm.rank_info, Phase,SignDist,vF,vS,GlobalBlobID); if ( rank==0 ) { printf("Identified %i blobs\n",nblobs); }