diff --git a/include/openmc/mesh.h b/include/openmc/mesh.h index 52f64701b..c690dc4fe 100644 --- a/include/openmc/mesh.h +++ b/include/openmc/mesh.h @@ -359,8 +359,7 @@ public: void to_hdf5(hid_t group) const override; array, 3> grid_; - array origin_; - + Position origin_; int set_grid(); @@ -415,7 +414,7 @@ public: void to_hdf5(hid_t group) const override; array, 3> grid_; - array origin_; + Position origin_; int set_grid(); diff --git a/include/openmc/xml_interface.h b/include/openmc/xml_interface.h index d96bb6cc2..bd6554c13 100644 --- a/include/openmc/xml_interface.h +++ b/include/openmc/xml_interface.h @@ -9,6 +9,7 @@ #include "xtensor/xadapt.hpp" #include "xtensor/xarray.hpp" +#include "openmc/position.h" #include "openmc/vector.h" namespace openmc { @@ -49,5 +50,8 @@ xt::xarray get_node_xarray( return xt::adapt(v, shape); } +Position get_node_position( + pugi::xml_node node, const char* name, bool lowercase = false); + } // namespace openmc #endif // OPENMC_XML_INTERFACE_H diff --git a/src/mesh.cpp b/src/mesh.cpp index 982b2e2dc..e9c185c8f 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -955,7 +955,7 @@ CylindricalMesh::CylindricalMesh(pugi::xml_node node) : StructuredMesh {node} grid_[0] = get_node_array(node, "r_grid"); grid_[1] = get_node_array(node, "phi_grid"); grid_[2] = get_node_array(node, "z_grid"); - origin_ = get_node_array(node, "origin"); + origin_ = get_node_position(node, "origin"); if (int err = set_grid()) { fatal_error(openmc_err_msg); @@ -1193,7 +1193,7 @@ SphericalMesh::SphericalMesh(pugi::xml_node node) : StructuredMesh {node} grid_[0] = get_node_array(node, "r_grid"); grid_[1] = get_node_array(node, "theta_grid"); grid_[2] = get_node_array(node, "phi_grid"); - origin_ = get_node_array(node, "origin"); + origin_ = get_node_position(node, "origin"); if (int err = set_grid()) { fatal_error(openmc_err_msg); diff --git a/src/xml_interface.cpp b/src/xml_interface.cpp index cf3b981e5..6ce465baf 100644 --- a/src/xml_interface.cpp +++ b/src/xml_interface.cpp @@ -48,4 +48,11 @@ bool get_node_value_bool(pugi::xml_node node, const char* name) return false; } +Position get_node_position( + pugi::xml_node node, const char* name, bool lowercase) +{ + vector arr = get_node_array(node, name, lowercase); + return Position(arr); +} + } // namespace openmc