From ad20322f31c01d3604b321553a113e55bc972e49 Mon Sep 17 00:00:00 2001 From: James E McClure Date: Sat, 21 Mar 2020 09:53:47 -0400 Subject: [PATCH] refactor refine pp tool --- tests/lbpm_refine_pp.cpp | 41 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/tests/lbpm_refine_pp.cpp b/tests/lbpm_refine_pp.cpp index d90dbb04..ad729aa2 100644 --- a/tests/lbpm_refine_pp.cpp +++ b/tests/lbpm_refine_pp.cpp @@ -40,7 +40,6 @@ int main(int argc, char **argv) auto domain_db = db->getDatabase( "Domain" ); // Read domain parameters - auto L = domain_db->getVector( "L" ); auto size = domain_db->getVector( "n" ); auto nproc = domain_db->getVector( "nproc" ); auto ReadValues = domain_db->getVector( "ReadValues" ); @@ -92,8 +91,42 @@ int main(int argc, char **argv) } } Dm.CommInit(); - + + Domain Mask(rnx,rny,rnz,rank,nprocx,nprocy,nprocz,Lx,Ly,Lz,BoundaryCondition); + Mask->ReadIDs(); + Mask.CommInit(); + for (int i=0; iid[i]; // save what was read + + // Generate the signed distance map + // Initialize the domain and communication + Array Labels(nx,ny,nz); DoubleArray SignDist(nx,ny,nz); + + // Solve for the position of the solid phase + for (int k=0;kid[n]; + if (label > 0) Labels(i,j,k) = 1; + else Labels(i,j,k) = 0; + } + } + } + // Initialize the signed distance function + for (int k=0;kSDs(i,j,k) = 2.0*double(Labels(i,j,k))-1.0; + } + } + } + // MeanFilter(Averages->SDs); + if (rank==0) printf("Initialized solid phase -- Converting to Signed Distance function \n"); + CalcDist(SignDist,Labels,*Mask); + // Read the signed distance from file sprintf(LocalRankFilename,"SignDist.%05i",rank); FILE *DIST = fopen(LocalRankFilename,"rb"); @@ -102,7 +135,7 @@ int main(int argc, char **argv) if (ReadSignDist != size_t(N)) printf("lbpm_refine_pp: Error reading signed distance function (rank=%i)\n",rank); fclose(DIST); - char *Labels; + /* char *Labels; Labels = new char[N]; sprintf(LocalRankFilename,"ID.%05i",rank); FILE *LABELS = fopen(LocalRankFilename,"rb"); @@ -110,7 +143,7 @@ int main(int argc, char **argv) ReadLabels=fread(Labels,1,N,LABELS); if (ReadLabels != size_t(N)) printf("lbpm_refine_pp: Error reading ID (rank=%i)\n",rank); fclose(LABELS); - +*/ if ( rank==0 ) printf("Set up Domain, read input distance \n"); DoubleArray RefinedSignDist(rnx,rny,rnz);