mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
A little more cleanup of volume calculations
This commit is contained in:
parent
9bce2c357b
commit
bd2d96568b
2 changed files with 39 additions and 28 deletions
|
|
@ -18,8 +18,6 @@ namespace openmc {
|
|||
class VolumeCalculation {
|
||||
public:
|
||||
// Aliases, types
|
||||
using int_2dvec = std::vector<std::vector<int>>;
|
||||
|
||||
struct Result {
|
||||
std::array<double, 2> volume; //!< Mean/standard deviation of volume
|
||||
std::vector<int> nuclides; //!< Index of nuclides
|
||||
|
|
@ -28,12 +26,21 @@ public:
|
|||
}; // Results for a single domain
|
||||
|
||||
// Constructors
|
||||
VolumeCalculation() = default;
|
||||
VolumeCalculation(pugi::xml_node node);
|
||||
|
||||
// Methods
|
||||
|
||||
//! \brief Stochastically determine the volume of a set of domains along with the
|
||||
//! average number densities of nuclides within the domain
|
||||
//
|
||||
//! \return Vector of results for each user-specified domain
|
||||
std::vector<Result> execute() const;
|
||||
void write_volume(const std::string& filename, const std::vector<Result>& results) const;
|
||||
|
||||
//! \brief Write volume calculation results to HDF5 file
|
||||
//
|
||||
//! \param[in] filename Path to HDF5 file to write
|
||||
//! \param[in] results Vector of results for each domain
|
||||
void to_hdf5(const std::string& filename, const std::vector<Result>& results) const;
|
||||
|
||||
// Data members
|
||||
int domain_type_; //!< Type of domain (cell, material, etc.)
|
||||
|
|
@ -43,8 +50,14 @@ public:
|
|||
std::vector<int> domain_ids_; //!< IDs of domains to find volumes of
|
||||
|
||||
private:
|
||||
void check_hit(int i_domain, int i_material, int_2dvec& indices,
|
||||
int_2dvec& hits) const;
|
||||
//! \brief Check whether a material has already been hit for a given domain.
|
||||
//! If not, add new entries to the vectors
|
||||
//
|
||||
//! \param[in] i_material Index in global materials vector
|
||||
//! \param[in,out] indices Vector of material indices
|
||||
//! \param[in,out] hits Number of hits corresponding to each material
|
||||
void check_hit(int i_material, std::vector<int>& indices,
|
||||
std::vector<int>& hits) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue