Skip to content

Commit

Permalink
add compute_file_suffix given a string
Browse files Browse the repository at this point in the history
  • Loading branch information
adammoody committed Feb 11, 2022
1 parent ad59f47 commit 7beb75c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/CheckPoint.C
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ void CheckPoint::compute_file_suffix(int cycle, std::stringstream& fileSuffix) {
fileSuffix << ".sw4checkpoint";
}

void CheckPoint::compute_file_suffix(const char* cycle, std::stringstream& fileSuffix) {
fileSuffix << mCheckPointFile << "." << cycle << ".sw4checkpoint";
}

//-----------------------------------------------------------------------
void CheckPoint::write_checkpoint(float_sw4 a_time, int a_cycle,
vector<Sarray>& a_Um, vector<Sarray>& a_U,
Expand Down Expand Up @@ -606,7 +610,7 @@ float_sw4 CheckPoint::getDt() {
// TODO: this is not right, but you get the idea...
std::stringstream fileSuffix;
compute_file_suffix(cycle_num, fileSuffix);
s << fileSuffix;
s << fileSuffix.str();

// Ask SCR for the path to open our checkpoint file
char scr_file[SCR_MAX_FILENAME];
Expand Down Expand Up @@ -1382,7 +1386,7 @@ void CheckPoint::read_checkpoint_hdf5(float_sw4& a_time, int& a_cycle,
// TODO: this is not right, but you get the idea...
std::stringstream fileSuffix;
compute_file_suffix(cycle_num, fileSuffix);
s << fileSuffix;
s << fileSuffix.str();

// Ask SCR for the path to open our checkpoint file
char scr_file[SCR_MAX_FILENAME];
Expand Down
1 change: 1 addition & 0 deletions src/CheckPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void write_checkpoint_scr(float_sw4 a_time, int a_cycle,
void define_pio();
void setSteps(int a_steps);
void compute_file_suffix(int cycle, std::stringstream& fileSuffix);
void compute_file_suffix(const char* cycle, std::stringstream& fileSuffix);
void cycle_checkpoints(string fname);
void write_header(int& fid, float_sw4 a_time, int a_cycle, int& hsize);
void read_header(int& fid, float_sw4& a_time, int& a_cycle, int& hsize);
Expand Down

0 comments on commit 7beb75c

Please sign in to comment.