mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Merge branch 'develop' into centre_for_cylinder_spherical_meshes
This commit is contained in:
commit
527f5f70aa
163 changed files with 14849 additions and 35970 deletions
|
|
@ -43,7 +43,7 @@ public:
|
|||
//! Sample a value from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled value
|
||||
double sample(uint64_t* seed) const;
|
||||
double sample(uint64_t* seed) const override;
|
||||
|
||||
// Properties
|
||||
const vector<double>& x() const { return x_; }
|
||||
|
|
@ -75,7 +75,7 @@ public:
|
|||
//! Sample a value from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled value
|
||||
double sample(uint64_t* seed) const;
|
||||
double sample(uint64_t* seed) const override;
|
||||
|
||||
double a() const { return a_; }
|
||||
double b() const { return b_; }
|
||||
|
|
@ -99,7 +99,7 @@ public:
|
|||
//! Sample a value from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled value
|
||||
double sample(uint64_t* seed) const;
|
||||
double sample(uint64_t* seed) const override;
|
||||
|
||||
double a() const { return std::pow(offset_, ninv_); }
|
||||
double b() const { return std::pow(offset_ + span_, ninv_); }
|
||||
|
|
@ -124,7 +124,7 @@ public:
|
|||
//! Sample a value from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled value
|
||||
double sample(uint64_t* seed) const;
|
||||
double sample(uint64_t* seed) const override;
|
||||
|
||||
double theta() const { return theta_; }
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ public:
|
|||
//! Sample a value from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled value
|
||||
double sample(uint64_t* seed) const;
|
||||
double sample(uint64_t* seed) const override;
|
||||
|
||||
double a() const { return a_; }
|
||||
double b() const { return b_; }
|
||||
|
|
@ -168,7 +168,7 @@ public:
|
|||
//! Sample a value from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled value
|
||||
double sample(uint64_t* seed) const;
|
||||
double sample(uint64_t* seed) const override;
|
||||
|
||||
double mean_value() const { return mean_value_; }
|
||||
double std_dev() const { return std_dev_; }
|
||||
|
|
@ -191,7 +191,7 @@ public:
|
|||
//! Sample a value from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled value
|
||||
double sample(uint64_t* seed) const;
|
||||
double sample(uint64_t* seed) const override;
|
||||
|
||||
// x property
|
||||
vector<double>& x() { return x_; }
|
||||
|
|
@ -225,7 +225,7 @@ public:
|
|||
//! Sample a value from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled value
|
||||
double sample(uint64_t* seed) const;
|
||||
double sample(uint64_t* seed) const override;
|
||||
|
||||
const vector<double>& x() const { return x_; }
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ public:
|
|||
//! Sample a value from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled value
|
||||
double sample(uint64_t* seed) const;
|
||||
double sample(uint64_t* seed) const override;
|
||||
|
||||
private:
|
||||
// Storrage for probability + distribution
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public:
|
|||
//! \param[in] E Incident particle energy in [eV]
|
||||
//! \param[inout] seed Pseudorandom number seed pointer
|
||||
//! \return Sampled energy in [eV]
|
||||
double sample(double E, uint64_t* seed) const;
|
||||
double sample(double E, uint64_t* seed) const override;
|
||||
|
||||
private:
|
||||
int primary_flag_; //!< Indicator of whether the photon is a primary or
|
||||
|
|
@ -58,7 +58,7 @@ public:
|
|||
//! \param[in] E Incident particle energy in [eV]
|
||||
//! \param[inout] seed Pseudorandom number seed pointer
|
||||
//! \return Sampled energy in [eV]
|
||||
double sample(double E, uint64_t* seed) const;
|
||||
double sample(double E, uint64_t* seed) const override;
|
||||
|
||||
private:
|
||||
double threshold_; //!< Energy threshold in lab, (A + 1)/A * |Q|
|
||||
|
|
@ -79,7 +79,7 @@ public:
|
|||
//! \param[in] E Incident particle energy in [eV]
|
||||
//! \param[inout] seed Pseudorandom number seed pointer
|
||||
//! \return Sampled energy in [eV]
|
||||
double sample(double E, uint64_t* seed) const;
|
||||
double sample(double E, uint64_t* seed) const override;
|
||||
|
||||
private:
|
||||
//! Outgoing energy for a single incoming energy
|
||||
|
|
@ -110,7 +110,7 @@ public:
|
|||
//! \param[in] E Incident particle energy in [eV]
|
||||
//! \param[inout] seed Pseudorandom number seed pointer
|
||||
//! \return Sampled energy in [eV]
|
||||
double sample(double E, uint64_t* seed) const;
|
||||
double sample(double E, uint64_t* seed) const override;
|
||||
|
||||
private:
|
||||
Tabulated1D theta_; //!< Incoming energy dependent parameter
|
||||
|
|
@ -130,7 +130,7 @@ public:
|
|||
//! \param[in] E Incident particle energy in [eV]
|
||||
//! \param[inout] seed Pseudorandom number seed pointer
|
||||
//! \return Sampled energy in [eV]
|
||||
double sample(double E, uint64_t* seed) const;
|
||||
double sample(double E, uint64_t* seed) const override;
|
||||
|
||||
private:
|
||||
Tabulated1D theta_; //!< Incoming energy dependent parameter
|
||||
|
|
@ -150,7 +150,7 @@ public:
|
|||
//! \param[in] E Incident particle energy in [eV]
|
||||
//! \param[inout] seed Pseudorandom number seed pointer
|
||||
//! \return Sampled energy in [eV]
|
||||
double sample(double E, uint64_t* seed) const;
|
||||
double sample(double E, uint64_t* seed) const override;
|
||||
|
||||
private:
|
||||
Tabulated1D a_; //!< Energy-dependent 'a' parameter
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
//! Sample a direction from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Direction sampled
|
||||
Direction sample(uint64_t* seed) const;
|
||||
Direction sample(uint64_t* seed) const override;
|
||||
|
||||
// Observing pointers
|
||||
Distribution* mu() const { return mu_.get(); }
|
||||
|
|
@ -66,7 +66,7 @@ public:
|
|||
//! Sample a direction from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled direction
|
||||
Direction sample(uint64_t* seed) const;
|
||||
Direction sample(uint64_t* seed) const override;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -82,7 +82,7 @@ public:
|
|||
//! Sample a direction from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled direction
|
||||
Direction sample(uint64_t* seed) const;
|
||||
Direction sample(uint64_t* seed) const override;
|
||||
};
|
||||
|
||||
using UPtrAngle = unique_ptr<UnitSphereDistribution>;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "pugixml.hpp"
|
||||
|
||||
#include "openmc/distribution.h"
|
||||
#include "openmc/mesh.h"
|
||||
#include "openmc/position.h"
|
||||
|
||||
namespace openmc {
|
||||
|
|
@ -31,7 +32,7 @@ public:
|
|||
//! Sample a position from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled position
|
||||
Position sample(uint64_t* seed) const;
|
||||
Position sample(uint64_t* seed) const override;
|
||||
|
||||
// Observer pointers
|
||||
Distribution* x() const { return x_.get(); }
|
||||
|
|
@ -55,7 +56,7 @@ public:
|
|||
//! Sample a position from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled position
|
||||
Position sample(uint64_t* seed) const;
|
||||
Position sample(uint64_t* seed) const override;
|
||||
|
||||
Distribution* r() const { return r_.get(); }
|
||||
Distribution* phi() const { return phi_.get(); }
|
||||
|
|
@ -80,7 +81,7 @@ public:
|
|||
//! Sample a position from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled position
|
||||
Position sample(uint64_t* seed) const;
|
||||
Position sample(uint64_t* seed) const override;
|
||||
|
||||
Distribution* r() const { return r_.get(); }
|
||||
Distribution* cos_theta() const { return cos_theta_.get(); }
|
||||
|
|
@ -94,6 +95,32 @@ private:
|
|||
Position origin_; //!< Cartesian coordinates of the sphere center
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
//! Distribution of points within a mesh
|
||||
//==============================================================================
|
||||
|
||||
class MeshSpatial : public SpatialDistribution {
|
||||
public:
|
||||
explicit MeshSpatial(pugi::xml_node node);
|
||||
|
||||
//! Sample a position from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled position
|
||||
Position sample(uint64_t* seed) const override;
|
||||
|
||||
const Mesh* mesh() const { return model::meshes.at(mesh_idx_).get(); }
|
||||
|
||||
int32_t n_sources() const { return this->mesh()->n_bins(); }
|
||||
|
||||
private:
|
||||
int32_t mesh_idx_ {C_NONE};
|
||||
double total_strength_ {0.0};
|
||||
// TODO: move to an independent class in the future that's similar
|
||||
// to a discrete distribution without outcomes
|
||||
std::vector<double> mesh_CDF_;
|
||||
std::vector<double> mesh_strengths_;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
//! Uniform distribution of points over a box
|
||||
//==============================================================================
|
||||
|
|
@ -105,7 +132,7 @@ public:
|
|||
//! Sample a position from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled position
|
||||
Position sample(uint64_t* seed) const;
|
||||
Position sample(uint64_t* seed) const override;
|
||||
|
||||
// Properties
|
||||
bool only_fissionable() const { return only_fissionable_; }
|
||||
|
|
@ -131,7 +158,7 @@ public:
|
|||
//! Sample a position from the distribution
|
||||
//! \param seed Pseudorandom number seed pointer
|
||||
//! \return Sampled position
|
||||
Position sample(uint64_t* seed) const;
|
||||
Position sample(uint64_t* seed) const override;
|
||||
|
||||
Position r() const { return r_; }
|
||||
|
||||
|
|
|
|||
|
|
@ -206,26 +206,28 @@ class RectLattice : public Lattice {
|
|||
public:
|
||||
explicit RectLattice(pugi::xml_node lat_node);
|
||||
|
||||
int32_t const& operator[](array<int, 3> const& i_xyz);
|
||||
int32_t const& operator[](array<int, 3> const& i_xyz) override;
|
||||
|
||||
bool are_valid_indices(array<int, 3> const& i_xyz) const;
|
||||
bool are_valid_indices(array<int, 3> const& i_xyz) const override;
|
||||
|
||||
std::pair<double, array<int, 3>> distance(
|
||||
Position r, Direction u, const array<int, 3>& i_xyz) const;
|
||||
Position r, Direction u, const array<int, 3>& i_xyz) const override;
|
||||
|
||||
void get_indices(Position r, Direction u, array<int, 3>& result) const;
|
||||
void get_indices(
|
||||
Position r, Direction u, array<int, 3>& result) const override;
|
||||
|
||||
int get_flat_index(const array<int, 3>& i_xyz) const;
|
||||
int get_flat_index(const array<int, 3>& i_xyz) const override;
|
||||
|
||||
Position get_local_position(Position r, const array<int, 3>& i_xyz) const;
|
||||
Position get_local_position(
|
||||
Position r, const array<int, 3>& i_xyz) const override;
|
||||
|
||||
int32_t& offset(int map, array<int, 3> const& i_xyz);
|
||||
int32_t& offset(int map, array<int, 3> const& i_xyz) override;
|
||||
|
||||
int32_t offset(int map, int indx) const;
|
||||
int32_t offset(int map, int indx) const override;
|
||||
|
||||
std::string index_to_string(int indx) const;
|
||||
std::string index_to_string(int indx) const override;
|
||||
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
|
||||
private:
|
||||
array<int, 3> n_cells_; //!< Number of cells along each axis
|
||||
|
|
@ -239,32 +241,34 @@ class HexLattice : public Lattice {
|
|||
public:
|
||||
explicit HexLattice(pugi::xml_node lat_node);
|
||||
|
||||
int32_t const& operator[](array<int, 3> const& i_xyz);
|
||||
int32_t const& operator[](array<int, 3> const& i_xyz) override;
|
||||
|
||||
LatticeIter begin();
|
||||
LatticeIter begin() override;
|
||||
|
||||
ReverseLatticeIter rbegin();
|
||||
ReverseLatticeIter rbegin() override;
|
||||
|
||||
bool are_valid_indices(array<int, 3> const& i_xyz) const;
|
||||
bool are_valid_indices(array<int, 3> const& i_xyz) const override;
|
||||
|
||||
std::pair<double, array<int, 3>> distance(
|
||||
Position r, Direction u, const array<int, 3>& i_xyz) const;
|
||||
Position r, Direction u, const array<int, 3>& i_xyz) const override;
|
||||
|
||||
void get_indices(Position r, Direction u, array<int, 3>& result) const;
|
||||
void get_indices(
|
||||
Position r, Direction u, array<int, 3>& result) const override;
|
||||
|
||||
int get_flat_index(const array<int, 3>& i_xyz) const;
|
||||
int get_flat_index(const array<int, 3>& i_xyz) const override;
|
||||
|
||||
Position get_local_position(Position r, const array<int, 3>& i_xyz) const;
|
||||
Position get_local_position(
|
||||
Position r, const array<int, 3>& i_xyz) const override;
|
||||
|
||||
bool is_valid_index(int indx) const;
|
||||
bool is_valid_index(int indx) const override;
|
||||
|
||||
int32_t& offset(int map, array<int, 3> const& i_xyz);
|
||||
int32_t& offset(int map, array<int, 3> const& i_xyz) override;
|
||||
|
||||
int32_t offset(int map, int indx) const;
|
||||
int32_t offset(int map, int indx) const override;
|
||||
|
||||
std::string index_to_string(int indx) const;
|
||||
std::string index_to_string(int indx) const override;
|
||||
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
|
||||
private:
|
||||
enum class Orientation {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
#include <unordered_map>
|
||||
|
||||
#include "hdf5.h"
|
||||
#include "xtensor/xtensor.hpp"
|
||||
#include "pugixml.hpp"
|
||||
#include "xtensor/xtensor.hpp"
|
||||
|
||||
#include "openmc/memory.h" // for unique_ptr
|
||||
#include "openmc/particle.h"
|
||||
|
|
@ -41,7 +41,7 @@ namespace openmc {
|
|||
// Constants
|
||||
//==============================================================================
|
||||
|
||||
enum class ElementType { UNSUPPORTED=-1, LINEAR_TET, LINEAR_HEX };
|
||||
enum class ElementType { UNSUPPORTED = -1, LINEAR_TET, LINEAR_HEX };
|
||||
|
||||
//==============================================================================
|
||||
// Global variables
|
||||
|
|
@ -81,6 +81,19 @@ public:
|
|||
//! Return a position in the local coordinates of the mesh
|
||||
virtual Position local_coords(const Position& r) const { return r; };
|
||||
|
||||
//! Sample a mesh volume using a certain seed
|
||||
//
|
||||
//! \param[in] seed Seed to use for random sampling
|
||||
//! \param[in] bin Bin value of the tet sampled
|
||||
//! \return sampled position within tet
|
||||
virtual Position sample(uint64_t* seed, int32_t bin) const = 0;
|
||||
|
||||
//! Get the volume of a mesh bin
|
||||
//
|
||||
//! \param[in] bin Bin to return the volume for
|
||||
//! \return Volume of the bin
|
||||
virtual double volume(int bin) const = 0;
|
||||
|
||||
//! Determine which bins were crossed by a particle
|
||||
//
|
||||
//! \param[in] r0 Previous position of the particle
|
||||
|
|
@ -166,7 +179,11 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
virtual int get_bin(Position r) const;
|
||||
Position sample(uint64_t* seed, int32_t bin) const override;
|
||||
|
||||
double volume(int bin) const override;
|
||||
|
||||
int get_bin(Position r) const override;
|
||||
|
||||
int n_bins() const override;
|
||||
|
||||
|
|
@ -484,6 +501,7 @@ public:
|
|||
virtual std::string get_mesh_type() const override;
|
||||
|
||||
// Overridden Methods
|
||||
|
||||
void surface_bins_crossed(Position r0, Position r1, const Direction& u,
|
||||
vector<int>& bins) const override;
|
||||
|
||||
|
|
@ -532,12 +550,6 @@ public:
|
|||
//! \return element connectivity as IDs of the vertices
|
||||
virtual std::vector<int> connectivity(int id) const = 0;
|
||||
|
||||
//! Get the volume of a mesh bin
|
||||
//
|
||||
//! \param[in] bin Bin to return the volume for
|
||||
//! \return Volume of the bin
|
||||
virtual double volume(int bin) const = 0;
|
||||
|
||||
//! Get the library used for this unstructured mesh
|
||||
virtual std::string library() const = 0;
|
||||
|
||||
|
|
@ -546,6 +558,8 @@ public:
|
|||
true}; //!< Write tallies onto the unstructured mesh at the end of a run
|
||||
std::string filename_; //!< Path to unstructured mesh file
|
||||
|
||||
ElementType element_type(int bin) const;
|
||||
|
||||
protected:
|
||||
//! Set the length multiplier to apply to each point in the mesh
|
||||
void set_length_multiplier(const double length_multiplier);
|
||||
|
|
@ -555,6 +569,14 @@ protected:
|
|||
1.0}; //!< Constant multiplication factor to apply to mesh coordinates
|
||||
bool specified_length_multiplier_ {false};
|
||||
|
||||
//! Sample barycentric coordinates given a seed and the vertex positions and
|
||||
//! return the sampled position
|
||||
//
|
||||
//! \param[in] coords Coordinates of the tetrahedron
|
||||
//! \param[in] seed Random number generation seed
|
||||
//! \return Sampled position within the tetrahedron
|
||||
Position sample_tet(std::array<Position, 4> coords, uint64_t* seed) const;
|
||||
|
||||
private:
|
||||
//! Setup method for the mesh. Builds data structures,
|
||||
//! sets up element mapping, creates bounding boxes, etc.
|
||||
|
|
@ -575,6 +597,8 @@ public:
|
|||
|
||||
// Overridden Methods
|
||||
|
||||
Position sample(uint64_t* seed, int32_t bin) const override;
|
||||
|
||||
void bins_crossed(Position r0, Position r1, const Direction& u,
|
||||
vector<int>& bins, vector<double>& lengths) const override;
|
||||
|
||||
|
|
@ -710,7 +734,7 @@ private:
|
|||
std::pair<moab::Tag, moab::Tag> get_score_tags(std::string score) const;
|
||||
|
||||
// Data members
|
||||
moab::Range ehs_; //!< Range of tetrahedra EntityHandle's in the mesh
|
||||
moab::Range ehs_; //!< Range of tetrahedra EntityHandle's in the mesh
|
||||
moab::Range verts_; //!< Range of vertex EntityHandle's in the mesh
|
||||
moab::EntityHandle tetset_; //!< EntitySet containing all tetrahedra
|
||||
moab::EntityHandle kdtree_root_; //!< Root of the MOAB KDTree
|
||||
|
|
@ -728,8 +752,8 @@ class LibMesh : public UnstructuredMesh {
|
|||
public:
|
||||
// Constructors
|
||||
LibMesh(pugi::xml_node node);
|
||||
LibMesh(const std::string & filename, double length_multiplier = 1.0);
|
||||
LibMesh(libMesh::MeshBase & input_mesh, double length_multiplier = 1.0);
|
||||
LibMesh(const std::string& filename, double length_multiplier = 1.0);
|
||||
LibMesh(libMesh::MeshBase& input_mesh, double length_multiplier = 1.0);
|
||||
|
||||
static const std::string mesh_lib_type;
|
||||
|
||||
|
|
@ -737,6 +761,8 @@ public:
|
|||
void bins_crossed(Position r0, Position r1, const Direction& u,
|
||||
vector<int>& bins, vector<double>& lengths) const override;
|
||||
|
||||
Position sample(uint64_t* seed, int32_t bin) const override;
|
||||
|
||||
int get_bin(Position r) const override;
|
||||
|
||||
int n_bins() const override;
|
||||
|
|
@ -782,8 +808,11 @@ private:
|
|||
int get_bin_from_element(const libMesh::Elem* elem) const;
|
||||
|
||||
// Data members
|
||||
unique_ptr<libMesh::MeshBase> unique_m_ = nullptr; //!< pointer to the libMesh MeshBase instance, only used if mesh is created inside OpenMC
|
||||
libMesh::MeshBase* m_; //!< pointer to libMesh MeshBase instance, always set during intialization
|
||||
unique_ptr<libMesh::MeshBase> unique_m_ =
|
||||
nullptr; //!< pointer to the libMesh MeshBase instance, only used if mesh is
|
||||
//!< created inside OpenMC
|
||||
libMesh::MeshBase* m_; //!< pointer to libMesh MeshBase instance, always set
|
||||
//!< during intialization
|
||||
vector<unique_ptr<libMesh::PointLocatorBase>>
|
||||
pl_; //!< per-thread point locators
|
||||
unique_ptr<libMesh::EquationSystems>
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ Direction sample_target_velocity(const Nuclide& nuc, double E, Direction u,
|
|||
Direction sample_cxs_target_velocity(
|
||||
double awr, double E, Direction u, double kT, uint64_t* seed);
|
||||
|
||||
void sample_fission_neutron(int i_nuclide, const Reaction& rx, double E_in,
|
||||
SourceSite* site, uint64_t* seed);
|
||||
void sample_fission_neutron(
|
||||
int i_nuclide, const Reaction& rx, SourceSite* site, Particle& p);
|
||||
|
||||
//! handles all reactions with a single secondary neutron (other than fission),
|
||||
//! i.e. level scattering, (n,np), (n,na), etc.
|
||||
|
|
|
|||
|
|
@ -137,22 +137,23 @@ protected:
|
|||
public:
|
||||
void init(const xt::xtensor<int, 1>& in_gmin,
|
||||
const xt::xtensor<int, 1>& in_gmax, const double_2dvec& in_mult,
|
||||
const double_3dvec& coeffs);
|
||||
const double_3dvec& coeffs) override;
|
||||
|
||||
void combine(
|
||||
const vector<ScattData*>& those_scatts, const vector<double>& scalars);
|
||||
void combine(const vector<ScattData*>& those_scatts,
|
||||
const vector<double>& scalars) override;
|
||||
|
||||
//! \brief Find the maximal value of the angular distribution to use as a
|
||||
// bounding box with rejection sampling.
|
||||
void update_max_val();
|
||||
|
||||
double calc_f(int gin, int gout, double mu);
|
||||
double calc_f(int gin, int gout, double mu) override;
|
||||
|
||||
void sample(int gin, int& gout, double& mu, double& wgt, uint64_t* seed);
|
||||
void sample(
|
||||
int gin, int& gout, double& mu, double& wgt, uint64_t* seed) override;
|
||||
|
||||
size_t get_order() { return dist[0][0].size() - 1; };
|
||||
size_t get_order() override { return dist[0][0].size() - 1; };
|
||||
|
||||
xt::xtensor<double, 3> get_matrix(size_t max_order);
|
||||
xt::xtensor<double, 3> get_matrix(size_t max_order) override;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -170,18 +171,19 @@ protected:
|
|||
public:
|
||||
void init(const xt::xtensor<int, 1>& in_gmin,
|
||||
const xt::xtensor<int, 1>& in_gmax, const double_2dvec& in_mult,
|
||||
const double_3dvec& coeffs);
|
||||
const double_3dvec& coeffs) override;
|
||||
|
||||
void combine(
|
||||
const vector<ScattData*>& those_scatts, const vector<double>& scalars);
|
||||
void combine(const vector<ScattData*>& those_scatts,
|
||||
const vector<double>& scalars) override;
|
||||
|
||||
double calc_f(int gin, int gout, double mu);
|
||||
double calc_f(int gin, int gout, double mu) override;
|
||||
|
||||
void sample(int gin, int& gout, double& mu, double& wgt, uint64_t* seed);
|
||||
void sample(
|
||||
int gin, int& gout, double& mu, double& wgt, uint64_t* seed) override;
|
||||
|
||||
size_t get_order() { return dist[0][0].size(); };
|
||||
size_t get_order() override { return dist[0][0].size(); };
|
||||
|
||||
xt::xtensor<double, 3> get_matrix(size_t max_order);
|
||||
xt::xtensor<double, 3> get_matrix(size_t max_order) override;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -204,18 +206,19 @@ protected:
|
|||
public:
|
||||
void init(const xt::xtensor<int, 1>& in_gmin,
|
||||
const xt::xtensor<int, 1>& in_gmax, const double_2dvec& in_mult,
|
||||
const double_3dvec& coeffs);
|
||||
const double_3dvec& coeffs) override;
|
||||
|
||||
void combine(
|
||||
const vector<ScattData*>& those_scatts, const vector<double>& scalars);
|
||||
void combine(const vector<ScattData*>& those_scatts,
|
||||
const vector<double>& scalars) override;
|
||||
|
||||
double calc_f(int gin, int gout, double mu);
|
||||
double calc_f(int gin, int gout, double mu) override;
|
||||
|
||||
void sample(int gin, int& gout, double& mu, double& wgt, uint64_t* seed);
|
||||
void sample(
|
||||
int gin, int& gout, double& mu, double& wgt, uint64_t* seed) override;
|
||||
|
||||
size_t get_order() { return dist[0][0].size(); };
|
||||
size_t get_order() override { return dist[0][0].size(); };
|
||||
|
||||
xt::xtensor<double, 3> get_matrix(size_t max_order);
|
||||
xt::xtensor<double, 3> get_matrix(size_t max_order) override;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -146,9 +146,6 @@ class CSGSurface : public Surface {
|
|||
public:
|
||||
explicit CSGSurface(pugi::xml_node surf_node);
|
||||
CSGSurface();
|
||||
|
||||
protected:
|
||||
virtual void to_hdf5_inner(hid_t group_id) const = 0;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -160,11 +157,11 @@ protected:
|
|||
class SurfaceXPlane : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceXPlane(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
BoundingBox bounding_box(bool pos_side) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
BoundingBox bounding_box(bool pos_side) const override;
|
||||
|
||||
double x0_;
|
||||
};
|
||||
|
|
@ -178,11 +175,11 @@ public:
|
|||
class SurfaceYPlane : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceYPlane(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
BoundingBox bounding_box(bool pos_side) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
BoundingBox bounding_box(bool pos_side) const override;
|
||||
|
||||
double y0_;
|
||||
};
|
||||
|
|
@ -196,11 +193,11 @@ public:
|
|||
class SurfaceZPlane : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceZPlane(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
BoundingBox bounding_box(bool pos_side) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
BoundingBox bounding_box(bool pos_side) const override;
|
||||
|
||||
double z0_;
|
||||
};
|
||||
|
|
@ -214,10 +211,10 @@ public:
|
|||
class SurfacePlane : public CSGSurface {
|
||||
public:
|
||||
explicit SurfacePlane(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
|
||||
double A_, B_, C_, D_;
|
||||
};
|
||||
|
|
@ -232,11 +229,11 @@ public:
|
|||
class SurfaceXCylinder : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceXCylinder(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
BoundingBox bounding_box(bool pos_side) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
BoundingBox bounding_box(bool pos_side) const override;
|
||||
|
||||
double y0_, z0_, radius_;
|
||||
};
|
||||
|
|
@ -251,11 +248,11 @@ public:
|
|||
class SurfaceYCylinder : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceYCylinder(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
BoundingBox bounding_box(bool pos_side) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
BoundingBox bounding_box(bool pos_side) const override;
|
||||
|
||||
double x0_, z0_, radius_;
|
||||
};
|
||||
|
|
@ -270,11 +267,11 @@ public:
|
|||
class SurfaceZCylinder : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceZCylinder(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
BoundingBox bounding_box(bool pos_side) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
BoundingBox bounding_box(bool pos_side) const override;
|
||||
|
||||
double x0_, y0_, radius_;
|
||||
};
|
||||
|
|
@ -289,11 +286,11 @@ public:
|
|||
class SurfaceSphere : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceSphere(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
BoundingBox bounding_box(bool pos_side) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
BoundingBox bounding_box(bool pos_side) const override;
|
||||
|
||||
double x0_, y0_, z0_, radius_;
|
||||
};
|
||||
|
|
@ -308,10 +305,10 @@ public:
|
|||
class SurfaceXCone : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceXCone(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
|
||||
double x0_, y0_, z0_, radius_sq_;
|
||||
};
|
||||
|
|
@ -326,10 +323,10 @@ public:
|
|||
class SurfaceYCone : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceYCone(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
|
||||
double x0_, y0_, z0_, radius_sq_;
|
||||
};
|
||||
|
|
@ -344,10 +341,10 @@ public:
|
|||
class SurfaceZCone : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceZCone(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
|
||||
double x0_, y0_, z0_, radius_sq_;
|
||||
};
|
||||
|
|
@ -362,10 +359,10 @@ public:
|
|||
class SurfaceQuadric : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceQuadric(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
|
||||
// Ax^2 + By^2 + Cz^2 + Dxy + Eyz + Fxz + Gx + Hy + Jz + K = 0
|
||||
double A_, B_, C_, D_, E_, F_, G_, H_, J_, K_;
|
||||
|
|
@ -380,10 +377,10 @@ public:
|
|||
class SurfaceXTorus : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceXTorus(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
|
||||
double x0_, y0_, z0_, A_, B_, C_;
|
||||
};
|
||||
|
|
@ -397,10 +394,10 @@ public:
|
|||
class SurfaceYTorus : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceYTorus(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
|
||||
double x0_, y0_, z0_, A_, B_, C_;
|
||||
};
|
||||
|
|
@ -414,10 +411,10 @@ public:
|
|||
class SurfaceZTorus : public CSGSurface {
|
||||
public:
|
||||
explicit SurfaceZTorus(pugi::xml_node surf_node);
|
||||
double evaluate(Position r) const;
|
||||
double distance(Position r, Direction u, bool coincident) const;
|
||||
Direction normal(Position r) const;
|
||||
void to_hdf5_inner(hid_t group_id) const;
|
||||
double evaluate(Position r) const override;
|
||||
double distance(Position r, Direction u, bool coincident) const override;
|
||||
Direction normal(Position r) const override;
|
||||
void to_hdf5_inner(hid_t group_id) const override;
|
||||
|
||||
double x0_, y0_, z0_, A_, B_, C_;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -157,5 +157,24 @@ extern vector<unique_ptr<Filter>> tally_filters;
|
|||
//! Make sure index corresponds to a valid filter
|
||||
int verify_filter(int32_t index);
|
||||
|
||||
//==============================================================================
|
||||
// Filter implementation
|
||||
//==============================================================================
|
||||
|
||||
template<typename T>
|
||||
T* Filter::create(int32_t id)
|
||||
{
|
||||
static_assert(std::is_base_of<Filter, T>::value,
|
||||
"Type specified is not derived from openmc::Filter");
|
||||
// Create filter and add to filters vector
|
||||
auto filter = make_unique<T>();
|
||||
auto ptr_out = filter.get();
|
||||
model::tally_filters.emplace_back(std::move(filter));
|
||||
// Assign ID
|
||||
model::tally_filters.back()->set_id(id);
|
||||
|
||||
return ptr_out;
|
||||
}
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_H
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ public:
|
|||
// Constructors
|
||||
VolumeCalculation(pugi::xml_node node);
|
||||
|
||||
VolumeCalculation() = default;
|
||||
|
||||
// Methods
|
||||
|
||||
//! \brief Stochastically determine the volume of a set of domains along with
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue