Skip to content

Commit

Permalink
keep previous SCR code in getDt
Browse files Browse the repository at this point in the history
  • Loading branch information
adammoody committed Feb 12, 2022
1 parent 7beb75c commit a404216
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/CheckPoint.C
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,45 @@ float_sw4 CheckPoint::getDt() {
}
MPI_Bcast(&dt, 1, mEW->m_mpifloat, 0, mEW->m_cartesian_communicator);
return dt;

#if 0
int have_restart = 0;
char checkpoint_dir[SCR_MAX_FILENAME];
SCR_Have_restart(&have_restart, checkpoint_dir);
if (! have_restart) {
std::cerr<<"Error :: SCR found no checkpoints ! \n"<<std::flush;
abort();
}

SCR_Start_restart(checkpoint_dir);

std::stringstream s;
s<<checkpoint_dir<<"/CheckPoint_"<<mEW->getRank()<<".bin";
char scr_file[SCR_MAX_FILENAME];
SCR_Route_file(s.str().c_str(), scr_file);
int valid=1;
if (std::FILE *file=std::fopen(scr_file,"rb")){
float_sw4 dt;
if ( std::fread(&dt,sizeof dt,1,file)==1) {
scr_file_handle=file;
return dt;
} else {
std::cerr<<"ERROR:: Read of SCR checkpoint file failed in getDt \n"<<std::flush;
std::fclose(file);
valid = 0;
}
} else {
std::cerr<<"ERROR::Restart file opening failed in getDt "<<s.str()<<"\n"<<std::flush;
valid = 0;
}

if (!valid){
std::cerr<<"ERROR :: Invalid restart file "<<s.str()<<"\n Aborting..\n"<<std::flush;
abort();
}

return -1.0e99; // Dummy return to suppress warnings. Should never be reached
#endif
}

//-----------------------------------------------------------------------
Expand Down

0 comments on commit a404216

Please sign in to comment.