Skip to content

Commit 3329b41

Browse files
committed
load mesh objects from HDF5 file
1 parent 50071aa commit 3329b41

File tree

4 files changed

+277
-5
lines changed

4 files changed

+277
-5
lines changed

include/openmc/mesh.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class Mesh {
132132
// Constructors and destructor
133133
Mesh() = default;
134134
Mesh(pugi::xml_node node);
135+
Mesh(hid_t group);
135136
virtual ~Mesh() = default;
136137

137138
// Methods
@@ -258,6 +259,7 @@ class StructuredMesh : public Mesh {
258259
public:
259260
StructuredMesh() = default;
260261
StructuredMesh(pugi::xml_node node) : Mesh {node} {};
262+
StructuredMesh(hid_t group) : Mesh {group} {};
261263
virtual ~StructuredMesh() = default;
262264

263265
using MeshIndex = std::array<int, 3>;
@@ -423,6 +425,7 @@ class PeriodicStructuredMesh : public StructuredMesh {
423425
public:
424426
PeriodicStructuredMesh() = default;
425427
PeriodicStructuredMesh(pugi::xml_node node) : StructuredMesh {node} {};
428+
PeriodicStructuredMesh(hid_t group) : StructuredMesh {group} {};
426429

427430
Position local_coords(const Position& r) const override
428431
{
@@ -442,6 +445,7 @@ class RegularMesh : public StructuredMesh {
442445
// Constructors
443446
RegularMesh() = default;
444447
RegularMesh(pugi::xml_node node);
448+
RegularMesh(hid_t group);
445449

446450
// Overridden methods
447451
int get_index_in_direction(double r, int i) const override;
@@ -492,6 +496,7 @@ class RectilinearMesh : public StructuredMesh {
492496
// Constructors
493497
RectilinearMesh() = default;
494498
RectilinearMesh(pugi::xml_node node);
499+
RectilinearMesh(hid_t group);
495500

496501
// Overridden methods
497502
int get_index_in_direction(double r, int i) const override;
@@ -534,6 +539,7 @@ class CylindricalMesh : public PeriodicStructuredMesh {
534539
// Constructors
535540
CylindricalMesh() = default;
536541
CylindricalMesh(pugi::xml_node node);
542+
CylindricalMesh(hid_t group);
537543

538544
// Overridden methods
539545
virtual MeshIndex get_indices(Position r, bool& in_mesh) const override;
@@ -598,6 +604,7 @@ class SphericalMesh : public PeriodicStructuredMesh {
598604
// Constructors
599605
SphericalMesh() = default;
600606
SphericalMesh(pugi::xml_node node);
607+
SphericalMesh(hid_t group);
601608

602609
// Overridden methods
603610
virtual MeshIndex get_indices(Position r, bool& in_mesh) const override;
@@ -668,6 +675,7 @@ class UnstructuredMesh : public Mesh {
668675
// Constructors
669676
UnstructuredMesh() { n_dimension_ = 3; };
670677
UnstructuredMesh(pugi::xml_node node);
678+
UnstructuredMesh(hid_t group);
671679

672680
static const std::string mesh_type;
673681
virtual std::string get_mesh_type() const override;
@@ -774,6 +782,7 @@ class MOABMesh : public UnstructuredMesh {
774782
// Constructors
775783
MOABMesh() = default;
776784
MOABMesh(pugi::xml_node);
785+
MOABMesh(hid_t group);
777786
MOABMesh(const std::string& filename, double length_multiplier = 1.0);
778787
MOABMesh(std::shared_ptr<moab::Interface> external_mbi);
779788

@@ -943,6 +952,7 @@ class LibMesh : public UnstructuredMesh {
943952
public:
944953
// Constructors
945954
LibMesh(pugi::xml_node node);
955+
LibMesh(hid_t group);
946956
LibMesh(const std::string& filename, double length_multiplier = 1.0);
947957
LibMesh(libMesh::MeshBase& input_mesh, double length_multiplier = 1.0);
948958

@@ -1069,6 +1079,13 @@ class AdaptiveLibMesh : public LibMesh {
10691079
//! \param[in] root XML node
10701080
void read_meshes(pugi::xml_node root);
10711081

1082+
//! Read meshes from a HDF5 file
1083+
//
1084+
//! \param[in] group HDF5 group
1085+
//! \param[out] mesh_map mapping from mesh ids inside HDF5 group to global mesh
1086+
//! ids
1087+
void read_meshes(hid_t group, std::unordered_map<int32_t, int32_t>& mesh_map);
1088+
10721089
//! Write mesh data to an HDF5 group
10731090
//
10741091
//! \param[in] group HDF5 group

include/openmc/weight_windows.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ class WeightWindows {
8787
WeightWindows(pugi::xml_node node);
8888
~WeightWindows();
8989
static WeightWindows* create(int32_t id = -1);
90-
static WeightWindows* from_hdf5(
91-
hid_t wws_group, const std::string& group_name);
90+
static WeightWindows* from_hdf5(hid_t wws_group,
91+
const std::string& group_name,
92+
std::unordered_map<int32_t, int32_t>& id_map);
9293

9394
//----------------------------------------------------------------------------
9495
// Methods

0 commit comments

Comments
 (0)