restart database

This commit is contained in:
James McClure 2019-08-22 08:28:11 -04:00
parent dcc03b7337
commit 5aca31e751

View File

@ -890,12 +890,12 @@ void runAnalysis::run( std::shared_ptr<Database> input_db, TwoPhase& Averages, c
/****************************************************************** /******************************************************************
* Run the analysis * * Run the analysis *
******************************************************************/ ******************************************************************/
void runAnalysis::basic( std::shared_ptr<Database> db, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den) void runAnalysis::basic( std::shared_ptr<Database> input_db, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den)
{ {
int N = d_N[0]*d_N[1]*d_N[2]; int N = d_N[0]*d_N[1]*d_N[2];
// Check which analysis steps we need to perform // Check which analysis steps we need to perform
auto color_db = db->getDatabase( "Color" ); auto color_db = input_db->getDatabase( "Color" );
int timestep = color_db->getWithDefault<int>( "timestep", 0 ); int timestep = color_db->getWithDefault<int>( "timestep", 0 );
auto type = computeAnalysisType( timestep ); auto type = computeAnalysisType( timestep );
@ -969,6 +969,12 @@ void runAnalysis::basic( std::shared_ptr<Database> db, SubPhase &Averages, const
FILE *Rst = fopen("Restart.txt","w"); FILE *Rst = fopen("Restart.txt","w");
fprintf(Rst,"%i\n",timestep+4); fprintf(Rst,"%i\n",timestep+4);
fclose(Rst); fclose(Rst);
input_db->putScalar<bool>( "Restart", true );
std::ofstream OutStream("Restart.db");
input_db->print(OutStream, "");
OutStream.close();
}
} }
// Write the restart file (using a seperate thread) // Write the restart file (using a seperate thread)
auto work1 = new WriteRestartWorkItem(d_restartFile.c_str(),cDen,cfq,d_Np); auto work1 = new WriteRestartWorkItem(d_restartFile.c_str(),cDen,cfq,d_Np);