Skip to content

Commit 9455c75

Browse files
authored
Merge pull request #697 from TeamCOMPAS/SSE_boost
Defect repair: boost::bad_get error when writing HDF5 SSE_Supernovae files
2 parents 599a35c + 382fb45 commit 9455c75

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed

src/Log.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,6 @@ void Log::Stop(std::tuple<int, int> p_ObjectStats) {
648648
}
649649

650650
// update run details text file
651-
652651
string filename = m_LogBasePath + "/" + m_LogContainerName + "/" + RUN_DETAILS_FILE_NAME; // run details filename with container name
653652
try {
654653
m_RunDetailsFile << utils::SplashScreen(false) << std::endl; // write splash string with version number to file
@@ -714,7 +713,6 @@ void Log::Stop(std::tuple<int, int> p_ObjectStats) {
714713

715714
m_RunDetailsFile << "Actual random seed = " << actualRandomSeed << ", CALCULATED, UNSIGNED_LONG" << std::endl; // actual random seed
716715

717-
718716
// done writing - flush and close the file
719717
try {
720718
m_RunDetailsFile.flush();

src/Log.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ class Log {
600600

601601
void ClearEntry(const int p_LogfileId) {
602602
if (IsValidId(p_LogfileId)) {
603-
m_Logfiles[p_LogfileId].active = false; // not active
603+
m_Logfiles[p_LogfileId].active = false; // not active
604604
m_Logfiles[p_LogfileId].logfiletype = LOGFILE::NONE;
605605
m_Logfiles[p_LogfileId].filetype = LOGFILETYPE::NONE;
606606
m_Logfiles[p_LogfileId].name = "";
@@ -771,8 +771,13 @@ class Log {
771771

772772
if (ok && p_UseSpecifiedValue && (thisProperty == p_SpecifiedProperty)) { // replace specified property?
773773
value = p_SpecifiedPropertyValue; // yes - use value passed as parameter
774-
valueStr = boost::apply_visitor(FormatVariantValue(), value, fmtStr); // format value
775-
logRecord += valueStr + delimiter; // add value string to log record - with delimiter
774+
if (hdf5) { // yes - HDF5 file?
775+
logRecordValues.push_back(value); // yes - add value to vector of values
776+
}
777+
else { // no - CSV, TSV, or TXT file
778+
valueStr = boost::apply_visitor(FormatVariantValue(), value, fmtStr); // format value
779+
logRecord += valueStr + delimiter; // add value string to log record - with delimiter
780+
}
776781
}
777782
else { // use current value
778783
std::tie(ok, value) = p_Star->PropertyValue(property); // get property flag and value

src/Options.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,7 +2359,7 @@ std::vector<std::tuple<std::string, std::string, std::string, std::string, TYPEN
23592359
*/
23602360
void Options::PrintOptionHelp(const bool p_Verbose) {
23612361

2362-
std::cerr << "Options:" << std::endl;
2362+
std::cout << "Options:" << std::endl;
23632363

23642364
for (po::variables_map::const_iterator it = m_CmdLine.optionValues.m_VM.begin(); it != m_CmdLine.optionValues.m_VM.end(); it++) {
23652365

@@ -2371,12 +2371,12 @@ void Options::PrintOptionHelp(const bool p_Verbose) {
23712371
std::string optionShortName = opt.canonical_display_name(cls::allow_dash_for_short); // short name ('-') prefix
23722372
if (optionShortName[0] == '-') optionShortName.erase(0, optionShortName.find_first_not_of("-")); // remove the "-" or "--"
23732373

2374-
std::cerr << "--" << optionLongName;
2375-
if (optionLongName != optionShortName) std::cerr << " [ -" << optionShortName << " ]";
2376-
std::cerr << std::endl;
2374+
std::cout << "--" << optionLongName;
2375+
if (optionLongName != optionShortName) std::cout << " [ -" << optionShortName << " ]";
2376+
std::cout << std::endl;
23772377

23782378
if (p_Verbose) {
2379-
std::cerr << " " << opt.description() << std::endl;
2379+
std::cout << " " << opt.description() << std::endl;
23802380
}
23812381
}
23822382
}

src/changelog.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,12 @@
838838
// - Removed unused STARTRACK zeta prescription
839839
// 02.25.07 IM - Nov 12, 2021 - Defect repair:
840840
// - Changed EAGB::CalculateLuminosityOnPhase() and EAGB::CalculateLuminosityAtPhaseEnd() to use the helium core mass rather than the CO core mass (see Eq. in second paragraph of section 5.4 of Hurley+, 2000); this fixes a downward step in luminosity and radius on transition to EAGB
841+
// 02.25.08 JR - Nov 15, 2021 - Defect repair:
842+
// - Fixed error introduced in v02.25.00: Added HDF5 support to GetLogStandardRecord().
843+
// Defect introduced was omission of code for HDF5 file support if a specified property is supplied to GetLogStandardRecord(), causing a boost::bad_get error.
844+
// The defect only affected HDF5 SSE_Supernovae files. This fix adds the omitted code.
845+
// - Changed Options::PrintOptionHelp() to print help (-h/--h) to stdout instead of stderr.
841846

842-
const std::string VERSION_STRING = "02.25.07";
847+
const std::string VERSION_STRING = "02.25.08";
843848

844849
# endif // __changelog_h__

src/constants.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,8 +2755,8 @@ const std::map<PROGRAM_OPTION, PROPERTY_DETAILS> PROGRAM_OPTION_DETAIL = {
27552755

27562756
{ PROGRAM_OPTION::ADD_OPTIONS_TO_SYSPARMS, { TYPENAME::INT, "Add_Options_To_SysParms", "-", 4, 1 }},
27572757
{ PROGRAM_OPTION::ALLOW_MS_STAR_TO_SURVIVE_COMMON_ENVELOPE, { TYPENAME::BOOL, "Allow_MS_To_Survive_CE", "Flag", 0, 0 }},
2758-
{ PROGRAM_OPTION::ALLOW_RADIATIVE_ENVELOPE_STAR_TO_SURVIVE_COMMON_ENVELOPE, { TYPENAME::BOOL, "Allow_Radiative_Envelope_To_Survive_CE", "Flag", 0, 0 }},
2759-
{ PROGRAM_OPTION::ALLOW_IMMEDIATE_RLOF_POST_CE_TO_SURVIVE_COMMON_ENVELOPE, { TYPENAME::BOOL, "Allow_Immediate_RLOF>CE_To_Survive_CE", "Flag", 0, 0 }},
2758+
{ PROGRAM_OPTION::ALLOW_RADIATIVE_ENVELOPE_STAR_TO_SURVIVE_COMMON_ENVELOPE, { TYPENAME::BOOL, "Allow_Radiative_Envelope_To_Survive_CE", "Flag", 0, 0 }},
2759+
{ PROGRAM_OPTION::ALLOW_IMMEDIATE_RLOF_POST_CE_TO_SURVIVE_COMMON_ENVELOPE, { TYPENAME::BOOL, "Allow_Immediate_RLOF>CE_To_Survive_CE", "Flag", 0, 0 }},
27602760
{ PROGRAM_OPTION::ALLOW_RLOF_AT_BIRTH, { TYPENAME::BOOL, "Allow_RLOF@Birth", "Flag", 0, 0 }},
27612761
{ PROGRAM_OPTION::ALLOW_TOUCHING_AT_BIRTH, { TYPENAME::BOOL, "Allow_Touching@Birth", "Flag", 0, 0 }},
27622762
{ PROGRAM_OPTION::ANG_MOM_CONSERVATION_DURING_CIRCULARISATION, { TYPENAME::BOOL, "Conserve_AngMom@Circ", "Flag", 0, 0 }},

src/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,8 @@ std::tuple<int, int> EvolveBinaryStars() {
596596

597597
// close BSE logfiles
598598
// don't check result here - let log system handle it
599-
600599
(void)LOGGING->CloseAllStandardFiles();
601600

602-
603601
double cpuSeconds = (clock() - clockStart) / (double) CLOCKS_PER_SEC; // stop CPU timer and calculate seconds
604602

605603
auto wallEnd = std::chrono::system_clock::now(); // stop wall timer

0 commit comments

Comments
 (0)