mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
Move write_tallies to C++
This commit is contained in:
parent
ddaed7311b
commit
8bb0fa7791
6 changed files with 366 additions and 373 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#define OPENMC_TALLIES_TALLY_H
|
||||
|
||||
#include "openmc/constants.h"
|
||||
#include "openmc/tallies/filter.h"
|
||||
#include "openmc/tallies/trigger.h"
|
||||
|
||||
#include "pugixml.hpp"
|
||||
|
|
@ -21,6 +22,8 @@ class Tally {
|
|||
public:
|
||||
Tally() {}
|
||||
|
||||
void init_from_xml(pugi::xml_node node);
|
||||
|
||||
void set_scores(pugi::xml_node node);
|
||||
|
||||
void set_scores(std::vector<std::string> scores);
|
||||
|
|
@ -50,6 +53,8 @@ public:
|
|||
|
||||
int id_; //!< user-defined identifier
|
||||
|
||||
std::string name_; //!< user-defined name
|
||||
|
||||
int type_ {TALLY_VOLUME}; //!< volume, surface current
|
||||
|
||||
//! Event type that contributes to this tally
|
||||
|
|
@ -93,6 +98,41 @@ private:
|
|||
int32_t n_filter_bins_ {0};
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
//! An iterator over all combinations of a tally's matching filter bins.
|
||||
//
|
||||
//! This iterator handles two distinct tasks. First, it maps the N-dimensional
|
||||
//! space created by the indices of N filters onto a 1D sequence. In other
|
||||
//! words, it provides a single number that uniquely identifies a combination of
|
||||
//! bins for many filters. Second, it handles the task of finding each all
|
||||
//! valid combinations of filter bins given that each filter can have 1 or 2 or
|
||||
//! many bins that are valid for the current tally event.
|
||||
//==============================================================================
|
||||
|
||||
class FilterBinIter
|
||||
{
|
||||
public:
|
||||
FilterBinIter(const Tally& tally, Particle* p);
|
||||
|
||||
FilterBinIter(const Tally& tally, bool end);
|
||||
|
||||
bool operator==(const FilterBinIter& other) const
|
||||
{return index_ == other.index_;}
|
||||
|
||||
bool operator!=(const FilterBinIter& other) const
|
||||
{return !(*this == other);}
|
||||
|
||||
FilterBinIter& operator++();
|
||||
|
||||
int index_ {1};
|
||||
double weight_ {1.};
|
||||
|
||||
private:
|
||||
void compute_index_weight();
|
||||
|
||||
const Tally& tally_;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
// Global variable declarations
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue