diff --git a/src/dagmc/dagmcmetadata.cpp b/src/dagmc/dagmcmetadata.cpp index 081328d60..e46489bc7 100644 --- a/src/dagmc/dagmcmetadata.cpp +++ b/src/dagmc/dagmcmetadata.cpp @@ -210,8 +210,8 @@ void dagmcMetaData::parse_material_data() { // set the material value volume_material_property_data_eh[eh] = grp_name; logger.message("Group name -- " + grp_name); - bool is_graveyard = to_lower(grp_name) == to_lower(graveyard_mat_str()); - bool is_vacuum = to_lower(grp_name) == to_lower(vacuum_mat_str()); + bool is_graveyard = dagmc_util::to_lower(grp_name) == dagmc_util::to_lower(graveyard_mat_str()); + bool is_vacuum = dagmc_util::to_lower(grp_name) == dagmc_util::to_lower(vacuum_mat_str()); // not graveyard or vacuum or implicit compliment if (!is_graveyard && !is_vacuum && !DAG->is_implicit_complement(eh)) { @@ -345,11 +345,6 @@ void dagmcMetaData::parse_tally_volume_data() { } } -std::string dagmcMetaData::to_lower(std::string input) { - dagmc_util::lowercase_str(input); - return input; -} - // parse the boundary data void dagmcMetaData::parse_boundary_data() { auto boundary_assignments = get_property_assignments("boundary", 2, ":"); @@ -379,15 +374,15 @@ void dagmcMetaData::parse_boundary_data() { // 2d entities have been tagged with the boundary condition property // ie. both surfaces and its member triangles - std::string bc_string = to_lower(boundary_assignment[0]); + std::string bc_string = dagmc_util::to_lower(boundary_assignment[0]); - if (bc_string.find(to_lower(reflecting_str())) != std::string::npos) + if (bc_string.find(dagmc_util::to_lower(reflecting_str())) != std::string::npos) surface_boundary_data_eh[eh] = reflecting_str(); - if (bc_string.find(to_lower(white_str())) != std::string::npos) + if (bc_string.find(dagmc_util::to_lower(white_str())) != std::string::npos) surface_boundary_data_eh[eh] = white_str(); - if (bc_string.find(to_lower(periodic_str())) != std::string::npos) + if (bc_string.find(dagmc_util::to_lower(periodic_str())) != std::string::npos) surface_boundary_data_eh[eh] = periodic_str(); - if (bc_string.find(to_lower(vacuum_str())) != std::string::npos) + if (bc_string.find(dagmc_util::to_lower(vacuum_str())) != std::string::npos) surface_boundary_data_eh[eh] = vacuum_str(); } } diff --git a/src/dagmc/dagmcmetadata.hpp b/src/dagmc/dagmcmetadata.hpp index d3a940f3f..405c060af 100644 --- a/src/dagmc/dagmcmetadata.hpp +++ b/src/dagmc/dagmcmetadata.hpp @@ -250,8 +250,6 @@ class dagmcMetaData { */ std::set set_remove_rich(std::set properties_set); - std::string to_lower(const std::string input); - // public member variables public: /** diff --git a/src/dagmc/util.hpp b/src/dagmc/util.hpp index 9a8b64c0e..639f7c542 100644 --- a/src/dagmc/util.hpp +++ b/src/dagmc/util.hpp @@ -10,5 +10,10 @@ inline void lowercase_str(std::string& input) { [](unsigned char c) { return std::tolower(c); }); } +inline std::string to_lower(std::string input) { + lowercase_str(input); + return input; +} + } // namespace dagmc_util #endif \ No newline at end of file diff --git a/src/mcnp/mcnp_funcs.cpp b/src/mcnp/mcnp_funcs.cpp index 1001c6e78..c80f7707b 100644 --- a/src/mcnp/mcnp_funcs.cpp +++ b/src/mcnp/mcnp_funcs.cpp @@ -201,8 +201,8 @@ void write_cell_cards(std::ostringstream& lcadfile, // that material numbers are assigned mat_num = DMD->volume_material_data_eh[entity]; // if we cant make an int from the mat_num - if (DMD->to_lower(mat_num) != DMD->to_lower(DMD->graveyard_mat_str()) && - DMD->to_lower(mat_num) != DMD->to_lower(DMD->vacuum_mat_str())) { + if (dagmc_util::to_lower(mat_num) != dagmc_util::to_lower(DMD->graveyard_mat_str()) && + dagmc_util::to_lower(mat_num) != dagmc_util::to_lower(DMD->vacuum_mat_str())) { if (!DMD->try_to_make_int(mat_num)) { std::cerr << "Failed to cast material number to an integer" << std::endl; @@ -225,8 +225,8 @@ void write_cell_cards(std::ostringstream& lcadfile, } else { std::string mat_name = DMD->volume_material_property_data_eh[entity]; // if we not vacuum or graveyard - if (DMD->to_lower(mat_num) != DMD->to_lower(DMD->graveyard_mat_str()) && - DMD->to_lower(mat_num) != DMD->to_lower(DMD->vacuum_mat_str())) { + if (dagmc_util::to_lower(mat_num) != dagmc_util::to_lower(DMD->graveyard_mat_str()) && + dagmc_util::to_lower(mat_num) != dagmc_util::to_lower(DMD->vacuum_mat_str())) { if (workflow_data->material_library.count(mat_name) == 0) { std::cerr << "Material with name " << mat_name << " not found " << std::endl; @@ -267,10 +267,10 @@ void write_cell_cards(std::ostringstream& lcadfile, } double imp = 1.0; // if we find graveyard always have importance 0.0 - if (DMD->to_lower(mat_nanme) == DMD->to_lower(DMD->graveyard_mat_str()) { + if (dagmc_util::to_lower(mat_nanme) == dagmc_util::to_lower(DMD->graveyard_mat_str()) { imp = 0.0; // no splitting can happenin vacuum set to 1 - } else if (DMD->to_lower(mat_nanme) == DMD->to_lower(DMD->vacuum_mat_str())) { + } else if (dagmc_util::to_lower(mat_nanme) == dagmc_util::to_lower(DMD->vacuum_mat_str())) { imp = 1.0; // otherwise as the map says } else { @@ -280,7 +280,7 @@ void write_cell_cards(std::ostringstream& lcadfile, } // its possible no importances were assigned if (set.size() == 0) { - if (DMD->to_lower(mat_nanme) != DMD->to_lower(DMD->graveyard_mat_str()) { + if (dagmc_util::to_lower(mat_nanme) != dagmc_util::to_lower(DMD->graveyard_mat_str()) { importances = "imp:n=1"; } else { importances = "imp:n=0"; @@ -288,7 +288,7 @@ void write_cell_cards(std::ostringstream& lcadfile, } // add descriptive comments for special volumes - if (DMD->to_lower(mat_nanme) == DMD->to_lower(DMD->graveyard_mat_str()) { + if (dagmc_util::to_lower(mat_nanme) == dagmc_util::to_lower(DMD->graveyard_mat_str()) { importances += " $ graveyard"; } else if (DAG->is_implicit_complement(entity)) { importances += " $ implicit complement";