// Sequential blob analysis // Reads parallel simulation data and performs connectivity analysis // and averaging on a blob-by-blob basis // James E. McClure 2014 #include #include #include "common/pmmc.h" #include "common/Communication.h" #include "analysis/analysis.h" #ifdef PROFILE #include "ProfilerApp.h" #endif //#include "Domain.h" using namespace std; inline void ReadBinaryFile(char *FILENAME, double *Data, int N) { int n; double value; ifstream File(FILENAME,ios::binary); for (n=0; n> nprocx; domain >> nprocy; domain >> nprocz; domain >> nx; domain >> ny; domain >> nz; domain >> nspheres; domain >> Lx; domain >> Ly; domain >> Lz; // Check that the number of processors >= the number of ranks if ( rank==0 ) { printf("Number of MPI ranks required: %i \n", nprocx*nprocy*nprocz); printf("Number of MPI ranks used: %i \n", nprocs); printf("Full domain size: %i x %i x %i \n",nx*nprocx,ny*nprocy,nz*nprocz); } if ( nprocs < nprocx*nprocy*nprocz ) ERROR("Insufficient number of processors"); // Get the rank info const RankInfoStruct rank_info(rank,nprocx,nprocy,nprocz); // Read the local file DoubleArray Phase; DoubleArray SignDist; 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); fillData.fill(Phase); fillData.fill(SignDist); // Find blob domains if ( rank==0 ) { printf("Finding blob domains\n"); } double vF=0.0; double vS=0.0; IntArray GlobalBlobID; int nblobs = ComputeGlobalBlobIDs(nx,ny,nz,rank_info, Phase,SignDist,vF,vS,GlobalBlobID); if ( rank==0 ) { printf("Identified %i blobs\n",nblobs); } // Write the local blob ids char LocalRankFilename[100]; sprintf(LocalRankFilename,"BlobLabel.%05i",rank); FILE *BLOBLOCAL = fopen(LocalRankFilename,"wb"); fwrite(GlobalBlobID.get(),4,GlobalBlobID.length(),BLOBLOCAL); fclose(BLOBLOCAL); printf("Wrote BlobLabel.%05i \n",rank); /*FILE *BLOBS = fopen("Blobs.dat","wb"); fwrite(GlobalBlobID.get(),4,Nx*Ny*Nz,BLOBS); fclose(BLOBS);*/ #ifdef PROFILE PROFILE_STOP("main"); PROFILE_SAVE("BlobIdentifyParallel",false); #endif MPI_Barrier(MPI_COMM_WORLD); MPI_Finalize(); return 0; }