Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GIDI_settings.hh
Go to the documentation of this file.
1 /*
2 # <<BEGIN-copyright>>
3 # <<END-copyright>>
4 */
5 
6 #define GIDI_USE_BDFLS 0
7 
8 #ifndef GIDI_settings_hpp_included
9 #define GIDI_settings_hpp_included 1
10 
11 #include <string>
12 #include <vector>
13 #include <map>
14 
15 #include <ptwX.h>
16 #include <ptwXY.h>
17 #include <statusMessageReporting.h>
18 
19 /* Disable Effective C++ warnings in GIDI header files. */
20 #if defined( __INTEL_COMPILER )
21 #pragma warning( push )
22 
23 #if __INTEL_COMPILER > 1399
24 #pragma warning( disable:2021 )
25 #elif __INTEL_COMPILER > 1199
26 #pragma warning( disable:2304 )
27 #endif
28 
29 #endif
30 
31 #define GIDI_settings_projectileEnergyMode_continuousEnergy 1
32 #define GIDI_settings_projectileEnergyMode_grouped ( 1 << 1 )
33 #define GIDI_settings_projectileEnergyMode_fixedGrid ( 1 << 2 )
34 
36 
37  private:
38  std::string mLabel;
39  std::vector<double> mBoundaries;
40 
41  public:
42  GIDI_settings_group( std::string const &label = "empty", int size = 0 );
43  GIDI_settings_group( std::string const &label, int length, double const *values );
44  GIDI_settings_group( std::string const &label, std::vector<double> const &boundaries );
47 
48  inline double operator[]( int const index ) const { return( mBoundaries[index] ); }
49  inline int size( void ) const { return( (int) mBoundaries.size( ) ); }
50  inline int getNumberOfGroups( void ) const { return( (int) ( mBoundaries.size( ) - 1 ) ); }
51  inline double const *pointer( void ) const { return( &(mBoundaries[0]) ); }
52 
53  void setFromCDoubleArray( int length, double *values );
54  inline std::string getLabel( ) const { return( mLabel ); }
55  int getGroupIndexFromEnergy( double energy, bool encloseOutOfRange ) const;
56  inline bool isLabel( std::string &label ) const { return( label == mLabel ); }
57  void print( bool outline = false, int valuesPerLine = 10 ) const;
58 
59  private:
60  void initialize( std::string const &label, int size, int length, double const *values );
61 };
62 
63 #if GIDI_USE_BDFLS
64 #include <cbdfls.h>
65 
66 class GIDI_settings_groups_from_bdfls {
67 
68  private:
69  std::vector<GIDI_settings_group> mGroups;
70 
71  public:
72  GIDI_settings_groups_from_bdfls( std::string const &fileName );
73  GIDI_settings_groups_from_bdfls( char const *fileName );
74  GIDI_settings_groups_from_bdfls( cbdfls_file const *bdfls );
75  ~GIDI_settings_groups_from_bdfls( );
76 
77  GIDI_settings_group getViaGID( int gid ) const;
78  std::vector<std::string> getLabels( void ) const;
79  std::vector<int> getGIDs( void ) const;
80  void print( bool outline = true, int valuesPerLine = 10 ) const;
81 
82  private:
83  void initialize( char const *fileName );
84  void initialize2( cbdfls_file const *bdfls );
85 };
86 #endif
87 
92 
93  private:
94  int mOrder;
95  std::vector<double> mEnergies;
96  std::vector<double> mFluxes;
98  public:
99  GIDI_settings_flux_order( int order );
100  GIDI_settings_flux_order( int order ,
101  int length ,
102  double const *energies ,
103  double const *fluxes );
104  GIDI_settings_flux_order( int order ,
105  std::vector<double> const &energies ,
106  std::vector<double> const &fluxes );
109 
110  inline int getOrder( void ) const { return( mOrder ); }
111  inline int size( void ) const { return( (int) mEnergies.size( ) ); }
112  inline double const *getEnergies( void ) const { return( &(mEnergies[0]) ); }
113  inline double const *getFluxes( void ) const { return( &(mFluxes[0]) ); }
114  void print( int valuesPerLine = 10 ) const;
115 
116  private:
117  void initialize( int order, int length, double const *energies, double const *fluxes );
118 };
119 
121 
122  private:
123  std::string mLabel;
124  double mTemperature;
125  std::vector<GIDI_settings_flux_order> mFluxOrders;
127  public:
128  GIDI_settings_flux( std::string const &label, double temperature_MeV );
129  GIDI_settings_flux( char const *label, double temperature_MeV );
130  GIDI_settings_flux( GIDI_settings_flux const &flux );
132 
133  GIDI_settings_flux_order const *operator[]( int order ) const;
134  inline int getMaxOrder( void ) const { return( (int) mFluxOrders.size( ) - 1 ); }
135  inline int size( void ) const { return( (int) mFluxOrders.size( ) ); }
136 
137  inline std::string getLabel( ) const { return( mLabel ); }
138  inline bool isLabel( std::string const &label ) const { return( label == mLabel ); }
139  inline bool isLabel( char const *label ) const { return( label == mLabel ); }
140  inline double getTemperature( ) const { return( mTemperature ); }
141  void addFluxOrder( GIDI_settings_flux_order const &fluxOrder );
142  void print( bool outline = true, int valuesPerLine = 10 ) const;
143 };
144 
145 #if GIDI_USE_BDFLS
146 class GIDI_settings_fluxes_from_bdfls {
147 
148  private:
149  std::vector<GIDI_settings_flux> mFluxes;
150 
151  public:
152  GIDI_settings_fluxes_from_bdfls( std::string const &fileName, double temperature_MeV );
153  GIDI_settings_fluxes_from_bdfls( char const *fileName, double temperature_MeV );
154  GIDI_settings_fluxes_from_bdfls( cbdfls_file const *bdfls, double temperature_MeV );
155  ~GIDI_settings_fluxes_from_bdfls( );
156 
157  GIDI_settings_flux getViaFID( int fid );
158  std::vector<std::string> getLabels( void );
159  std::vector<int> getFIDs( void );
160  void print( bool outline = true, int valuesPerLine = 10 );
161 
162  private:
163  void initialize( char const *fileName, double temperature_MeV );
164  void initialize2( cbdfls_file const *bdfls, double temperature_MeV );
165 };
166 #endif
167 
169 
170  private:
171  GIDI_settings_flux mFlux;
172  std::vector<GIDI::ptwXYPoints *> mFluxXY; /* Same as mFlux but stored as ptwXYPoints for each l-order. */
173  std::vector<GIDI::ptwXPoints *> mGroupedFlux; /* mFlux grouped using mGroupX, and stored as ptwXPoints for each l-order. */
174 
175  public:
179 
180  inline double getTemperature( ) const { return( mFlux.getTemperature( ) ); }
182 };
183 
185 
186  private:
187  int mPoPId;
188  bool mTransporting;
189  int mEnergyMode;
190  GIDI_settings_group mGroup;
191  GIDI::ptwXPoints *mGroupX; /* Same as mGroup but stored as ptwXPoints. */
192  std::vector<GIDI_settings_processedFlux> mProcessedFluxes;
193 
194  public:
195  GIDI_settings_particle( int PoPId, bool transporting, int energyMode );
197  int initialize( int PoPId, bool transporting, int energyMode );
199 
201  GIDI_settings_processedFlux const *nearestFluxToTemperature( double temperature ) const;
202  inline int getGroupIndexFromEnergy( double e_in, bool encloseOutOfRange ) const { return( mGroup.getGroupIndexFromEnergy( e_in, encloseOutOfRange ) ); };
203  inline int getNumberOfGroups( void ) const { return( mGroup.getNumberOfGroups( ) ); };
204  inline int getPoPId( void ) const { return( mPoPId ); }
205  inline int getEnergyMode( void ) const { return( mEnergyMode ); }
206  inline bool getTransporting( void ) const { return( mTransporting ); }
207  inline GIDI_settings_group getGroup( void ) const { return( mGroup ); }
208  GIDI_settings_flux const *getFlux( double temperature ) const;
209  GIDI::ptwXPoints *groupFunction( GIDI::statusMessageReporting *smr, GIDI::ptwXYPoints *ptwXY1, double temperature, int order ) const;
210  void setGroup( GIDI_settings_group const &group );
211 
212  inline bool isEnergyMode_continuous( void ) const { return( this->mEnergyMode & GIDI_settings_projectileEnergyMode_continuousEnergy ); }
213  inline bool isEnergyMode_grouped( void ) const { return( this->mEnergyMode & GIDI_settings_projectileEnergyMode_grouped ); }
214  inline bool isEnergyMode_fixedGrid( void ) const { return( this->mEnergyMode & GIDI_settings_projectileEnergyMode_fixedGrid ); }
215 
216  private:
217  GIDI_settings_flux const *getProcessedFlux( double temperature ) const;
218 };
219 
221 
222  private:
223  std::map<int, GIDI_settings_particle> mParticles;
224 
225  public:
226  GIDI_settings( );
227  ~GIDI_settings( );
228 
229  int addParticle( GIDI_settings_particle const &particle );
230  GIDI_settings_particle const *getParticle( int PoPId ) const;
231  int eraseParticle( int PoPId );
232  void releaseMemory( ) { mParticles.clear( ); }
233 };
234 
235 #if defined( __INTEL_COMPILER )
236 #pragma warning( pop )
237 #endif
238 
239 #endif // End of GIDI_settings_hpp_included
GIDI::ptwXPoints * groupFunction(GIDI::statusMessageReporting *smr, GIDI::ptwXPoints *groupX, GIDI::ptwXYPoints *ptwXY1, int order) const
int getNumberOfGroups(void) const
int getNumberOfGroups(void) const
struct statusMessageReporting statusMessageReporting
bool isEnergyMode_continuous(void) const
GIDI::ptwXPoints * groupFunction(GIDI::statusMessageReporting *smr, GIDI::ptwXYPoints *ptwXY1, double temperature, int order) const
double const * getEnergies(void) const
GIDI_settings_flux const * getFlux(double temperature) const
bool isEnergyMode_fixedGrid(void) const
int addFlux(GIDI::statusMessageReporting *smr, GIDI_settings_flux const &flux)
GIDI_settings_particle(int PoPId, bool transporting, int energyMode)
struct ptwXYPoints_s ptwXYPoints
void print(int valuesPerLine=10) const
GIDI_settings_group(std::string const &label="empty", int size=0)
void setGroup(GIDI_settings_group const &group)
GIDI_settings_group getGroup(void) const
int size(void) const
double getTemperature() const
GIDI_settings_processedFlux(GIDI_settings_flux const &flux, GIDI::ptwXPoints *groupX)
int addParticle(GIDI_settings_particle const &particle)
GIDI_settings_flux_order const * operator[](int order) const
GIDI_settings_particle const * getParticle(int PoPId) const
int getOrder(void) const
double const * getFluxes(void) const
struct ptwXPoints_s ptwXPoints
double operator[](int const index) const
void print(bool outline=true, int valuesPerLine=10) const
GIDI_settings_processedFlux const * nearestFluxToTemperature(double temperature) const
int getMaxOrder(void) const
double const * pointer(void) const
int getGroupIndexFromEnergy(double e_in, bool encloseOutOfRange) const
void initialize(Config const *const theConfig)
Initialize the clustering model based on the Config object.
void print(G4double elem)
int getEnergyMode(void) const
void print(bool outline=false, int valuesPerLine=10) const
int eraseParticle(int PoPId)
bool isLabel(std::string &label) const
int size(void) const
int getGroupIndexFromEnergy(double energy, bool encloseOutOfRange) const
void releaseMemory()
G4double energy(const ThreeVector &p, const G4double m)
std::string getLabel() const
double getTemperature() const
bool isLabel(std::string const &label) const
int getPoPId(void) const
#define GIDI_settings_projectileEnergyMode_fixedGrid
bool getTransporting(void) const
bool isLabel(char const *label) const
GIDI_settings_flux(std::string const &label, double temperature_MeV)
void setFromCDoubleArray(int length, double *values)
#define GIDI_settings_projectileEnergyMode_grouped
bool isEnergyMode_grouped(void) const
int initialize(int PoPId, bool transporting, int energyMode)
std::string getLabel() const
#define GIDI_settings_projectileEnergyMode_continuousEnergy
void addFluxOrder(GIDI_settings_flux_order const &fluxOrder)