diff --git a/docs/source/io_formats/statepoint.rst b/docs/source/io_formats/statepoint.rst index 82d20a76302..fd00a3e7735 100644 --- a/docs/source/io_formats/statepoint.rst +++ b/docs/source/io_formats/statepoint.rst @@ -73,9 +73,9 @@ The current version of the statepoint file format is 18.1. **/tallies/meshes/mesh /** :Attributes: - **id** (*int*) -- ID of the mesh - - **type** (*char[]*) -- Type of mesh. :Datasets: - **name** (*char[]*) -- Name of the mesh. + - **type** (*char[]*) -- Type of mesh. - **dimension** (*int*) -- Number of mesh cells in each dimension. - **Regular Mesh Only:** - **lower_left** (*double[]*) -- Coordinates of lower-left corner of diff --git a/openmc/mesh.py b/openmc/mesh.py index 0b6f6b84e4b..e4d83d81d3d 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -99,7 +99,7 @@ def from_hdf5(cls, group: h5py.Group): Instance of a MeshBase subclass """ - mesh_type = 'regular' if 'type' not in group.attrs else group.attrs['type'].decode() + mesh_type = 'regular' if 'type' not in group.keys() else group['type'][()].decode() mesh_id = int(group.name.split('/')[-1].lstrip('mesh ')) mesh_name = '' if not 'name' in group else group['name'][()].decode() diff --git a/src/mesh.cpp b/src/mesh.cpp index 4b1878c5a2c..97bf710caa6 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -246,7 +246,7 @@ void Mesh::to_hdf5(hid_t group) const hid_t mesh_group = create_group(group, group_name.c_str()); // Write mesh type - write_attribute(mesh_group, "type", this->get_mesh_type()); + write_dataset(mesh_group, "type", this->get_mesh_type()); // Write mesh ID write_attribute(mesh_group, "id", id_); @@ -308,7 +308,6 @@ Position StructuredMesh::sample_element( UnstructuredMesh::UnstructuredMesh(pugi::xml_node node) : Mesh(node) { - // check the mesh type if (check_for_node(node, "type")) { auto temp = get_node_value(node, "type", true, true); @@ -970,7 +969,6 @@ std::pair, vector> RegularMesh::plot( void RegularMesh::to_hdf5_inner(hid_t mesh_group) const { - write_dataset(mesh_group, "type", "regular"); write_dataset(mesh_group, "dimension", get_x_shape()); write_dataset(mesh_group, "lower_left", lower_left_); write_dataset(mesh_group, "upper_right", upper_right_); @@ -1156,7 +1154,6 @@ std::pair, vector> RectilinearMesh::plot( void RectilinearMesh::to_hdf5_inner(hid_t mesh_group) const { - write_dataset(mesh_group, "type", "rectilinear"); write_dataset(mesh_group, "x_grid", grid_[0]); write_dataset(mesh_group, "y_grid", grid_[1]); write_dataset(mesh_group, "z_grid", grid_[2]); @@ -1431,7 +1428,6 @@ std::pair, vector> CylindricalMesh::plot( void CylindricalMesh::to_hdf5_inner(hid_t mesh_group) const { - write_dataset(mesh_group, "type", "cylindrical"); write_dataset(mesh_group, "r_grid", grid_[0]); write_dataset(mesh_group, "phi_grid", grid_[1]); write_dataset(mesh_group, "z_grid", grid_[2]); @@ -1743,7 +1739,6 @@ std::pair, vector> SphericalMesh::plot( void SphericalMesh::to_hdf5_inner(hid_t mesh_group) const { - write_dataset(mesh_group, "type", SphericalMesh::mesh_type); write_dataset(mesh_group, "r_grid", grid_[0]); write_dataset(mesh_group, "theta_grid", grid_[1]); write_dataset(mesh_group, "phi_grid", grid_[2]);