Correcting doc scope and some reads

This commit is contained in:
Patrick Shriwise 2022-11-03 20:43:29 -05:00
parent 040965245d
commit cdd2a6b1ca
2 changed files with 8 additions and 4 deletions

View file

@ -298,14 +298,14 @@ void read_input_xml()
std::string model_filename = settings::path_input + "model.xml";
bool use_model_file = file_exists(model_filename);
pugi::xml_node model_root;
pugi::xml_document doc;
if (use_model_file) {
write_message("Found model.xml file.");
pugi::xml_document doc;
write_message("Reading model.xml...");
auto result = doc.load_file(model_filename.c_str());
if (!result) {
fatal_error("Error processing model.xml file.");
}
auto model_root = doc.document_element();
model_root = doc.document_element();
auto other_inputs = {"materials.xml", "geometry.xml", "settings.xml", "tallies.xml", "plots.xml"};
for (const auto& input : other_inputs) {
@ -320,12 +320,14 @@ void read_input_xml()
if (!check_for_node(model_root, "settings")) {
fatal_error("No <settings> node present in the model.xml file.");
}
read_settings_xml(model_root.child("settings"));
auto settings_root = model_root.child("settings");
read_settings_xml();
} else {
read_settings_xml();
}
read_cross_sections_xml();
if (use_model_file) {
if (!check_for_node(model_root, "materials")) {
fatal_error("No <materials> node present in the model.xml file.");

View file

@ -266,6 +266,7 @@ void read_settings_xml(pugi::xml_node root)
// Find if a multi-group or continuous-energy simulation is desired
if (check_for_node(root, "energy_mode")) {
std::cout << "Here" << std::endl;
std::string temp_str = get_node_value(root, "energy_mode", true, true);
if (temp_str == "mg" || temp_str == "multi-group") {
run_CE = false;
@ -273,6 +274,7 @@ void read_settings_xml(pugi::xml_node root)
run_CE = true;
}
}
std::cout << "Here" << std::endl;
// Look for deprecated cross_sections.xml file in settings.xml
if (check_for_node(root, "cross_sections")) {