/* * Pre-processor to generate signed distance function from segmented data * segmented data should be stored in a raw binary file as 1-byte integer (type char) * will output distance functions for phases */ #include #include #include #include #include #include #include "common/Array.h" #include "common/Domain.h" int main(int argc, char **argv) { int rank=0; /* bool MULTINPUT=false; int NWP,SOLID,rank_offset; SOLID=atoi(argv[1]); NWP=atoi(argv[2]); if (rank==0){ printf("Solid Label: %i \n",SOLID); printf("NWP Label: %i \n",NWP); } if (argc > 3){ rank_offset = atoi(argv[3]); } else{ MULTINPUT=true; rank_offset=0; } */ string filename; if (argc > 1) filename=argv[1]; else{ ERROR("lbpm_serial_decomp: no in put database provided \n"); } int rank_offset=0; //....................................................................... // Reading the domain information file //....................................................................... int64_t i,j,k,n; int64_t xStart,yStart,zStart; int checkerSize; int inlet_count_x, inlet_count_y, inlet_count_z; int outlet_count_x, outlet_count_y, outlet_count_z; // char fluidValue,solidValue; xStart=yStart=zStart=0; inlet_count_x = 0; inlet_count_y = 0; inlet_count_z = 0; outlet_count_x = 0; outlet_count_y = 0; outlet_count_z = 0; checkerSize = 32; // read the input database auto db = std::make_shared( filename ); auto domain_db = db->getDatabase( "Domain" ); // Read domain parameters auto Filename = domain_db->getScalar( "Filename" ); //auto L = domain_db->getVector( "L" ); auto size = domain_db->getVector( "n" ); auto SIZE = domain_db->getVector( "N" ); auto nproc = domain_db->getVector( "nproc" ); if (domain_db->keyExists( "offset" )){ auto offset = domain_db->getVector( "offset" ); xStart = offset[0]; yStart = offset[1]; zStart = offset[2]; } if (domain_db->keyExists( "InletLayers" )){ auto InletCount = domain_db->getVector( "InletLayers" ); inlet_count_x = InletCount[0]; inlet_count_y = InletCount[1]; inlet_count_z = InletCount[2]; } if (domain_db->keyExists( "OutletLayers" )){ auto OutletCount = domain_db->getVector( "OutletLayers" ); outlet_count_x = OutletCount[0]; outlet_count_y = OutletCount[1]; outlet_count_z = OutletCount[2]; } if (domain_db->keyExists( "checkerSize" )){ checkerSize = domain_db->getScalar( "checkerSize" ); } else { checkerSize = SIZE[0]; } auto ReadValues = domain_db->getVector( "ReadValues" ); auto WriteValues = domain_db->getVector( "WriteValues" ); auto ReadType = domain_db->getScalar( "ReadType" ); if (ReadType == "8bit"){ } else if (ReadType == "16bit"){ } else{ printf("INPUT ERROR: Valid ReadType are 8bit, 16bit \n"); ReadType = "8bit"; } int nx = size[0]; int ny = size[1]; int nz = size[2]; int nprocx = nproc[0]; int nprocy = nproc[1]; int nprocz = nproc[2]; long int Nx = SIZE[0]; long int Ny = SIZE[1]; long int Nz = SIZE[2]; printf("Input media: %s\n",Filename.c_str()); printf("Relabeling %lu values\n",ReadValues.size()); for (size_t idx=0; idx LabelCount(ReadValues.size(),0); for (int k = 0; k 0){ // use checkerboard pattern printf("Checkerboard pattern at x inlet for %i layers \n",inlet_count_x); for (int k = 0; k 0){ printf("Checkerboard pattern at y inlet for %i layers \n",inlet_count_y); // use checkerboard pattern for (int k = 0; k 0){ printf("Checkerboard pattern at z inlet for %i layers \n",inlet_count_z); // use checkerboard pattern for (int k = zStart; k < zStart+inlet_count_z; k++){ for (int j = 0; j 0){ // use checkerboard pattern printf("Checkerboard pattern at x outlet for %i layers \n",outlet_count_x); for (int k = 0; k 0){ printf("Checkerboard pattern at y outlet for %i layers \n",outlet_count_y); // use checkerboard pattern for (int k = 0; k 0){ printf("Checkerboard pattern at z outlet for %i layers \n",outlet_count_z); // use checkerboard pattern for (int k = zStart + nz*nprocz - outlet_count_z; k < zStart + nz*nprocz; k++){ for (int j = 0; j