mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
moved filter_matches arrays to be particle owned rather than global thread private
This commit is contained in:
parent
38fa90b3e4
commit
4fb438cbea
8 changed files with 76 additions and 87 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "openmc/particle.h"
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
|
||||
namespace openmc {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,10 @@
|
|||
#include "openmc/constants.h"
|
||||
#include "openmc/position.h"
|
||||
#include "openmc/random_lcg.h"
|
||||
//#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
class FilterMatch;
|
||||
|
||||
//==============================================================================
|
||||
// Constants
|
||||
|
|
@ -315,6 +317,8 @@ public:
|
|||
int64_t current_work_; // current work index
|
||||
|
||||
std::vector<double> flux_derivs_; // Derivatives of the current particle's weight
|
||||
|
||||
std::vector<FilterMatch> filter_matches_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -32,11 +32,6 @@ public:
|
|||
|
||||
} // namespace openmc
|
||||
|
||||
// Without an explicit instantiation of vector<FilterMatch>, the Intel compiler
|
||||
// will complain about the threadprivate directive on filter_matches. Note that
|
||||
// this has to happen *outside* of the openmc namespace
|
||||
extern template class std::vector<openmc::FilterMatch>;
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -127,13 +122,6 @@ private:
|
|||
// Global variables
|
||||
//==============================================================================
|
||||
|
||||
namespace simulation {
|
||||
|
||||
extern std::vector<FilterMatch> filter_matches;
|
||||
#pragma omp threadprivate(filter_matches)
|
||||
|
||||
} // namespace simulation
|
||||
|
||||
namespace model {
|
||||
extern "C" int32_t n_filters;
|
||||
extern std::vector<std::unique_ptr<Filter>> tally_filters;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "openmc/particle.h"
|
||||
#include "openmc/tallies/tally.h"
|
||||
#include "openmc/tallies/filter.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
|
|
@ -22,12 +23,12 @@ class FilterBinIter
|
|||
public:
|
||||
|
||||
//! Construct an iterator over bins that match a given particle's state.
|
||||
FilterBinIter(const Tally& tally, const Particle* p);
|
||||
FilterBinIter(const Tally& tally, const Particle* p, std::vector<FilterMatch> * particle_filter_matches);
|
||||
|
||||
//! Construct an iterator over all filter bin combinations.
|
||||
//
|
||||
//! \param end if true, the returned iterator indicates the end of a loop.
|
||||
FilterBinIter(const Tally& tally, bool end);
|
||||
FilterBinIter(const Tally& tally, bool end, std::vector<FilterMatch> * particle_filter_matches);
|
||||
|
||||
bool operator==(const FilterBinIter& other) const
|
||||
{return index_ == other.index_;}
|
||||
|
|
@ -39,6 +40,8 @@ public:
|
|||
|
||||
int index_ {1};
|
||||
double weight_ {1.};
|
||||
|
||||
std::vector<FilterMatch> & filter_matches_;
|
||||
|
||||
private:
|
||||
void compute_index_weight();
|
||||
|
|
@ -73,7 +76,7 @@ void score_analog_tally_ce(Particle* p);
|
|||
//! Analog tallies are triggered at every collision, not every event.
|
||||
//
|
||||
//! \param p The particle being tracked
|
||||
void score_analog_tally_mg(const Particle* p);
|
||||
void score_analog_tally_mg(Particle* p);
|
||||
|
||||
//! Score tallies using a tracklength estimate of the flux.
|
||||
//
|
||||
|
|
@ -89,7 +92,7 @@ void score_tracklength_tally(Particle* p, double distance);
|
|||
//
|
||||
//! \param p The particle being tracked
|
||||
//! \param tallies A vector of tallies to score to
|
||||
void score_surface_tally(const Particle* p, const std::vector<int>& tallies);
|
||||
void score_surface_tally(Particle* p, const std::vector<int>& tallies);
|
||||
|
||||
} // namespace openmc
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue