mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Merge branch 'develop' into cpp-init-finalize
This commit is contained in:
commit
b2eba58946
99 changed files with 3420 additions and 3137 deletions
|
|
@ -136,7 +136,6 @@ extern "C" {
|
|||
// Global variables
|
||||
extern char openmc_err_msg[256];
|
||||
extern int32_t n_cells;
|
||||
extern int32_t n_filters;
|
||||
extern int32_t n_lattices;
|
||||
extern int32_t n_materials;
|
||||
extern int n_nuclides;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ constexpr int MAX_SAMPLE {100000};
|
|||
|
||||
// Maximum number of words in a single line, length of line, and length of
|
||||
// single word
|
||||
constexpr int MAX_LINE_LEN {250};
|
||||
constexpr int MAX_WORD_LEN {150};
|
||||
|
||||
// Maximum number of external source spatial resamples to encounter before an
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#define OPENMC_GEOMETRY_AUX_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace openmc {
|
||||
|
|
@ -26,7 +27,7 @@ extern "C" void assign_temperatures();
|
|||
//!
|
||||
//! This function looks for a universe that is not listed in a Cell::fill or in
|
||||
//! a Lattice.
|
||||
//! @return The index of the root universe.
|
||||
//! \return The index of the root universe.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" int32_t find_root_universe();
|
||||
|
|
@ -41,14 +42,14 @@ extern "C" void neighbor_lists();
|
|||
//! Populate all data structures needed for distribcells.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" void prepare_distribcell(int32_t* filter_cell_list, int n);
|
||||
extern "C" void prepare_distribcell();
|
||||
|
||||
//==============================================================================
|
||||
//! Recursively search through the geometry and count cell instances.
|
||||
//!
|
||||
//! This function will update the Cell::n_instances value for each cell in the
|
||||
//! geometry.
|
||||
//! @param univ_indx The index of the universe to begin searching from (probably
|
||||
//! \param univ_indx The index of the universe to begin searching from (probably
|
||||
//! the root universe).
|
||||
//==============================================================================
|
||||
|
||||
|
|
@ -56,51 +57,33 @@ extern "C" void count_cell_instances(int32_t univ_indx);
|
|||
|
||||
//==============================================================================
|
||||
//! Recursively search through universes and count universe instances.
|
||||
//! @param search_univ The index of the universe to begin searching from.
|
||||
//! @param target_univ_id The ID of the universe to be counted.
|
||||
//! @return The number of instances of target_univ_id in the geometry tree under
|
||||
//! \param search_univ The index of the universe to begin searching from.
|
||||
//! \param target_univ_id The ID of the universe to be counted.
|
||||
//! \return The number of instances of target_univ_id in the geometry tree under
|
||||
//! search_univ.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" int
|
||||
count_universe_instances(int32_t search_univ, int32_t target_univ_id);
|
||||
|
||||
//==============================================================================
|
||||
//! Find the length necessary for a string to contain a distribcell path.
|
||||
//! @param target_cell The index of the Cell in the global Cell array.
|
||||
//! @param map The index of the distribcell mapping corresponding to the target
|
||||
//! cell.
|
||||
//! @param target_offset An instance number for a distributed cell.
|
||||
//! @param root_univ The index of the root Universe in the global Universe
|
||||
//! array.
|
||||
//! @return The size of a character array needed to fit the distribcell path.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" int
|
||||
distribcell_path_len(int32_t target_cell, int32_t map, int32_t target_offset,
|
||||
int32_t root_univ);
|
||||
|
||||
//==============================================================================
|
||||
//! Build a character array representing the path to a distribcell instance.
|
||||
//! @param target_cell The index of the Cell in the global Cell array.
|
||||
//! @param map The index of the distribcell mapping corresponding to the target
|
||||
//! \param target_cell The index of the Cell in the global Cell array.
|
||||
//! \param map The index of the distribcell mapping corresponding to the target
|
||||
//! cell.
|
||||
//! @param target_offset An instance number for a distributed cell.
|
||||
//! @param root_univ The index of the root Universe in the global Universe
|
||||
//! array.
|
||||
//! @param[out] path The unique traversal through the geometry tree that leads
|
||||
//! to the desired instance of the target cell.
|
||||
//! \param target_offset An instance number for a distributed cell.
|
||||
//! \return The unique traversal through the geometry tree that leads to the
|
||||
//! desired instance of the target cell.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" void
|
||||
distribcell_path(int32_t target_cell, int32_t map, int32_t target_offset,
|
||||
int32_t root_univ, char *path);
|
||||
std::string
|
||||
distribcell_path(int32_t target_cell, int32_t map, int32_t target_offset);
|
||||
|
||||
//==============================================================================
|
||||
//! Determine the maximum number of nested coordinate levels in the geometry.
|
||||
//! @param univ The index of the universe to begin seraching from (probably the
|
||||
//! \param univ The index of the universe to begin seraching from (probably the
|
||||
//! root universe).
|
||||
//! @return The number of coordinate levels.
|
||||
//! \return The number of coordinate levels.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" int maximum_levels(int32_t univ);
|
||||
|
|
|
|||
|
|
@ -380,5 +380,11 @@ write_dataset(hid_t obj_id, const char* name, Position r)
|
|||
write_dataset(obj_id, name, buffer);
|
||||
}
|
||||
|
||||
inline void
|
||||
write_dataset(hid_t obj_id, const char* name, std::string buffer)
|
||||
{
|
||||
write_string(obj_id, name, buffer.c_str(), false);
|
||||
}
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_HDF5_INTERFACE_H
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ extern std::unordered_map<int32_t, int32_t> material_map;
|
|||
class Material
|
||||
{
|
||||
public:
|
||||
int32_t id; //!< Unique ID
|
||||
int32_t id_; //!< Unique ID
|
||||
double volume_ {-1.0}; //!< Volume in [cm^3]
|
||||
bool fissionable {false}; //!< Does this material contain fissionable nuclides
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ extern "C" void calc_rn_c(int n, const double uvw[3], double rn[]);
|
|||
//! evaluated at rho and phi.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" void calc_zn_c(int n, double rho, double phi, double zn[]);
|
||||
extern "C" void calc_zn(int n, double rho, double phi, double zn[]);
|
||||
|
||||
//==============================================================================
|
||||
//! Calculate only the even radial components of n-th order modified Zernike
|
||||
|
|
@ -113,7 +113,7 @@ extern "C" void calc_zn_c(int n, double rho, double phi, double zn[]);
|
|||
//! evaluated at rho and phi when m = 0.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" void calc_zn_rad_c(int n, double rho, double zn_rad[]);
|
||||
extern "C" void calc_zn_rad(int n, double rho, double zn_rad[]);
|
||||
|
||||
//==============================================================================
|
||||
//! Rotate the direction cosines through a polar angle whose cosine is mu and
|
||||
|
|
|
|||
91
include/openmc/tallies/filter.h
Normal file
91
include/openmc/tallies/filter.h
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_H
|
||||
#define OPENMC_TALLIES_FILTER_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "openmc/hdf5_interface.h"
|
||||
#include "openmc/particle.h"
|
||||
#include "pugixml.hpp"
|
||||
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
// Global variables
|
||||
//==============================================================================
|
||||
|
||||
extern "C" int32_t n_filters;
|
||||
|
||||
class FilterMatch;
|
||||
extern std::vector<FilterMatch> filter_matches;
|
||||
#pragma omp threadprivate(filter_matches)
|
||||
|
||||
class Filter;
|
||||
extern std::vector<Filter*> tally_filters;
|
||||
|
||||
//==============================================================================
|
||||
//! Stores bins and weights for filtered tally events.
|
||||
//==============================================================================
|
||||
|
||||
class FilterMatch
|
||||
{
|
||||
public:
|
||||
std::vector<int> bins_;
|
||||
std::vector<double> weights_;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
//! Modifies tally score events.
|
||||
//==============================================================================
|
||||
|
||||
class Filter
|
||||
{
|
||||
public:
|
||||
virtual ~Filter() = default;
|
||||
|
||||
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;
|
||||
|
||||
//! Matches a tally event to a set of filter bins and weights.
|
||||
//!
|
||||
//! \param[out] match will contain the matching bins and corresponding
|
||||
//! weights; note that there may be zero matching bins
|
||||
virtual void
|
||||
get_all_bins(const Particle* p, int estimator, FilterMatch& match) const = 0;
|
||||
|
||||
//! Writes data describing this filter to an HDF5 statepoint group.
|
||||
virtual void
|
||||
to_statepoint(hid_t filter_group) const
|
||||
{
|
||||
write_dataset(filter_group, "type", type());
|
||||
write_dataset(filter_group, "n_bins", n_bins_);
|
||||
}
|
||||
|
||||
//! Return a string describing a filter bin for the tallies.out file.
|
||||
//
|
||||
//! For example, an `EnergyFilter` might return the string
|
||||
//! "Incoming Energy [0.625E-6, 20.0)".
|
||||
virtual std::string text_label(int bin) const = 0;
|
||||
|
||||
virtual void initialize() {}
|
||||
|
||||
int n_bins_;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
||||
extern "C" void free_memory_tally_c();
|
||||
|
||||
//==============================================================================
|
||||
|
||||
// Filter-related Fortran functions that will be called from C++
|
||||
extern "C" int verify_filter(int32_t index);
|
||||
extern "C" Filter* filter_from_f(int32_t index);
|
||||
extern "C" void filter_update_n_bins(int32_t index);
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_H
|
||||
35
include/openmc/tallies/filter_azimuthal.h
Normal file
35
include/openmc/tallies/filter_azimuthal.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_AZIMUTHAL_H
|
||||
#define OPENMC_TALLIES_FILTER_AZIMUTHAL_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Bins the incident neutron azimuthal angle (relative to the global xy-plane).
|
||||
//==============================================================================
|
||||
|
||||
class AzimuthalFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~AzimuthalFilter() = default;
|
||||
|
||||
std::string type() const override {return "azimuthal";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
std::vector<double> bins_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_AZIMUTHAL_H
|
||||
42
include/openmc/tallies/filter_cell.h
Normal file
42
include/openmc/tallies/filter_cell.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_CELL_H
|
||||
#define OPENMC_TALLIES_FILTER_CELL_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Specifies which geometric cells tally events reside in.
|
||||
//==============================================================================
|
||||
|
||||
class CellFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~CellFilter() = default;
|
||||
|
||||
std::string type() const override {return "cell";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void initialize() override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
//! The indices of the cells binned by this filter.
|
||||
std::vector<int32_t> cells_;
|
||||
|
||||
//! A map from cell indices to filter bin indices.
|
||||
std::unordered_map<int32_t, int> map_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_CELL_H
|
||||
26
include/openmc/tallies/filter_cellborn.h
Normal file
26
include/openmc/tallies/filter_cellborn.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_CELLBORN_H
|
||||
#define OPENMC_TALLIES_FILTER_CELLBORN_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "openmc/tallies/filter_cell.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Specifies which cell the particle was born in.
|
||||
//==============================================================================
|
||||
|
||||
class CellbornFilter : public CellFilter
|
||||
{
|
||||
public:
|
||||
std::string type() const override {return "cellborn";}
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_CELLBORN_H
|
||||
26
include/openmc/tallies/filter_cellfrom.h
Normal file
26
include/openmc/tallies/filter_cellfrom.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_CELLFROM_H
|
||||
#define OPENMC_TALLIES_FILTER_CELLFROM_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "openmc/tallies/filter_cell.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Specifies which geometric cells particles exit when crossing a surface.
|
||||
//==============================================================================
|
||||
|
||||
class CellFromFilter : public CellFilter
|
||||
{
|
||||
public:
|
||||
std::string type() const override {return "cellfrom";}
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_CELLFROM_H
|
||||
36
include/openmc/tallies/filter_distribcell.h
Normal file
36
include/openmc/tallies/filter_distribcell.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_DISTRIBCELL_H
|
||||
#define OPENMC_TALLIES_FILTER_DISTRIBCELL_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Specifies which distributed geometric cells tally events reside in.
|
||||
//==============================================================================
|
||||
|
||||
class DistribcellFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~DistribcellFilter() = default;
|
||||
|
||||
std::string type() const override {return "distribcell";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void initialize() override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
int32_t cell_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_DISTRIBCELL_H
|
||||
45
include/openmc/tallies/filter_energyfunc.h
Normal file
45
include/openmc/tallies/filter_energyfunc.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_ENERGYFUNC_H
|
||||
#define OPENMC_TALLIES_FILTER_ENERGYFUNC_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Multiplies tally scores by an arbitrary function of incident energy
|
||||
//! described by a piecewise linear-linear interpolation.
|
||||
//==============================================================================
|
||||
|
||||
class EnergyFunctionFilter : public Filter
|
||||
{
|
||||
public:
|
||||
EnergyFunctionFilter()
|
||||
: Filter {}
|
||||
{
|
||||
n_bins_ = 1;
|
||||
}
|
||||
|
||||
~EnergyFunctionFilter() = default;
|
||||
|
||||
std::string type() const override {return "energyfunction";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
//! Incident neutron energy interpolation grid.
|
||||
std::vector<double> energy_;
|
||||
|
||||
//! Interpolant values.
|
||||
std::vector<double> y_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_ENERGYFUNC_H
|
||||
34
include/openmc/tallies/filter_legendre.h
Normal file
34
include/openmc/tallies/filter_legendre.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_LEGENDRE_H
|
||||
#define OPENMC_TALLIES_FILTER_LEGENDRE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Gives Legendre moments of the change in scattering angle
|
||||
//==============================================================================
|
||||
|
||||
class LegendreFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~LegendreFilter() = default;
|
||||
|
||||
std::string type() const override {return "legendre";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
int order_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_LEGENDRE_H
|
||||
42
include/openmc/tallies/filter_material.h
Normal file
42
include/openmc/tallies/filter_material.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_MATERIAL_H
|
||||
#define OPENMC_TALLIES_FILTER_MATERIAL_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Specifies which material tally events reside in.
|
||||
//==============================================================================
|
||||
|
||||
class MaterialFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~MaterialFilter() = default;
|
||||
|
||||
std::string type() const override {return "material";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void initialize() override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
//! The indices of the materials binned by this filter.
|
||||
std::vector<int32_t> materials_;
|
||||
|
||||
//! A map from material indices to filter bin indices.
|
||||
std::unordered_map<int32_t, int> map_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_MATERIAL_H
|
||||
41
include/openmc/tallies/filter_mesh.h
Normal file
41
include/openmc/tallies/filter_mesh.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_MESH_H
|
||||
#define OPENMC_TALLIES_FILTER_MESH_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Indexes the location of particle events to a regular mesh. For tracklength
|
||||
//! tallies, it will produce multiple valid bins and the bin weight will
|
||||
//! correspond to the fraction of the track length that lies in that bin.
|
||||
//==============================================================================
|
||||
|
||||
class MeshFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~MeshFilter() = default;
|
||||
|
||||
std::string type() const override {return "mesh";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
virtual int32_t mesh() const {return mesh_;}
|
||||
|
||||
virtual void set_mesh(int32_t mesh);
|
||||
|
||||
protected:
|
||||
int32_t mesh_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_MESH_H
|
||||
22
include/openmc/tallies/filter_meshsurface.h
Normal file
22
include/openmc/tallies/filter_meshsurface.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_MESHSURFACE_H
|
||||
#define OPENMC_TALLIES_FILTER_MESHSURFACE_H
|
||||
|
||||
#include "openmc/tallies/filter_mesh.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
class MeshSurfaceFilter : public MeshFilter
|
||||
{
|
||||
public:
|
||||
std::string type() const override {return "meshsurface";}
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
void set_mesh(int32_t mesh) override;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_MESHSURFACE_H
|
||||
35
include/openmc/tallies/filter_mu.h
Normal file
35
include/openmc/tallies/filter_mu.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_MU_H
|
||||
#define OPENMC_TALLIES_FILTER_MU_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Bins the incoming-outgoing direction cosine. This is only used for scatter
|
||||
//! reactions.
|
||||
//==============================================================================
|
||||
|
||||
class MuFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~MuFilter() = default;
|
||||
|
||||
std::string type() const override {return "mu";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
std::vector<double> bins_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_MU_H
|
||||
35
include/openmc/tallies/filter_polar.h
Normal file
35
include/openmc/tallies/filter_polar.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_POLAR_H
|
||||
#define OPENMC_TALLIES_FILTER_POLAR_H
|
||||
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Bins the incident neutron polar angle (relative to the global z-axis).
|
||||
//==============================================================================
|
||||
|
||||
class PolarFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~PolarFilter() = default;
|
||||
|
||||
std::string type() const override {return "polar";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
std::vector<double> bins_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_POLAR_H
|
||||
42
include/openmc/tallies/filter_sph_harm.h
Normal file
42
include/openmc/tallies/filter_sph_harm.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_SPH_HARM_H
|
||||
#define OPENMC_TALLIES_FILTER_SPH_HARM_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//TODO: those integer values are not needed when Fortran interop is removed
|
||||
enum class SphericalHarmonicsCosine {
|
||||
scatter = 1, particle = 2
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
//! Gives spherical harmonics expansion moments of a tally score
|
||||
//==============================================================================
|
||||
|
||||
class SphericalHarmonicsFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~SphericalHarmonicsFilter() = default;
|
||||
|
||||
std::string type() const override {return "sphericalharmonics";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
int order_;
|
||||
|
||||
//! The type of angle that this filter measures when binning events.
|
||||
SphericalHarmonicsCosine cosine_ {SphericalHarmonicsCosine::particle};
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_SPH_HARM_H
|
||||
48
include/openmc/tallies/filter_sptl_legendre.h
Normal file
48
include/openmc/tallies/filter_sptl_legendre.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_SPTL_LEGENDRE_H
|
||||
#define OPENMC_TALLIES_FILTER_SPTL_LEGENDRE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//TODO: those integer values are not needed when Fortran interop is removed
|
||||
enum class LegendreAxis {
|
||||
x = 1, y = 2, z = 3
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
//! Gives Legendre moments of the particle's normalized position along an axis
|
||||
//==============================================================================
|
||||
|
||||
class SpatialLegendreFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~SpatialLegendreFilter() = default;
|
||||
|
||||
std::string type() const override {return "spatiallegendre";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
int order_;
|
||||
|
||||
//! The Cartesian coordinate axis that the Legendre expansion is applied to.
|
||||
LegendreAxis axis_;
|
||||
|
||||
//! The minimum coordinate along the reference axis that the expansion covers.
|
||||
double min_;
|
||||
|
||||
//! The maximum coordinate along the reference axis that the expansion covers.
|
||||
double max_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_SPTL_LEGENDRE_H
|
||||
42
include/openmc/tallies/filter_surface.h
Normal file
42
include/openmc/tallies/filter_surface.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_SURFACE_H
|
||||
#define OPENMC_TALLIES_FILTER_SURFACE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Specifies which surface particles are crossing
|
||||
//==============================================================================
|
||||
|
||||
class SurfaceFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~SurfaceFilter() = default;
|
||||
|
||||
std::string type() const override {return "surface";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void initialize() override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
//! The indices of the surfaces binned by this filter.
|
||||
std::vector<int32_t> surfaces_;
|
||||
|
||||
//! A map from surface indices to filter bin indices.
|
||||
std::unordered_map<int32_t, int> map_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_SURFACE_H
|
||||
42
include/openmc/tallies/filter_universe.h
Normal file
42
include/openmc/tallies/filter_universe.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_UNIVERSE_H
|
||||
#define OPENMC_TALLIES_FILTER_UNIVERSE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Specifies which geometric universes tally events reside in.
|
||||
//==============================================================================
|
||||
|
||||
class UniverseFilter : public Filter
|
||||
{
|
||||
public:
|
||||
~UniverseFilter() = default;
|
||||
|
||||
std::string type() const override {return "universe";}
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void initialize() override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
//! The indices of the universes binned by this filter.
|
||||
std::vector<int32_t> universes_;
|
||||
|
||||
//! A map from universe indices to filter bin indices.
|
||||
std::unordered_map<int32_t, int> map_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_UNIVERSE_H
|
||||
65
include/openmc/tallies/filter_zernike.h
Normal file
65
include/openmc/tallies/filter_zernike.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#ifndef OPENMC_TALLIES_FILTER_ZERNIKE_H
|
||||
#define OPENMC_TALLIES_FILTER_ZERNIKE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
//! Gives Zernike polynomial moments of a particle's position
|
||||
//==============================================================================
|
||||
|
||||
class ZernikeFilter : public Filter
|
||||
{
|
||||
public:
|
||||
std::string type() const override {return "zernike";}
|
||||
|
||||
~ZernikeFilter() = default;
|
||||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
int order() const {return order_;}
|
||||
|
||||
virtual void set_order(int order);
|
||||
|
||||
//! Cartesian x coordinate for the origin of this expansion.
|
||||
double x_;
|
||||
|
||||
//! Cartesian y coordinate for the origin of this expansion.
|
||||
double y_;
|
||||
|
||||
//! Maximum radius from the origin covered by this expansion.
|
||||
double r_;
|
||||
|
||||
protected:
|
||||
int order_;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
//! Gives even order radial Zernike polynomial moments of a particle's position
|
||||
//==============================================================================
|
||||
|
||||
class ZernikeRadialFilter : public ZernikeFilter
|
||||
{
|
||||
public:
|
||||
std::string type() const override {return "zernikeradial";}
|
||||
|
||||
void get_all_bins(const Particle* p, int estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
||||
void set_order(int order) override;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_TALLIES_FILTER_ZERNIKE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue