mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Reorder declarations in Tally, Filter, and Material classes
This commit is contained in:
parent
6e9c731b0c
commit
c68052da6b
4 changed files with 49 additions and 33 deletions
|
|
@ -36,6 +36,7 @@ extern std::unordered_map<int32_t, int32_t> material_map;
|
|||
class Material
|
||||
{
|
||||
public:
|
||||
//----------------------------------------------------------------------------
|
||||
// Types
|
||||
struct ThermalTable {
|
||||
int index_table; //!< Index of table in data::thermal_scatt
|
||||
|
|
@ -43,12 +44,15 @@ public:
|
|||
double fraction; //!< How often to use table
|
||||
};
|
||||
|
||||
// Constructors and destructors
|
||||
//----------------------------------------------------------------------------
|
||||
// Constructors, destructors, factory functions
|
||||
Material() {};
|
||||
explicit Material(pugi::xml_node material_node);
|
||||
~Material();
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Methods
|
||||
|
||||
void calculate_xs(Particle& p) const;
|
||||
|
||||
//! Assign thermal scattering tables to specific nuclides within the material
|
||||
|
|
@ -61,12 +65,25 @@ public:
|
|||
//! Finalize the material, assigning tables, normalize density, etc.
|
||||
void finalize();
|
||||
|
||||
//! Write material data to HDF5
|
||||
void to_hdf5(hid_t group) const;
|
||||
|
||||
//! Add nuclide to the material
|
||||
//
|
||||
//! \param[in] nuclide Name of the nuclide
|
||||
//! \param[in] density Density of the nuclide in [atom/b-cm]
|
||||
void add_nuclide(const std::string& nuclide, double density);
|
||||
|
||||
//! Set atom densities for the material
|
||||
//
|
||||
//! \param[in] name Name of each nuclide
|
||||
//! \param[in] density Density of each nuclide in [atom/b-cm]
|
||||
void set_densities(const std::vector<std::string>& name,
|
||||
const std::vector<double>& density);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Accessors
|
||||
|
||||
//! Get density in [atom/b-cm]
|
||||
//! \return Density in [atom/b-cm]
|
||||
double density() const { return density_; }
|
||||
|
|
@ -89,13 +106,6 @@ public:
|
|||
//! \return Densities in [atom/b-cm]
|
||||
gsl::span<const double> densities() const { return {atom_density_.data(), atom_density_.size()}; }
|
||||
|
||||
//! Set atom densities for the material
|
||||
//
|
||||
//! \param[in] name Name of each nuclide
|
||||
//! \param[in] density Density of each nuclide in [atom/b-cm]
|
||||
void set_densities(const std::vector<std::string>& name,
|
||||
const std::vector<double>& density);
|
||||
|
||||
//! Get ID of material
|
||||
//! \return ID of material
|
||||
int32_t id() const { return id_; }
|
||||
|
|
@ -113,9 +123,7 @@ public:
|
|||
//! \return Volume in [cm^3]
|
||||
double volume() const;
|
||||
|
||||
//! Write material data to HDF5
|
||||
void to_hdf5(hid_t group) const;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Data
|
||||
int32_t id_; //!< Unique ID
|
||||
std::string name_; //!< Name of material
|
||||
|
|
@ -146,6 +154,9 @@ public:
|
|||
std::unique_ptr<Bremsstrahlung> ttb_;
|
||||
|
||||
private:
|
||||
//----------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
//! Calculate the collision stopping power
|
||||
void collision_stopping_power(double* s_col, bool positron);
|
||||
|
||||
|
|
@ -158,7 +169,8 @@ private:
|
|||
void calculate_neutron_xs(Particle& p) const;
|
||||
void calculate_photon_xs(Particle& p) const;
|
||||
|
||||
// Data members
|
||||
//----------------------------------------------------------------------------
|
||||
// Private data members
|
||||
gsl::index index_;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -45,8 +45,11 @@ namespace openmc {
|
|||
class Filter
|
||||
{
|
||||
public:
|
||||
// Default constructor
|
||||
//----------------------------------------------------------------------------
|
||||
// Constructors, destructors, factory functions
|
||||
|
||||
Filter();
|
||||
virtual ~Filter();
|
||||
|
||||
//! Create a new tally filter
|
||||
//
|
||||
|
|
@ -62,13 +65,14 @@ public:
|
|||
//! \return Pointer to the new filter object
|
||||
static Filter* create(pugi::xml_node node);
|
||||
|
||||
virtual ~Filter();
|
||||
|
||||
virtual std::string type() const = 0;
|
||||
|
||||
//! Uses an XML input to fill the filter's data fields.
|
||||
virtual void from_xml(pugi::xml_node node) = 0;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Methods
|
||||
|
||||
virtual std::string type() const = 0;
|
||||
|
||||
//! Matches a tally event to a set of filter bins and weights.
|
||||
//!
|
||||
//! \param[out] match will contain the matching bins and corresponding
|
||||
|
|
@ -76,13 +80,6 @@ public:
|
|||
virtual void
|
||||
get_all_bins(const Particle* p, int estimator, FilterMatch& match) const = 0;
|
||||
|
||||
//! Assign a unique ID to the filter
|
||||
//! \param[in] Unique ID to assign. A value of -1 indicates that an ID should
|
||||
//! be automatically assigned
|
||||
void set_id(int32_t id);
|
||||
|
||||
gsl::index index() const { return index_; }
|
||||
|
||||
//! Writes data describing this filter to an HDF5 statepoint group.
|
||||
virtual void
|
||||
to_statepoint(hid_t filter_group) const
|
||||
|
|
@ -97,6 +94,19 @@ public:
|
|||
//! "Incoming Energy [0.625E-6, 20.0)".
|
||||
virtual std::string text_label(int bin) const = 0;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Accessors
|
||||
|
||||
//! Assign a unique ID to the filter
|
||||
//! \param[in] Unique ID to assign. A value of -1 indicates that an ID should
|
||||
//! be automatically assigned
|
||||
void set_id(int32_t id);
|
||||
|
||||
gsl::index index() const { return index_; }
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Data members
|
||||
|
||||
int32_t id_ {-1};
|
||||
|
||||
int n_bins_;
|
||||
|
|
|
|||
|
|
@ -23,13 +23,15 @@ namespace openmc {
|
|||
|
||||
class Tally {
|
||||
public:
|
||||
//----------------------------------------------------------------------------
|
||||
// Constructors, destructors, factory functions
|
||||
explicit Tally(int32_t id);
|
||||
explicit Tally(pugi::xml_node node);
|
||||
~Tally();
|
||||
static Tally* create(int32_t id = -1);
|
||||
|
||||
void init_from_xml(pugi::xml_node node);
|
||||
//----------------------------------------------------------------------------
|
||||
// Accessors
|
||||
|
||||
void set_id(int32_t id);
|
||||
|
||||
|
|
@ -43,9 +45,6 @@ public:
|
|||
|
||||
void set_nuclides(const std::vector<std::string>& nuclides);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Methods for getting and setting filter/stride data.
|
||||
|
||||
const std::vector<int32_t>& filters() const {return filters_;}
|
||||
|
||||
int32_t filters(int i) const {return filters_[i];}
|
||||
|
|
|
|||
|
|
@ -479,11 +479,6 @@ Tally::create(int32_t id)
|
|||
return model::tallies.back().get();
|
||||
}
|
||||
|
||||
void
|
||||
Tally::init_from_xml(pugi::xml_node node)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Tally::set_id(int32_t id)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue