diff --git a/analysis/runAnalysis.cpp b/analysis/runAnalysis.cpp index b894733e..657847e8 100644 --- a/analysis/runAnalysis.cpp +++ b/analysis/runAnalysis.cpp @@ -476,7 +476,7 @@ runAnalysis::commWrapper runAnalysis::getComm( ) /****************************************************************** * Constructor/Destructors * ******************************************************************/ -runAnalysis::runAnalysis(std::shared_ptr db, const RankInfoStruct& rank_info, std::shared_ptr ScaLBL_Comm, std::shared_ptr Dm, +runAnalysis::runAnalysis(std::shared_ptr input_db, const RankInfoStruct& rank_info, std::shared_ptr ScaLBL_Comm, std::shared_ptr Dm, int Np, bool Regular, IntArray Map ): d_Np( Np ), d_regular ( Regular), @@ -486,6 +486,7 @@ runAnalysis::runAnalysis(std::shared_ptr db, const RankInfoStruct& ran d_ScaLBL_Comm( ScaLBL_Comm) { + auto db = input_db->getDatabase( "Analysis" ); // Ids of work items to use for dependencies ThreadPool::thread_id_t d_wait_blobID; ThreadPool::thread_id_t d_wait_analysis; @@ -714,11 +715,12 @@ AnalysisType runAnalysis::computeAnalysisType( int timestep ) /****************************************************************** * Run the analysis * ******************************************************************/ -void runAnalysis::run( std::shared_ptr db, TwoPhase& Averages, const double *Phi, +void runAnalysis::run( std::shared_ptr input_db, TwoPhase& Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den) { int N = d_N[0]*d_N[1]*d_N[2]; + auto db = input_db->getDatabase( "Analysis" ); int timestep = db->getWithDefault( "timestep", 0 ); // Check which analysis steps we need to perform @@ -856,12 +858,16 @@ void runAnalysis::run( std::shared_ptr db, TwoPhase& Averages, const d // if ( matches(type,AnalysisType::CreateRestart) ) { if (timestep%d_restart_interval==0){ - if (d_rank==0) { - FILE *Rst = fopen("Restart.txt","w"); - fprintf(Rst,"%i\n",timestep+4); - fclose(Rst); - } - // Write the restart file (using a seperate thread) + if (d_rank==0) { + FILE *Rst = fopen("Restart.txt","w"); + fprintf(Rst,"%i\n",timestep+4); + fclose(Rst); + input_db->putScalar( "Restart", true ); + std::ofstream OutStream("Restart.db"); + input_db->print(OutStream, ""); + OutStream.close(); + } + // Write the restart file (using a seperate thread) auto work = new WriteRestartWorkItem(d_restartFile.c_str(),cDen,cfq,d_Np); work->add_dependency(d_wait_restart); d_wait_restart = d_tpool.add_work(work);