From 7beb75c6589ada122cf4be0a04a3a9085860d53f Mon Sep 17 00:00:00 2001 From: Adam Moody Date: Fri, 11 Feb 2022 15:17:23 -0800 Subject: [PATCH] add compute_file_suffix given a string --- src/CheckPoint.C | 8 ++++++-- src/CheckPoint.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/CheckPoint.C b/src/CheckPoint.C index 565492fd..aeb78e64 100644 --- a/src/CheckPoint.C +++ b/src/CheckPoint.C @@ -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& a_Um, vector& a_U, @@ -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]; @@ -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]; diff --git a/src/CheckPoint.h b/src/CheckPoint.h index 5068c97b..36b2df09 100644 --- a/src/CheckPoint.h +++ b/src/CheckPoint.h @@ -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);