// Compute the signed distance from a digitized image // Two phases are present // Phase 1 has value -1 // Phase 2 has value 1 // this code uses the segmented image to generate the signed distance #include #include #include #include #include #include "common/Array.h" #include "common/Domain.h" #include "analysis/eikonal.h" std::shared_ptr loadInputs( int nprocs ) { INSIST(nprocs==8, "TestSegDist: Number of MPI processes must be equal to 8"); auto db = std::make_shared( ); db->putScalar( "BC", 0 ); db->putVector( "nproc", { 2, 2, 2 } ); db->putVector( "n", { 50, 50, 50 } ); db->putScalar( "nspheres", 0 ); db->putVector( "L", { 1, 1, 1 } ); return db; } //*************************************************************************************** int main(int argc, char **argv) { // Initialize MPI int rank, nprocs; MPI_Init(&argc,&argv); MPI_Comm comm = MPI_COMM_WORLD; MPI_Comm_rank(comm,&rank); MPI_Comm_size(comm,&nprocs); { int i,j,k,n,nn; int iproc,jproc,kproc; // Load inputs auto db = loadInputs( nprocs ); int Nx = db->getVector( "n" )[0]; int Ny = db->getVector( "n" )[1]; int Nz = db->getVector( "n" )[2]; int nprocx = db->getVector( "nproc" )[0]; int nprocy = db->getVector( "nproc" )[1]; int nprocz = db->getVector( "nproc" )[2]; // Get the rank info Domain Dm(db); for (k=0;k