diff --git a/src/mgxs_interface.cpp b/src/mgxs_interface.cpp index 936eeb31f..7ad07d0c9 100644 --- a/src/mgxs_interface.cpp +++ b/src/mgxs_interface.cpp @@ -3,6 +3,8 @@ #include #include +#include + #include "openmc/cell.h" #include "openmc/cross_sections.h" #include "openmc/container_util.h" @@ -57,8 +59,7 @@ void MgxsInterface::init() // Check if MGXS Library exists if (!file_exists(cross_sections_path_)) { // Could not find MGXS Library file - fatal_error("Cross sections HDF5 file '" + cross_sections_path_ + - "' does not exist."); + fatal_error(fmt::format("Cross sections HDF5 file '{}' does not exist!", cross_sections_path_)); } write_message("Loading cross section data...", 5); @@ -98,15 +99,14 @@ void MgxsInterface::add_mgxs(hid_t file_id, const std::string& name, const std::vector& temperature) { - write_message("Loading " + std::string(name) + " data...", 6); + write_message(fmt::format("Loading {} data...", name), 6); // Check to make sure cross section set exists in the library hid_t xs_grp; if (object_exists(file_id, name.c_str())) { xs_grp = open_group(file_id, name.c_str()); } else { - fatal_error("Data for " + std::string(name) + " does not exist in " - + "provided MGXS Library"); + fatal_error(fmt::format("Data for {} does not exist in provided MGXS Library", name)); } nuclides_.emplace_back(xs_grp, temperature, num_energy_groups_, @@ -187,8 +187,7 @@ void MgxsInterface::read_header(const std::string& path_cross_sections) // Check if MGXS Library exists if (!file_exists(cross_sections_path_)) { // Could not find MGXS Library file - fatal_error("Cross sections HDF5 file '" + cross_sections_path_ + - "' does not exist."); + fatal_error(fmt::format("Cross section HDF5 file '{}' does not exist", cross_sections_path_)); } write_message("Reading cross sections HDF5 file...", 5); diff --git a/src/particle.cpp b/src/particle.cpp index ae75d91b4..3916eacba 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -410,7 +410,7 @@ Particle::cross_surface() // TODO: off-by-one const auto& surf {model::surfaces[i_surface - 1].get()}; if (settings::verbosity >= 10 || trace_) { - write_message(" Crossing surface " + std::to_string(surf->id_)); + write_message(fmt::format(" Crossing surface {}", surf->id_)); } if (surf->bc_ == Surface::BoundaryType::VACUUM && (settings::run_mode != RunMode::PLOTTING)) { @@ -437,7 +437,7 @@ Particle::cross_surface() // Display message if (settings::verbosity >= 10 || trace_) { - write_message(" Leaked out of surface " + std::to_string(surf->id_)); + write_message(fmt::format(" Leaked out of surface {}", surf->id_)); } return; @@ -502,7 +502,7 @@ Particle::cross_surface() // Diagnostic message if (settings::verbosity >= 10 || trace_) { - write_message(" Reflected from surface " + std::to_string(surf->id_)); + write_message(fmt::format(" Reflected from surface {}", surf->id_)); } return; @@ -556,8 +556,8 @@ Particle::cross_surface() // Diagnostic message if (settings::verbosity >= 10 || trace_) { - write_message(" Hit periodic boundary on surface " + - std::to_string(surf->id_)); + write_message(fmt::format(" Hit periodic boundary on surface {}", + surf->id_)); } return; } diff --git a/src/plot.cpp b/src/plot.cpp index e2fe5abde..267810712 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -114,7 +114,7 @@ void read_plots_xml() // Check if plots.xml exists std::string filename = settings::path_input + "plots.xml"; if (!file_exists(filename)) { - fatal_error("Plots XML file '" + filename + "' does not exist!"); + fatal_error(fmt::format("Plots XML file '{}' does not exist!", filename)); } write_message("Reading plot XML file...", 5); diff --git a/src/simulation.cpp b/src/simulation.cpp index 1b39c1329..92cee64cd 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -33,6 +33,8 @@ #include #endif +#include + #include #include #include @@ -500,7 +502,7 @@ void initialize_history(Particle& p, int64_t index_source) // Display message if high verbosity or trace is on if (settings::verbosity >= 9 || p.trace_) { - write_message("Simulating Particle " + std::to_string(p.id_)); + write_message(fmt::format("Simulating Particle {}", p.id_)); } // Add paricle's starting weight to count for normalizing tallies later