Added Restart.db
This commit is contained in:
parent
886ca02921
commit
d3dc379fd2
@ -476,7 +476,7 @@ runAnalysis::commWrapper runAnalysis::getComm( )
|
|||||||
/******************************************************************
|
/******************************************************************
|
||||||
* Constructor/Destructors *
|
* Constructor/Destructors *
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
runAnalysis::runAnalysis(std::shared_ptr<Database> db, const RankInfoStruct& rank_info, std::shared_ptr<ScaLBL_Communicator> ScaLBL_Comm, std::shared_ptr <Domain> Dm,
|
runAnalysis::runAnalysis(std::shared_ptr<Database> input_db, const RankInfoStruct& rank_info, std::shared_ptr<ScaLBL_Communicator> ScaLBL_Comm, std::shared_ptr <Domain> Dm,
|
||||||
int Np, bool Regular, IntArray Map ):
|
int Np, bool Regular, IntArray Map ):
|
||||||
d_Np( Np ),
|
d_Np( Np ),
|
||||||
d_regular ( Regular),
|
d_regular ( Regular),
|
||||||
@ -486,6 +486,7 @@ runAnalysis::runAnalysis(std::shared_ptr<Database> db, const RankInfoStruct& ran
|
|||||||
d_ScaLBL_Comm( ScaLBL_Comm)
|
d_ScaLBL_Comm( ScaLBL_Comm)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
auto db = input_db->getDatabase( "Analysis" );
|
||||||
// Ids of work items to use for dependencies
|
// Ids of work items to use for dependencies
|
||||||
ThreadPool::thread_id_t d_wait_blobID;
|
ThreadPool::thread_id_t d_wait_blobID;
|
||||||
ThreadPool::thread_id_t d_wait_analysis;
|
ThreadPool::thread_id_t d_wait_analysis;
|
||||||
@ -714,11 +715,12 @@ AnalysisType runAnalysis::computeAnalysisType( int timestep )
|
|||||||
/******************************************************************
|
/******************************************************************
|
||||||
* Run the analysis *
|
* Run the analysis *
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
void runAnalysis::run( std::shared_ptr<Database> db, TwoPhase& Averages, const double *Phi,
|
void runAnalysis::run( std::shared_ptr<Database> input_db, TwoPhase& Averages, const double *Phi,
|
||||||
double *Pressure, double *Velocity, double *fq, double *Den)
|
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];
|
||||||
|
|
||||||
|
auto db = input_db->getDatabase( "Analysis" );
|
||||||
int timestep = db->getWithDefault<int>( "timestep", 0 );
|
int timestep = db->getWithDefault<int>( "timestep", 0 );
|
||||||
|
|
||||||
// Check which analysis steps we need to perform
|
// Check which analysis steps we need to perform
|
||||||
@ -856,12 +858,16 @@ void runAnalysis::run( std::shared_ptr<Database> db, TwoPhase& Averages, const d
|
|||||||
// if ( matches(type,AnalysisType::CreateRestart) ) {
|
// if ( matches(type,AnalysisType::CreateRestart) ) {
|
||||||
if (timestep%d_restart_interval==0){
|
if (timestep%d_restart_interval==0){
|
||||||
|
|
||||||
if (d_rank==0) {
|
if (d_rank==0) {
|
||||||
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 );
|
||||||
// Write the restart file (using a seperate thread)
|
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);
|
auto work = new WriteRestartWorkItem(d_restartFile.c_str(),cDen,cfq,d_Np);
|
||||||
work->add_dependency(d_wait_restart);
|
work->add_dependency(d_wait_restart);
|
||||||
d_wait_restart = d_tpool.add_work(work);
|
d_wait_restart = d_tpool.add_work(work);
|
||||||
|
Loading…
Reference in New Issue
Block a user