A monte carlo pin cell spectral code for nuclear engineering applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
TallyBank.h
Go to the documentation of this file.
1 
8 #ifndef TALLYBANK_H_
9 #define TALLYBANK_H_
10 
11 #ifdef __cplusplus
12 #include <set>
13 #include <map>
14 #include <utility>
15 #include <string.h>
16 #include <sstream>
17 #include "Tally.h"
18 #include "Region.h"
19 #include "Material.h"
20 #include "Isotope.h"
21 #include "Geometry.h"
22 #endif
23 
24 #ifndef TALLYBANK_C
25 
26  extern int output_file_num;
27 #endif
28 
29 
41 class TallyBank {
42 private:
46  TallyBank() { }
47 
53  TallyBank &operator=(const TallyBank &) { return *this; }
54 
59  TallyBank(const TallyBank &) { }
60 
62  std::set<Tally*> _all_tallies;
64  std::map< Geometry*, std::set<Tally*>* > _geometry_tallies;
66  std::map< Region*, std::set<Tally*>* > _region_tallies;
68  std::map< Material*, std::set<Tally*>* > _material_tallies;
70  std::map< Isotope*, std::set<Tally*>* > _isotope_tallies;
71 
72 public:
76  ~TallyBank() { }
77 
82  static TallyBank *Get() {
83  static TallyBank instance;
84  return &instance;
85  }
86 
87  void registerTally(Tally* tally);
88  void registerTally(Tally* tally, Geometry* geometry);
89  void registerTally(Tally* tally, Region* region);
90  void registerTally(Tally* tally, Material* material);
91  void registerTally(Tally* tally, Isotope* isotope);
93 
94  void initializeBatchTallies(int num_batches);
95  bool isPrecisionTriggered();
96  void incrementNumBatches(int num_batches);
98  void computeScaledBatchStatistics(float scale_factor);
99  void outputBatchStatistics();
100  void tally(neutron* neutron);
101 
102  void clearTallies();
103 };
104 
105 #endif /* TALLYBANK_H_ */
void computeScaledBatchStatistics(float scale_factor)
Compute scaled batch statistics for all registered tallies.
Definition: TallyBank.cpp:452
Represents a neutron in a PINSPEC simulation.
Definition: Neutron.h:27
std::map< Isotope *, std::set< Tally * > * > _isotope_tallies
Definition: TallyBank.h:70
static TallyBank * Get()
Gets an instance pointer to this static class.
Definition: TallyBank.h:82
std::set< Tally * > _all_tallies
Definition: TallyBank.h:62
void initializeBatchTallies(int num_batches)
Initializes each registered tally with some number of batches for batch-based statistics.
Definition: TallyBank.cpp:663
The Material class.
void computeBatchStatistics()
Compute batch statistics for all registered tallies.
Definition: TallyBank.cpp:436
The Isotope represents a nuclide at some temperature.
Definition: Isotope.h:41
std::map< Material *, std::set< Tally * > * > _material_tallies
Definition: TallyBank.h:68
void clearTallies()
Delete all containers (vectors and maps) of Tally objects.
Definition: TallyBank.cpp:695
The Tally superclass and subclasses.
TallyBank & operator=(const TallyBank &)
An overloaded assignment function to allow for static referencing of the TallyBank class...
Definition: TallyBank.h:53
int output_file_num
Definition: TallyBank.cpp:5
The region class represents a region in 2D space.
Definition: Region.h:58
void tally(neutron *neutron)
Tallies a neutron in all appropriate Tally objects.
Definition: TallyBank.cpp:592
void outputBatchStatistics()
Calls each of the Tally class objects in the simulation to output their tallies and statistics to out...
Definition: TallyBank.cpp:533
TallyBank(const TallyBank &)
TallyBank constructor.
Definition: TallyBank.h:59
The Geometry represents the highest level entity in which a neutron may reside during a PINSPEC simul...
Definition: Geometry.h:48
A Tally reprsents a set of bins for tallying some quantity.
Definition: Tally.h:172
The Isotope class.
void registerTally(Tally *tally)
Register a Tally for the Tally's domain.
Definition: TallyBank.cpp:14
std::map< Region *, std::set< Tally * > * > _region_tallies
Definition: TallyBank.h:66
void incrementNumBatches(int num_batches)
Increment the total number of batches for batch-based statistics for each registered Tally object...
Definition: TallyBank.cpp:681
std::map< Geometry *, std::set< Tally * > * > _geometry_tallies
Definition: TallyBank.h:64
The Material class represents a collection of isotope objects.
Definition: Material.h:37
The Region class.
~TallyBank()
TallyBank destructor.
Definition: TallyBank.h:76
The TallyBank contains all tallies for a simulation.
Definition: TallyBank.h:41
bool isPrecisionTriggered()
Checks whether a tally in the TallyBank contains a precision trigger * *.
Definition: TallyBank.cpp:418
TallyBank()
TallyBank constructor.
Definition: TallyBank.h:46
The Geometry class.
void deregisterTally(Tally *tally)
Un-registers a Tally from the TallyBank.
Definition: TallyBank.cpp:369