// Test of ComputeGlobalBlobIDs for special corner/edge cases // Note: this is a short test, but requires 27 processors to run #include #include #include "common/pmmc.h" #include "common/Communication.h" #include "analysis/analysis.h" #include "IO/MeshDatabase.h" #include "IO/Reader.h" #include "IO/Writer.h" #include "ProfilerApp.h" // Main int main(int argc, char **argv) { // Initialize MPI Utilities::startup( argc, argv ); int rank = comm.getRank(); int nprocs = comm.getSize(); /*if ( nprocs != 8 ) { printf("This tests requires 8 processors\n"); return -1; }*/ if ( rank==0 ) { printf("-----------------------------------------------------------\n"); printf("Testing Blob Identification Special Cases\n"); printf("-----------------------------------------------------------\n"); } // Set the domain information std::vector factors = Utilities::factor(nprocs); int nproc[3]={1,1,1}; for (size_t i=0; i 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 LocalBlobID, GlobalBlobID; int nblobs0 = ComputeLocalBlobIDs(Phase,SignDist,vF,vS,LocalBlobID,false); int nblobs = ComputeGlobalBlobIDs(nx,ny,nz,rank_info, Phase,SignDist,vF,vS,GlobalBlobID); if ( rank==0 ) { printf("Identified %i blobs\n",nblobs); } // Create the MeshDataStruct std::vector meshData(1); meshData[0].meshName = "domain"; meshData[0].mesh = std::shared_ptr( new IO::DomainMesh(rank_info,nx,ny,nz,Lx,Ly,Lz) ); std::shared_ptr PhaseVar( new IO::Variable() ); std::shared_ptr SignDistVar( new IO::Variable() ); std::shared_ptr LocalBlobIDVar( new IO::Variable() ); std::shared_ptr GlobalBlobIDVar( new IO::Variable() ); PhaseVar->name = "phase"; PhaseVar->type = IO::VolumeVariable; PhaseVar->dim = 1; PhaseVar->data.resize(nx,ny,nz); meshData[0].vars.push_back(PhaseVar); SignDistVar->name = "SignDist"; SignDistVar->type = IO::VolumeVariable; SignDistVar->dim = 1; SignDistVar->data.resize(nx,ny,nz); meshData[0].vars.push_back(SignDistVar); LocalBlobIDVar->name = "LocalBlobID"; LocalBlobIDVar->type = IO::VolumeVariable; LocalBlobIDVar->dim = 1; LocalBlobIDVar->data.resize(nx,ny,nz); meshData[0].vars.push_back(LocalBlobIDVar); GlobalBlobIDVar->name = "GlobalBlobID"; GlobalBlobIDVar->type = IO::VolumeVariable; GlobalBlobIDVar->dim = 1; GlobalBlobIDVar->data.resize(nx,ny,nz); meshData[0].vars.push_back(GlobalBlobIDVar); // Save the results fillData.copy(Phase,PhaseVar->data); fillData.copy(SignDist,SignDistVar->data); fillData.copy(LocalBlobID,LocalBlobIDVar->data); fillData.copy(GlobalBlobID,GlobalBlobIDVar->data); IO::writeData( 0, meshData ); int N_errors = 0; return N_errors; }