Skip to content
22 changes: 22 additions & 0 deletions include/openmc/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,14 @@ class Mesh {
// Constructors and destructor
Mesh() = default;
Mesh(pugi::xml_node node);
Mesh(hid_t group);
virtual ~Mesh() = default;

// Factory method for creating meshes from either an XML node or HDF5 group
template<typename T>
static const std::unique_ptr<Mesh>& create(
T dataset, const std::string& mesh_type, const std::string& mesh_library);

// Methods
//! Perform any preparation needed to support point location within the mesh
virtual void prepare_for_point_location() {};
Expand Down Expand Up @@ -258,6 +264,7 @@ class StructuredMesh : public Mesh {
public:
StructuredMesh() = default;
StructuredMesh(pugi::xml_node node) : Mesh {node} {};
StructuredMesh(hid_t group) : Mesh {group} {};
virtual ~StructuredMesh() = default;

using MeshIndex = std::array<int, 3>;
Expand Down Expand Up @@ -423,6 +430,7 @@ class PeriodicStructuredMesh : public StructuredMesh {
public:
PeriodicStructuredMesh() = default;
PeriodicStructuredMesh(pugi::xml_node node) : StructuredMesh {node} {};
PeriodicStructuredMesh(hid_t group) : StructuredMesh {group} {};

Position local_coords(const Position& r) const override
{
Expand All @@ -442,6 +450,7 @@ class RegularMesh : public StructuredMesh {
// Constructors
RegularMesh() = default;
RegularMesh(pugi::xml_node node);
RegularMesh(hid_t group);

// Overridden methods
int get_index_in_direction(double r, int i) const override;
Expand Down Expand Up @@ -481,6 +490,8 @@ class RegularMesh : public StructuredMesh {
//! Return the volume for a given mesh index
double volume(const MeshIndex& ijk) const override;

int set_grid();

// Data members
double volume_frac_; //!< Volume fraction of each mesh element
double element_volume_; //!< Volume of each mesh element
Expand All @@ -492,6 +503,7 @@ class RectilinearMesh : public StructuredMesh {
// Constructors
RectilinearMesh() = default;
RectilinearMesh(pugi::xml_node node);
RectilinearMesh(hid_t group);

// Overridden methods
int get_index_in_direction(double r, int i) const override;
Expand Down Expand Up @@ -534,6 +546,7 @@ class CylindricalMesh : public PeriodicStructuredMesh {
// Constructors
CylindricalMesh() = default;
CylindricalMesh(pugi::xml_node node);
CylindricalMesh(hid_t group);

// Overridden methods
virtual MeshIndex get_indices(Position r, bool& in_mesh) const override;
Expand Down Expand Up @@ -598,6 +611,7 @@ class SphericalMesh : public PeriodicStructuredMesh {
// Constructors
SphericalMesh() = default;
SphericalMesh(pugi::xml_node node);
SphericalMesh(hid_t group);

// Overridden methods
virtual MeshIndex get_indices(Position r, bool& in_mesh) const override;
Expand Down Expand Up @@ -668,6 +682,7 @@ class UnstructuredMesh : public Mesh {
// Constructors
UnstructuredMesh() { n_dimension_ = 3; };
UnstructuredMesh(pugi::xml_node node);
UnstructuredMesh(hid_t group);

static const std::string mesh_type;
virtual std::string get_mesh_type() const override;
Expand Down Expand Up @@ -774,6 +789,7 @@ class MOABMesh : public UnstructuredMesh {
// Constructors
MOABMesh() = default;
MOABMesh(pugi::xml_node);
MOABMesh(hid_t group);
MOABMesh(const std::string& filename, double length_multiplier = 1.0);
MOABMesh(std::shared_ptr<moab::Interface> external_mbi);

Expand Down Expand Up @@ -943,6 +959,7 @@ class LibMesh : public UnstructuredMesh {
public:
// Constructors
LibMesh(pugi::xml_node node);
LibMesh(hid_t group);
LibMesh(const std::string& filename, double length_multiplier = 1.0);
LibMesh(libMesh::MeshBase& input_mesh, double length_multiplier = 1.0);

Expand Down Expand Up @@ -1069,6 +1086,11 @@ class AdaptiveLibMesh : public LibMesh {
//! \param[in] root XML node
void read_meshes(pugi::xml_node root);

//! Read meshes from an HDF5 file
//
//! \param[in] group HDF5 group ("meshes" group)
void read_meshes(hid_t group);

//! Write mesh data to an HDF5 group
//
//! \param[in] group HDF5 group
Expand Down
Loading
Loading