Adding get_child_nodes function to C++ xml_interface.

This commit is contained in:
Patrick Shriwise 2018-10-10 09:33:29 -05:00
parent 7b93499d11
commit 2bffc33452
2 changed files with 23 additions and 0 deletions

View file

@ -50,5 +50,12 @@ xt::xarray<T> get_node_xarray(pugi::xml_node node, const char* name,
return xt::adapt(v, shape);
}
//===============================================================================
// GET_NODE_LIST is used to get a pointer to a list of sub-element nodes
//===============================================================================
std::vector<pugi::xml_node>
get_child_nodes(pugi::xml_node node, const char* name);
} // namespace openmc
#endif // OPENMC_XML_INTERFACE_H

View file

@ -56,4 +56,20 @@ get_node_value_bool(pugi::xml_node node, const char* name)
return false;
}
std::vector<pugi::xml_node>
get_child_nodes(pugi::xml_node node, const char* name)
{
pugi::xml_node current;
std::vector<pugi::xml_node> node_list;
for (pugi::xml_node current : node.children(name)) {
node_list.push_back(current);
}
return node_list;
}
} // namespace openmc