mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Add the labeling to Mesh and its subclasses
This commit is contained in:
parent
aa24f27d4d
commit
b416a938b6
2 changed files with 39 additions and 0 deletions
|
|
@ -236,6 +236,12 @@ public:
|
|||
//! \param[in] bin Mesh bin to generate a label for
|
||||
virtual std::string bin_label(int bin) const = 0;
|
||||
|
||||
//! Axis names (per dimension) used when labeling surface tally bins
|
||||
virtual std::array<const char*, 3> axis_labels() const;
|
||||
|
||||
//! Build the surface component of a mesh surface tally bin label
|
||||
std::string surface_bin_label(int surf_index) const;
|
||||
|
||||
//! Get the volume of a mesh bin
|
||||
//
|
||||
//! \param[in] bin Bin to return the volume for
|
||||
|
|
@ -588,6 +594,8 @@ public:
|
|||
|
||||
static const std::string mesh_type;
|
||||
|
||||
std::array<const char*, 3> axis_labels() const override;
|
||||
|
||||
Position sample_element(const MeshIndex& ijk, uint64_t* seed) const override;
|
||||
|
||||
MeshDistance distance_to_grid_boundary(const MeshIndex& ijk, int i,
|
||||
|
|
@ -653,6 +661,8 @@ public:
|
|||
|
||||
static const std::string mesh_type;
|
||||
|
||||
std::array<const char*, 3> axis_labels() const override;
|
||||
|
||||
Position sample_element(const MeshIndex& ijk, uint64_t* seed) const override;
|
||||
|
||||
MeshDistance distance_to_grid_boundary(const MeshIndex& ijk, int i,
|
||||
|
|
|
|||
29
src/mesh.cpp
29
src/mesh.cpp
|
|
@ -430,6 +430,25 @@ vector<double> Mesh::volumes() const
|
|||
return volumes;
|
||||
}
|
||||
|
||||
//! Default (Cartesian) axis labels used for surface bin labels.
|
||||
std::array<const char*, 3> Mesh::axis_labels() const
|
||||
{
|
||||
return {"x", "y", "z"};
|
||||
}
|
||||
|
||||
//! Build the surface component of a mesh surface tally bin label.
|
||||
//! surf_index: 0=out/min, 1=in/min, 2=out/max, 3=in/max
|
||||
std::string Mesh::surface_bin_label(int surf_index) const
|
||||
{
|
||||
auto labels = this->axis_labels();
|
||||
int dim = surf_index / 4;
|
||||
int code = surf_index % 4;
|
||||
bool incoming = (code == 1) || (code == 3);
|
||||
bool max = (code == 2) || (code == 3);
|
||||
return fmt::format(" {}, {}-{}", incoming ? "Incoming" : "Outgoing",
|
||||
labels[dim], max ? "max" : "min");
|
||||
}
|
||||
|
||||
void Mesh::material_volumes(int nx, int ny, int nz, int table_size,
|
||||
int32_t* materials, double* volumes) const
|
||||
{
|
||||
|
|
@ -1815,6 +1834,11 @@ std::string CylindricalMesh::get_mesh_type() const
|
|||
return mesh_type;
|
||||
}
|
||||
|
||||
std::array<const char*, 3> CylindricalMesh::axis_labels() const
|
||||
{
|
||||
return {"r", "phi", "z"};
|
||||
}
|
||||
|
||||
StructuredMesh::MeshIndex CylindricalMesh::get_indices(
|
||||
Position r, bool& in_mesh) const
|
||||
{
|
||||
|
|
@ -2108,6 +2132,11 @@ std::string SphericalMesh::get_mesh_type() const
|
|||
return mesh_type;
|
||||
}
|
||||
|
||||
std::array<const char*, 3> SphericalMesh::axis_labels() const
|
||||
{
|
||||
return {"r", "theta", "phi"};
|
||||
}
|
||||
|
||||
StructuredMesh::MeshIndex SphericalMesh::get_indices(
|
||||
Position r, bool& in_mesh) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue