// 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 #include int main(int argc, char **argv) { // Initialize MPI int rank, nprocs; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD,&rank); MPI_Comm_size(MPI_COMM_WORLD,&nprocs); int i,j,k,n,nn; int iproc,jproc,kproc; int nx,ny,nz; int Nx, Ny, Nz, N; int nprocx, nprocy, nprocz, nspheres; double Lx, Ly, Lz; Nx = Ny = Nz = 50; nx = ny = nz = 50; N = Nx*Ny*Nz; nprocx=nprocy=nprocz=2; Lx = Ly = Lz = 1.0; int BC=0; if (nprocs != 8){ ERROR("TestSegDist: Number of MPI processes must be equal to 8"); } if (nprocx !=2 || nprocz !=2 || nprocy !=2 ){ ERROR("TestSegDist: MPI process grid must be 2x2x2"); } // Get the rank info Domain Dm(nx,ny,nz,rank,nprocx,nprocy,nprocz,Lx,Ly,Lz,BC); Dm.CommInit(MPI_COMM_WORLD); nx+=2; ny+=2; nz+=2; N = nx*ny*nz; int count = 0; char *id; id = new char [N]; double BubbleRadius = 5; // Initialize the bubble int x,y,z; for (k=1;k