MURE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Tally.hxx
Go to the documentation of this file.
1 #ifndef _TALLY_HXX_
2 #define _TALLY_HXX_
3 
9 #include "MureHeaders.hxx"
10 #include <vector>
11 using namespace std;
12 
16 
18 
31 class TallyBin
32 {
33  protected:
34  TallyBin(int celltype, vector<double> vol,double surf);
35  public:
36  TallyBin(const TallyBin &b);
37  TallyBin();
38  virtual ~TallyBin(){};
39  virtual TallyBin *Clone(){return new TallyBin(*this);} //<! The "Virtual Copy Constructor"
40 
41  virtual bool IsSimpleBin(){return 0;}
42  virtual bool IsGroupBin(){return 0;}
43  virtual bool IsLatticeBin(){return 0;}
44 
48  int GetCellType(){return fCellType;}
49  virtual string Print(int BeforeRparenthesis=0){return "";}
50  virtual string PrintVolume();
51 
54  virtual bool NeedVolume(){if(fCellType) return (fVolume[0]==-1); else return /*(fSurface==-1)*/ false;}
56 
59  vector<double> GetVolume(){return fVolume;}
61 
64  double GetVolume(int i){return fVolume[i];}
65  double GetSurface(){return fSurface;}
66  int GetNumberOfVolume(){return fVolume.size();}
67 
76  void SetSurface(double S,bool Inc=false);
78 
87  void SetVolume(double V,int i=0,bool Inc=false);
88  virtual bool IsInBin(int num){return false;}
89  void SetBinVolume(vector<double> V);
90 
91  protected:
92  int fCellType;
93  vector<double> fVolume;
94  double fSurface;
95 
96 };
97 
99 
107 class SimpleBin :public TallyBin
108 {
109  public:
110  SimpleBin(const SimpleBin &b);
111  SimpleBin(Cell *C);
112  SimpleBin(Shape_ptr S);
113  SimpleBin(int universe);
114  SimpleBin();
115  TallyBin *Clone() {return new SimpleBin(*this);}
116  virtual ~SimpleBin(){fBin.clear(); fIsBinUniverse.clear();}
117 
118  void AddSurface(int num) {fBin.push_back(num);}
119 
120 
121  bool IsSimpleBin(){return 1;}
122  string Print(int BeforeRparenthesis=0);
123  string PrintVolume();
124  bool IsInBin(int num);
125 
126  private:
127  vector<int> fBin;
128  vector<bool> fIsBinUniverse;
129 
130 };
131 
133 
143 class GroupBin :public TallyBin
144 {
145  public:
146  GroupBin(const GroupBin &b);
147  GroupBin(Cell *C);
148  GroupBin(Shape_ptr S);
149  GroupBin(TallyBin *theTallyBin);
150  GroupBin(int universe);
151  TallyBin *Clone() {return new GroupBin(*this);}
152  ~GroupBin();
153 
154  bool IsGroupBin(){return 1;}
155  void Add(Cell *C);
156  void Add(Shape_ptr S);
157  void Add(TallyBin *theTallyBin);
158  void Add(int universe);
159  string Print(int BeforeRparenthesis=0);
160  bool IsInBin(int num);
161 
162  private:
163 
164  vector<TallyBin*> fBin;
165 };
166 
168 
179 class LatticeBin:public TallyBin
180 {
181  public:
182  LatticeBin(const LatticeBin &b);
183  LatticeBin(Cell *C, string pos = "");
184  LatticeBin(TallyBin *theTallyBin);
185  LatticeBin(int universe);
186  ~LatticeBin();
187  TallyBin *Clone() {return new LatticeBin(*this);}
188 
189  bool IsLatticeBin(){return 1;}
190 
197  void Add(Cell *C,int InclusionLevel=0, string pos = "");
205  void Add(TallyBin *theTallyBin,int InclusionLevel=0);
206  void Add(int universe,int InclusionLevel=0);
207  void AddContainer(Cell *C, string pos = "");
208  void AddContainer(TallyBin *theTallyBin);
209  void AddContainer(int universe);
210  string Print(int BeforeRparenthesis=0);
211  string PrintVolume();
212  bool IsInBin(int num);
213 
214  vector< vector<TallyBin*> > GetLevelVector() {return fLevel;}
215 
216  private:
217  vector< vector<TallyBin*> > fLevel;
218  vector< vector< bool > > fHasPosition;
219  vector< vector< string > > fPosition;
220 };
221 
223 
233 class Reaction
234 {
235  public:
236  Reaction(const Reaction &r);
237  Reaction(int code){fCode.push_back(code);}
238  void Add(int code);
239  void Multiply(int code);
240  string Print();
241  vector<int> GetCode(){return fCode;}
242  bool operator==(const Reaction r)const ;
243  private:
244  vector<int> fCode;
245  vector<char> fOperator;
246 };
247 
249 
254 class TallyFM
255 {
256  public:
267  TallyFM(Material *M,int reaction,double constant=1);
280  TallyFM(Material *M,Reaction *R,double constant=1);
289  TallyFM(int MatNumber,int reaction,double constant=1);
291 
298  TallyFM(int MatNumber,Reaction *R,double constant=1);
299 
300  TallyFM(const TallyFM &fm);
301  ~TallyFM();
302  string Print();
303  int GetMaterial(){return fMatNumber;}
304 
305  private:
306  void Init(int MatNumber,Reaction *R,double constant=1);
307  double fConstant;
310 };
311 
312 
313 
315 
324 class Tally
325 {
326  public:
339  Tally(int type=kCellFlux,const char *particle="N");
352  Tally(int type,int particle);
353  Tally(const Tally &t);
354  Tally *Clone() {return new Tally(*this);}
355  ~Tally();
356 
357  void Add(Cell *C);
358  void Add(Shape_ptr S);
359  void Add(TallyBin *theTallyBin);
360  void Add(int universe);
361  void Add(TallyFM *FM){fMultiplicator.push_back(FM);}
362  void AddMultiplicator(Material *M,int reaction,double constant=1);
363  void AddMultiplicator(Material *M,Reaction *R,double constant=1);
364 
370  void AddEnergy(int NE,double *E);
376  void AddEnergy(vector<double>E);
385  void AddEnergy(int NE,double Emin,double Emax,bool Linear=false);
393  void AddEnergy(double Emin,double Emax,int N_by_Decade=10);
401  void AddMultiGroupEnergy(double Emin,double Emax,double decad_mult=1);
408  void AddTime(int NT,double *T);
417  void AddTime(int NT,double Tmin,double Tmax,bool Linear=false);
426  void AddTime(double Tmin,double Tmax,int N_by_Decade=10);
433  void AddFluenceToDoseConversion(bool ELinear=false,bool CFLinear=false);
434 
435  string Print();
436  string PrintFM();
437  void PrintET(ofstream &Out);
438 
439 
440  bool NeedVolume();
441  int GetNumber(){return fNumber;}
442  vector<double> GetBinVolume(int i);
443  double GetBinSurface(int i);
444  void SetBinSurface(int i,double S);
445  void SetBinVolume(int i,double V,int k=0);
446  TallyBin* GetBin(int i){return fBin[i];}
447  vector<TallyBin*> &GetBin(){return fBin;}
448  int GetType(){return fType;}
449  void SetType(int type){fType=type;}
450  int IsInTallyBin(int num);
451  string GetParticle(){return fParticle;}
452  void SkipVolumeCalculation(){fSkipVolumeCalc=true;}
453  bool IsVolumeCalculationSkept(){return fSkipVolumeCalc;}
454  void SetParticleN(){fParticle="N";}
455  void SetParticleNP(){fParticle="N,P";}
456  void SetParticleNE(){fParticle="N,E";}
457  void SetParticleNPE(){fParticle="N,P,E";}
458  void SetComment(string str){fComment=str;}
459  void SetParentheses(bool flag=true){fParentheses=flag;}
460  vector<TallyFM*> &GetMultiplicator(){return fMultiplicator;}
461 
462  vector<double> GetEnergyBinningVector() {return fE;}
463  void SetETBinForAllTallies(bool flag=true){fETBinForAllTallies=flag;}
464  void SetNotPrintable(bool flag=true){fNotPrintable=flag;}
465 
466  private:
467  int fType;
468  int fNumber;
469  string fParticle;
470  int fLinearT;
471  vector <double> fT;
472  int fLinearE;
473  vector <double> fE;
474  vector<TallyBin*> fBin;
475  vector<TallyFM*> fMultiplicator;
477  string fComment;
481  bool fStar;
482  vector<double> fEnergy;
483  vector<double> fConversionFactor;
486 
487 };
488 
489 
490 
491 
492 #endif
vector< TallyBin * > fBin
array of Cell/Surface bin
Definition: Tally.hxx:474
virtual ~SimpleBin()
Destructor.
Definition: Tally.hxx:116
virtual bool IsSimpleBin()
if the TallyBin is a SimpleBin
Definition: Tally.hxx:41
A Cell is a MCNP cell.
Definition: Cell.hxx:48
bool fCFLinearFTD
whether linear or log interpolation is done on FTD
Definition: Tally.hxx:485
bool IsGroupBin()
This is a GroupBin.
Definition: Tally.hxx:154
void AddSurface(int num)
Set the number of the surface for the above Constructor.
Definition: Tally.hxx:118
vector< int > GetCode()
return the reaction code array
Definition: Tally.hxx:241
int fLinearT
Number of time bins for linear binning (0 when non-linear)
Definition: Tally.hxx:470
Definition: Tally.hxx:15
vector< TallyBin * > & GetBin()
returns the bin vector
Definition: Tally.hxx:447
Definition: Tally.hxx:15
TallyBin * Clone()
Clone method.
Definition: Tally.hxx:115
TallyBin * Clone()
Clone method.
Definition: Tally.hxx:151
vector< double > GetVolume()
retruns the bin volume vector.
Definition: Tally.hxx:59
TallyType
Define tally type according to MCNP notation (1=Current/surf, 2=flux/surf, 4=flux/cell,...)
Definition: Tally.hxx:14
bool fNotPrintable
True for not printable tallies.
Definition: Tally.hxx:480
void SetComment(string str)
Set the tally comment (Added by T. Courau)
Definition: Tally.hxx:458
Define a Tally Multiplicator entry (FM card in MCNP).
Definition: Tally.hxx:254
vector< TallyBin * > fBin
the TallyBin vector
Definition: Tally.hxx:164
int GetNumber()
returns Tally number (1,11,21,...,4,14...)
Definition: Tally.hxx:441
void SetParticleNE()
Set the particle to Neutron and Electron.
Definition: Tally.hxx:456
Reaction(int code)
Build a Reaction with a given code.
Definition: Tally.hxx:237
vector< double > GetEnergyBinningVector()
return the vector of energy bins
Definition: Tally.hxx:462
virtual bool IsGroupBin()
if the TallyBin is a GroupBin
Definition: Tally.hxx:42
bool fELinearFTD
whether linear or log interpolation is done on fEnergy for FTD
Definition: Tally.hxx:484
double fConstant
multiplicative constant of the FM
Definition: Tally.hxx:307
vector< bool > fIsBinUniverse
flag to know if an element of fBin corresponds to a universe
Definition: Tally.hxx:128
bool fETBinForAllTallies
true Energy/time binning for all tallies (E0 or T0 in MCNP)
Definition: Tally.hxx:479
string fComment
Tally coment (Added by T. Courau)
Definition: Tally.hxx:477
vector< vector< bool > > fHasPosition
flag to know if a given cell has restricted positions in a lattice
Definition: Tally.hxx:218
void SetType(int type)
returns the Tally type (1,2 for surface tally, 4,.. for cell tally)
Definition: Tally.hxx:449
int fNumber
Tally number.
Definition: Tally.hxx:468
TallyBin * GetBin(int i)
returns the ith bin of the Tally
Definition: Tally.hxx:446
Define Lattice Cell type bin.
Definition: Tally.hxx:179
int GetCellType()
returns -1, 0, 1 in function of the bin type.
Definition: Tally.hxx:48
Define group a cell or surface bin.
Definition: Tally.hxx:143
Define a general MCNP Tally Bin (cell or surface).
Definition: Tally.hxx:31
vector< vector< string > > fPosition
array of the positions of each cell in each level.
Definition: Tally.hxx:219
void Add(TallyFM *FM)
add a Tally Multiplicator
Definition: Tally.hxx:361
Definition: Tally.hxx:14
bool IsVolumeCalculationSkept()
Whether or not try to calculate Volume/Surface.
Definition: Tally.hxx:453
vector< double > fE
vector of Energy bins
Definition: Tally.hxx:473
Define a MCNP Tally.
Definition: Tally.hxx:324
bool fStar
true if fType&lt;0 use if you want to print a * before f (for instance *f8:P change the unit of the tall...
Definition: Tally.hxx:481
void SetNotPrintable(bool flag=true)
True for not printable tallies (private used)
Definition: Tally.hxx:464
vector< int > fCode
the reaction code list
Definition: Tally.hxx:244
vector< double > fT
array of [fNT+1] Time bins
Definition: Tally.hxx:471
bool fParentheses
Enclose bins in parentheses.
Definition: Tally.hxx:478
Tally * Clone()
Definition: Tally.hxx:354
int GetNumberOfVolume()
Definition: Tally.hxx:66
virtual bool IsInBin(int num)
whether or not the cell/suface &quot;num&quot; is in the tally bin
Definition: Tally.hxx:88
string fParticle
Particle Type (N,P,..)
Definition: Tally.hxx:469
virtual string Print(int BeforeRparenthesis=0)
Print the TallyBin in MCNP.
Definition: Tally.hxx:49
int fMatNumber
Material Number of the FM.
Definition: Tally.hxx:308
TallyBin * Clone()
Clone method.
Definition: Tally.hxx:187
Define a Reaction list for Tally multiplicator inputs.
Definition: Tally.hxx:233
File including all headers.
vector< vector< TallyBin * > > fLevel
array of array of TallyBin.
Definition: Tally.hxx:217
vector< TallyFM * > & GetMultiplicator()
return Multiplicator vector
Definition: Tally.hxx:460
void SetParticleNPE()
Set the particle to Neutron, Photon and Electron.
Definition: Tally.hxx:457
bool fSkipVolumeCalc
flag to know whether or not try to calculate Volume/Surface
Definition: Tally.hxx:476
double GetSurface()
retruns the bin surface
Definition: Tally.hxx:65
vector< TallyFM * > fMultiplicator
array of Multiplicator bin
Definition: Tally.hxx:475
Definition: Tally.hxx:14
int fCellType
type of the bin (-1=unknown, 0=surface, 1=cell)
Definition: Tally.hxx:92
void SetETBinForAllTallies(bool flag=true)
Set Energy/time binning for all tallies (E0 or T0 in MCNP)
Definition: Tally.hxx:463
vector< double > fConversionFactor
fluence-to-dose conversion factor (FTD)
Definition: Tally.hxx:483
double GetVolume(int i)
retruns the ith bin volume vector.
Definition: Tally.hxx:64
int fLinearE
Number of energy bins for linear binning (0 when non-linear)
Definition: Tally.hxx:472
string GetParticle()
return particle type (neutron,...)
Definition: Tally.hxx:451
A Material constituing a Cell.
Definition: Material.hxx:53
virtual ~TallyBin()
Definition: Tally.hxx:38
vector< double > fEnergy
Energy bin vector.
Definition: Tally.hxx:482
virtual bool IsLatticeBin()
Definition: Tally.hxx:43
double fSurface
bin surface
Definition: Tally.hxx:94
void SetParentheses(bool flag=true)
Put parentheses arround cell/surf bin to obtain 1 result (like GroupBin)
Definition: Tally.hxx:459
virtual bool NeedVolume()
Definition: Tally.hxx:54
vector< vector< TallyBin * > > GetLevelVector()
Returns the fLevel vector, (used in Tally::SetBinVolume();)
Definition: Tally.hxx:214
vector< double > fVolume
bin volume vector (1 value except for LatticeBin or Universe)
Definition: Tally.hxx:93
bool IsSimpleBin()
This is a SimpleBin.
Definition: Tally.hxx:121
Define a Simple Bin.
Definition: Tally.hxx:107
vector< char > fOperator
the operator list (&quot;:&quot; for addition, &quot; &quot; for multiplicatio)
Definition: Tally.hxx:245
int GetType()
returns the Tally type (1,2 for surface tally, 4,.. for cell tally)
Definition: Tally.hxx:448
int GetMaterial()
Definition: Tally.hxx:303
virtual TallyBin * Clone()
Destructor.
Definition: Tally.hxx:39
Reaction * fReaction
Reaction of the FM.
Definition: Tally.hxx:309
void SetParticleN()
Set the particle to Neutron.
Definition: Tally.hxx:454
Definition: Tally.hxx:14
void SkipVolumeCalculation()
Do not try to calculate Volume/Surface.
Definition: Tally.hxx:452
void SetParticleNP()
Set the particle to Neutron and Photon.
Definition: Tally.hxx:455
bool IsLatticeBin()
This is a LatticeBin.
Definition: Tally.hxx:189
int fType
Tally type.
Definition: Tally.hxx:467
vector< int > fBin
the cell number or surface number(s)
Definition: Tally.hxx:127

MURE Project, documentation generated by Doxygen 1.8.5 - Mon Nov 17 2014