From 88063edb97f1b08c175f4bcfbf04af8f5f40bdb0 Mon Sep 17 00:00:00 2001 From: Rex Zhe Li Date: Thu, 1 Oct 2020 16:27:46 -0400 Subject: [PATCH] save the work;upgrade output data writing by writing single file instead of decomposed data --- common/Domain.cpp | 91 +++++++++++++++++++++++++++++++++++++++++++++ common/Domain.h | 1 + models/IonModel.cpp | 13 ++++--- models/IonModel.h | 1 + 4 files changed, 101 insertions(+), 5 deletions(-) diff --git a/common/Domain.cpp b/common/Domain.cpp index fc797a8e..9cf9a1ca 100644 --- a/common/Domain.cpp +++ b/common/Domain.cpp @@ -1433,3 +1433,94 @@ void Domain::ReadFromFile(const std::string& Filename,const std::string& Datatyp //Comm.barrier(); MPI_Barrier(Comm); } + +void Domain::AggregateLabels( const std::string& filename, DoubleArray &UserData ){ + + int nx = Nx; + int ny = Ny; + int nz = Nz; + + int npx = nprocx(); + int npy = nprocy(); + int npz = nprocz(); + + int ipx = iproc(); + int ipy = jproc(); + int ipz = kproc(); + + int nprocs = nprocx()*nprocy()*nprocz(); + + int full_nx = npx*(nx-2); + int full_ny = npy*(ny-2); + int full_nz = npz*(nz-2); + int local_size = (nx-2)*(ny-2)*(nz-2); + unsigned long int full_size = long(full_nx)*long(full_ny)*long(full_nz); + + double *LocalID; + LocalID = new double [local_size]; + + //printf("aggregate labels: local size=%i, global size = %i",local_size, full_size); + // assign the ID for the local sub-region + for (int k=1; kAggregateLabels(OutputFilename,PhaseField); } } diff --git a/models/IonModel.h b/models/IonModel.h index 995898bd..0f527c3a 100644 --- a/models/IonModel.h +++ b/models/IonModel.h @@ -85,6 +85,7 @@ private: char LocalRankString[8]; char LocalRankFilename[40]; char LocalRestartFile[40]; + char OutputFilename[200]; //int rank,nprocs; void LoadParams(std::shared_ptr db0);