mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Change get_all_bins to accept a const ref instead of pointer
This commit is contained in:
parent
977ea5b602
commit
23b984ba3a
44 changed files with 104 additions and 103 deletions
|
|
@ -55,10 +55,12 @@ public:
|
|||
|
||||
//! Matches a tally event to a set of filter bins and weights.
|
||||
//!
|
||||
//! \param[in] p Particle being tracked
|
||||
//! \param[in] estimator Tally estimator being used
|
||||
//! \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, TallyEstimator estimator, FilterMatch& match) const = 0;
|
||||
get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match) const = 0;
|
||||
|
||||
//! Writes data describing this filter to an HDF5 statepoint group.
|
||||
virtual void
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
std::string type() const override {return "cellborn";}
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
std::string type() const override {return "cellfrom";}
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
std::string type() const override {return "energyout";}
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public:
|
|||
|
||||
std::string type() const override {return "meshsurface";}
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
void from_xml(pugi::xml_node node) override;
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
void to_statepoint(hid_t filter_group) const override;
|
||||
|
|
@ -76,7 +76,7 @@ public:
|
|||
|
||||
std::string type() const override {return "zernikeradial";}
|
||||
|
||||
void get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
void get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const override;
|
||||
|
||||
std::string text_label(int bin) const override;
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ void AzimuthalFilter::set_bins(gsl::span<double> bins)
|
|||
}
|
||||
|
||||
void
|
||||
AzimuthalFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
AzimuthalFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
double phi;
|
||||
if (estimator == TallyEstimator::TRACKLENGTH) {
|
||||
phi = std::atan2(p->u().y, p->u().x);
|
||||
phi = std::atan2(p.u().y, p.u().x);
|
||||
} else {
|
||||
phi = std::atan2(p->u_last_.y, p->u_last_.x);
|
||||
phi = std::atan2(p.u_last_.y, p.u_last_.x);
|
||||
}
|
||||
|
||||
if (phi >= bins_.front() && phi <= bins_.back()) {
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ CellFilter::set_cells(gsl::span<int32_t> cells)
|
|||
}
|
||||
|
||||
void
|
||||
CellFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
CellFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
for (int i = 0; i < p->n_coord_; i++) {
|
||||
auto search = map_.find(p->coord_[i].cell);
|
||||
for (int i = 0; i < p.n_coord_; i++) {
|
||||
auto search = map_.find(p.coord_[i].cell);
|
||||
if (search != map_.end()) {
|
||||
match.bins_.push_back(search->second);
|
||||
match.weights_.push_back(1.0);
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ CellInstanceFilter::set_cell_instances(gsl::span<CellInstance> instances)
|
|||
}
|
||||
|
||||
void
|
||||
CellInstanceFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
CellInstanceFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
gsl::index index_cell = p->coord_[p->n_coord_ - 1].cell;
|
||||
gsl::index instance = p->cell_instance_;
|
||||
gsl::index index_cell = p.coord_[p.n_coord_ - 1].cell;
|
||||
gsl::index instance = p.cell_instance_;
|
||||
auto search = map_.find({index_cell, instance});
|
||||
if (search != map_.end()) {
|
||||
int index_bin = search->second;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
namespace openmc {
|
||||
|
||||
void
|
||||
CellbornFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
CellbornFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
auto search = map_.find(p->cell_born_);
|
||||
auto search = map_.find(p.cell_born_);
|
||||
if (search != map_.end()) {
|
||||
match.bins_.push_back(search->second);
|
||||
match.weights_.push_back(1.0);
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@
|
|||
namespace openmc {
|
||||
|
||||
void
|
||||
CellFromFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
CellFromFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
for (int i = 0; i < p->n_coord_last_; i++) {
|
||||
auto search = map_.find(p->cell_last_[i]);
|
||||
for (int i = 0; i < p.n_coord_last_; i++) {
|
||||
auto search = map_.find(p.cell_last_[i]);
|
||||
if (search != map_.end()) {
|
||||
match.bins_.push_back(search->second);
|
||||
match.weights_.push_back(1.0);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ DelayedGroupFilter::set_groups(gsl::span<int> groups)
|
|||
}
|
||||
|
||||
void
|
||||
DelayedGroupFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
DelayedGroupFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
match.bins_.push_back(0);
|
||||
|
|
|
|||
|
|
@ -38,25 +38,25 @@ DistribcellFilter::set_cell(int32_t cell)
|
|||
}
|
||||
|
||||
void
|
||||
DistribcellFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
DistribcellFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
int offset = 0;
|
||||
auto distribcell_index = model::cells[cell_]->distribcell_index_;
|
||||
for (int i = 0; i < p->n_coord_; i++) {
|
||||
auto& c {*model::cells[p->coord_[i].cell]};
|
||||
for (int i = 0; i < p.n_coord_; i++) {
|
||||
auto& c {*model::cells[p.coord_[i].cell]};
|
||||
if (c.type_ == Fill::UNIVERSE) {
|
||||
offset += c.offset_[distribcell_index];
|
||||
} else if (c.type_ == Fill::LATTICE) {
|
||||
auto& lat {*model::lattices[p->coord_[i+1].lattice]};
|
||||
int i_xyz[3] {p->coord_[i+1].lattice_x,
|
||||
p->coord_[i+1].lattice_y,
|
||||
p->coord_[i+1].lattice_z};
|
||||
auto& lat {*model::lattices[p.coord_[i+1].lattice]};
|
||||
int i_xyz[3] {p.coord_[i+1].lattice_x,
|
||||
p.coord_[i+1].lattice_y,
|
||||
p.coord_[i+1].lattice_z};
|
||||
if (lat.are_valid_indices(i_xyz)) {
|
||||
offset += lat.offset(distribcell_index, i_xyz);
|
||||
}
|
||||
}
|
||||
if (cell_ == p->coord_[i].cell) {
|
||||
if (cell_ == p.coord_[i].cell) {
|
||||
match.bins_.push_back(offset);
|
||||
match.weights_.push_back(1.0);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -58,20 +58,20 @@ EnergyFilter::set_bins(gsl::span<const double> bins)
|
|||
}
|
||||
|
||||
void
|
||||
EnergyFilter::get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
EnergyFilter::get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const
|
||||
{
|
||||
if (p->g_ != F90_NONE && matches_transport_groups_) {
|
||||
if (p.g_ != F90_NONE && matches_transport_groups_) {
|
||||
if (estimator == TallyEstimator::TRACKLENGTH) {
|
||||
match.bins_.push_back(data::mg.num_energy_groups_ - p->g_ - 1);
|
||||
match.bins_.push_back(data::mg.num_energy_groups_ - p.g_ - 1);
|
||||
} else {
|
||||
match.bins_.push_back(data::mg.num_energy_groups_ - p->g_last_ - 1);
|
||||
match.bins_.push_back(data::mg.num_energy_groups_ - p.g_last_ - 1);
|
||||
}
|
||||
match.weights_.push_back(1.0);
|
||||
|
||||
} else {
|
||||
// Get the pre-collision energy of the particle.
|
||||
auto E = p->E_last_;
|
||||
auto E = p.E_last_;
|
||||
|
||||
// Bin the energy.
|
||||
if (E >= bins_.front() && E <= bins_.back()) {
|
||||
|
|
@ -100,16 +100,16 @@ EnergyFilter::text_label(int bin) const
|
|||
//==============================================================================
|
||||
|
||||
void
|
||||
EnergyoutFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
EnergyoutFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
if (p->g_ != F90_NONE && matches_transport_groups_) {
|
||||
match.bins_.push_back(data::mg.num_energy_groups_ - p->g_ - 1);
|
||||
if (p.g_ != F90_NONE && matches_transport_groups_) {
|
||||
match.bins_.push_back(data::mg.num_energy_groups_ - p.g_ - 1);
|
||||
match.weights_.push_back(1.0);
|
||||
|
||||
} else {
|
||||
if (p->E_ >= bins_.front() && p->E_ <= bins_.back()) {
|
||||
auto bin = lower_bound_index(bins_.begin(), bins_.end(), p->E_);
|
||||
if (p.E_ >= bins_.front() && p.E_ <= bins_.back()) {
|
||||
auto bin = lower_bound_index(bins_.begin(), bins_.end(), p.E_);
|
||||
match.bins_.push_back(bin);
|
||||
match.weights_.push_back(1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,15 +53,15 @@ EnergyFunctionFilter::set_data(gsl::span<const double> energy,
|
|||
}
|
||||
|
||||
void
|
||||
EnergyFunctionFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
EnergyFunctionFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
if (p->E_last_ >= energy_.front() && p->E_last_ <= energy_.back()) {
|
||||
if (p.E_last_ >= energy_.front() && p.E_last_ <= energy_.back()) {
|
||||
// Search for the incoming energy bin.
|
||||
auto i = lower_bound_index(energy_.begin(), energy_.end(), p->E_last_);
|
||||
auto i = lower_bound_index(energy_.begin(), energy_.end(), p.E_last_);
|
||||
|
||||
// Compute the interpolation factor between the nearest bins.
|
||||
double f = (p->E_last_ - energy_[i]) / (energy_[i+1] - energy_[i]);
|
||||
double f = (p.E_last_ - energy_[i]) / (energy_[i+1] - energy_[i]);
|
||||
|
||||
// Interpolate on the lin-lin grid.
|
||||
match.bins_.push_back(0);
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ LegendreFilter::set_order(int order)
|
|||
}
|
||||
|
||||
void
|
||||
LegendreFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
LegendreFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
std::vector<double> wgt(n_bins_);
|
||||
calc_pn_c(order_, p->mu_, wgt.data());
|
||||
calc_pn_c(order_, p.mu_, wgt.data());
|
||||
for (int i = 0; i < n_bins_; i++) {
|
||||
match.bins_.push_back(i);
|
||||
match.weights_.push_back(wgt[i]);
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ MaterialFilter::set_materials(gsl::span<const int32_t> materials)
|
|||
}
|
||||
|
||||
void
|
||||
MaterialFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
MaterialFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
auto search = map_.find(p->material_);
|
||||
auto search = map_.find(p.material_);
|
||||
if (search != map_.end()) {
|
||||
match.bins_.push_back(search->second);
|
||||
match.weights_.push_back(1.0);
|
||||
|
|
|
|||
|
|
@ -31,17 +31,17 @@ MeshFilter::from_xml(pugi::xml_node node)
|
|||
}
|
||||
|
||||
void
|
||||
MeshFilter::get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
MeshFilter::get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const
|
||||
{
|
||||
if (estimator != TallyEstimator::TRACKLENGTH) {
|
||||
auto bin = model::meshes[mesh_]->get_bin(p->r());
|
||||
auto bin = model::meshes[mesh_]->get_bin(p.r());
|
||||
if (bin >= 0) {
|
||||
match.bins_.push_back(bin);
|
||||
match.weights_.push_back(1.0);
|
||||
}
|
||||
} else {
|
||||
model::meshes[mesh_]->bins_crossed(p, match.bins_, match.weights_);
|
||||
model::meshes[mesh_]->bins_crossed(&p, match.bins_, match.weights_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
namespace openmc {
|
||||
|
||||
void
|
||||
MeshSurfaceFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
MeshSurfaceFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
model::meshes[mesh_]->surface_bins_crossed(p, match.bins_);
|
||||
model::meshes[mesh_]->surface_bins_crossed(&p, match.bins_);
|
||||
for (auto b : match.bins_) match.weights_.push_back(1.0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ MuFilter::set_bins(gsl::span<double> bins)
|
|||
}
|
||||
|
||||
void
|
||||
MuFilter::get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
MuFilter::get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const
|
||||
{
|
||||
if (p->mu_ >= bins_.front() && p->mu_ <= bins_.back()) {
|
||||
auto bin = lower_bound_index(bins_.begin(), bins_.end(), p->mu_);
|
||||
if (p.mu_ >= bins_.front() && p.mu_ <= bins_.back()) {
|
||||
auto bin = lower_bound_index(bins_.begin(), bins_.end(), p.mu_);
|
||||
match.bins_.push_back(bin);
|
||||
match.weights_.push_back(1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ ParticleFilter::set_particles(gsl::span<Particle::Type> particles)
|
|||
}
|
||||
|
||||
void
|
||||
ParticleFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
ParticleFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
for (auto i = 0; i < particles_.size(); i++) {
|
||||
if (particles_[i] == p->type_) {
|
||||
if (particles_[i] == p.type_) {
|
||||
match.bins_.push_back(i);
|
||||
match.weights_.push_back(1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,15 +50,12 @@ PolarFilter::set_bins(gsl::span<double> bins)
|
|||
}
|
||||
|
||||
void
|
||||
PolarFilter::get_all_bins(const Particle* p, TallyEstimator estimator, FilterMatch& match)
|
||||
PolarFilter::get_all_bins(const Particle& p, TallyEstimator estimator, FilterMatch& match)
|
||||
const
|
||||
{
|
||||
double theta;
|
||||
if (estimator == TallyEstimator::TRACKLENGTH) {
|
||||
theta = std::acos(p->u().z);
|
||||
} else {
|
||||
theta = std::acos(p->u_last_.z);
|
||||
}
|
||||
double theta = std::acos(
|
||||
estimator == TallyEstimator::TRACKLENGTH ? p.u().z : p.u_last_.z
|
||||
);
|
||||
|
||||
if (theta >= bins_.front() && theta <= bins_.back()) {
|
||||
auto bin = lower_bound_index(bins_.begin(), bins_.end(), theta);
|
||||
|
|
|
|||
|
|
@ -45,20 +45,22 @@ SphericalHarmonicsFilter::set_cosine(gsl::cstring_span cosine)
|
|||
}
|
||||
|
||||
void
|
||||
SphericalHarmonicsFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
SphericalHarmonicsFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
// Determine cosine term for scatter expansion if necessary
|
||||
std::vector<double> wgt(order_ + 1);
|
||||
if (cosine_ == SphericalHarmonicsCosine::scatter) {
|
||||
calc_pn_c(order_, p->mu_, wgt.data());
|
||||
calc_pn_c(order_, p.mu_, wgt.data());
|
||||
} else {
|
||||
for (int i = 0; i < order_ + 1; i++) wgt[i] = 1;
|
||||
for (int i = 0; i < order_ + 1; i++) {
|
||||
wgt[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Find the Rn,m values
|
||||
std::vector<double> rn(n_bins_);
|
||||
calc_rn(order_, p->u_last_, rn.data());
|
||||
calc_rn(order_, p.u_last_, rn.data());
|
||||
|
||||
int j = 0;
|
||||
for (int n = 0; n < order_ + 1; n++) {
|
||||
|
|
|
|||
|
|
@ -63,17 +63,17 @@ SpatialLegendreFilter::set_minmax(double min, double max)
|
|||
}
|
||||
|
||||
void
|
||||
SpatialLegendreFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
SpatialLegendreFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
// Get the coordinate along the axis of interest.
|
||||
double x;
|
||||
if (axis_ == LegendreAxis::x) {
|
||||
x = p->r().x;
|
||||
x = p.r().x;
|
||||
} else if (axis_ == LegendreAxis::y) {
|
||||
x = p->r().y;
|
||||
x = p.r().y;
|
||||
} else {
|
||||
x = p->r().z;
|
||||
x = p.r().z;
|
||||
}
|
||||
|
||||
if (x >= min_ && x <= max_) {
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@ SurfaceFilter::set_surfaces(gsl::span<int32_t> surfaces)
|
|||
}
|
||||
|
||||
void
|
||||
SurfaceFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
SurfaceFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
auto search = map_.find(std::abs(p->surface_)-1);
|
||||
auto search = map_.find(std::abs(p.surface_)-1);
|
||||
if (search != map_.end()) {
|
||||
match.bins_.push_back(search->second);
|
||||
if (p->surface_ < 0) {
|
||||
if (p.surface_ < 0) {
|
||||
match.weights_.push_back(-1.0);
|
||||
} else {
|
||||
match.weights_.push_back(1.0);
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ UniverseFilter::set_universes(gsl::span<int32_t> universes)
|
|||
}
|
||||
|
||||
void
|
||||
UniverseFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
UniverseFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
for (int i = 0; i < p->n_coord_; i++) {
|
||||
auto search = map_.find(p->coord_[i].universe);
|
||||
for (int i = 0; i < p.n_coord_; i++) {
|
||||
auto search = map_.find(p.coord_[i].universe);
|
||||
if (search != map_.end()) {
|
||||
match.bins_.push_back(search->second);
|
||||
match.weights_.push_back(1.0);
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ ZernikeFilter::from_xml(pugi::xml_node node)
|
|||
}
|
||||
|
||||
void
|
||||
ZernikeFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
ZernikeFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
// Determine the normalized (r,theta) coordinates.
|
||||
double x = p->r().x - x_;
|
||||
double y = p->r().y - y_;
|
||||
double x = p.r().x - x_;
|
||||
double y = p.r().y - y_;
|
||||
double r = std::sqrt(x*x + y*y) / r_;
|
||||
double theta = std::atan2(y, x);
|
||||
|
||||
|
|
@ -88,12 +88,12 @@ ZernikeFilter::set_order(int order)
|
|||
//==============================================================================
|
||||
|
||||
void
|
||||
ZernikeRadialFilter::get_all_bins(const Particle* p, TallyEstimator estimator,
|
||||
ZernikeRadialFilter::get_all_bins(const Particle& p, TallyEstimator estimator,
|
||||
FilterMatch& match) const
|
||||
{
|
||||
// Determine the normalized radius coordinate.
|
||||
double x = p->r().x - x_;
|
||||
double y = p->r().y - y_;
|
||||
double x = p.r().x - x_;
|
||||
double y = p.r().y - y_;
|
||||
double r = std::sqrt(x*x + y*y) / r_;
|
||||
|
||||
if (r <= 1.0) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ FilterBinIter::FilterBinIter(const Tally& tally, Particle* p)
|
|||
if (!match.bins_present_) {
|
||||
match.bins_.clear();
|
||||
match.weights_.clear();
|
||||
model::tally_filters[i_filt]->get_all_bins(p, tally_.estimator_, match);
|
||||
model::tally_filters[i_filt]->get_all_bins(*p, tally_.estimator_, match);
|
||||
match.bins_present_ = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue