From 02f7c0f6c6779b92d541fffa52d8617c5b6ff8ae Mon Sep 17 00:00:00 2001 From: zherexli Date: Wed, 9 Nov 2016 23:23:56 -0500 Subject: [PATCH] add the similar feature to morphopen so that closest sw is used --- tests/lbpm_morphopen_pp.cpp | 66 +++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/tests/lbpm_morphopen_pp.cpp b/tests/lbpm_morphopen_pp.cpp index 1998844f..747c69b0 100644 --- a/tests/lbpm_morphopen_pp.cpp +++ b/tests/lbpm_morphopen_pp.cpp @@ -54,7 +54,8 @@ int main(int argc, char **argv) MPI_Comm_rank(comm,&rank); MPI_Comm_size(comm,&nprocs); - double Rcrit=0.f; + //double Rcrit_new=1.f; // Hard-coded 'Rcrit' to avoid any calculations under resolutions. + double Rcrit_new=0.f; double SW=strtod(argv[1],NULL); if (rank==0){ //printf("Critical radius %f (voxels)\n",Rcrit); @@ -330,18 +331,25 @@ int main(int argc, char **argv) int Nx = nx; int Ny = ny; int Nz = nz; - double sw = 0.f; - int GlobalNumber = 1; + + double sw_old=0.0; + double sw_new=0.0; + double sw_diff_old = 1.0; + double sw_diff_new = 1.0; + // Increase the critical radius until the target saturation is met + double deltaR=0.01; // amount to change the radius in voxel units + double Rcrit_old; + + int GlobalNumber = 1; int imin,jmin,kmin,imax,jmax,kmax; - // Increase the critical radius until the target saturation is met - double deltaR=0.05; // amount to change the radius in voxel units - while (sw Rcrit){ + if (SignDist(i,j,k) > Rcrit_new){ // loop over the window and update imin=max(1,i-Window); jmin=max(1,j-Window); @@ -375,7 +383,7 @@ int main(int argc, char **argv) for (ii=imin; ii