17 if( order < 0 )
throw 1;
25 initialize( order, length, energies, fluxes );
32 int length = (int) energies.size( );
34 if( length != (
int) fluxes.size( ) )
throw 1;
35 initialize( order, length, &(energies[0]), &(fluxes[0]) );
42 initialize( fluxOrder.mOrder, fluxOrder.
size( ), &(fluxOrder.mEnergies[0]), &(fluxOrder.mFluxes[0]) );
47void GIDI_settings_flux_order::initialize(
int order,
int length,
double const *energies,
double const *fluxes ) {
49 if( order < 0 )
throw 1;
51 mEnergies.resize( length, 0 );
52 mFluxes.resize( length, 0 );
53 for(
int i1 = 0; i1 < length; ++i1 ) mEnergies[i1] = energies[i1];
54 for(
int i1 = 0; i1 < length; ++i1 ) mFluxes[i1] = fluxes[i1];
60 if (
this != &fluxOrder ) {
61 initialize( fluxOrder.mOrder, fluxOrder.
size(), &(fluxOrder.mEnergies[0]), &(fluxOrder.mFluxes[0]) );
76 int nE = (int) mEnergies.size( );
77 bool printIndent =
true;
80 std::cout <<
" ORDER: " << mOrder << std::endl;
81 for(
int iE = 0; iE < nE; ++iE ) {
82 if( printIndent ) std::cout <<
" ";
84 sprintf(
buffer,
" %15.8e %15.8e", mEnergies[iE], mFluxes[iE] );
86 if( ( ( iE + 1 ) % valuesPerLine ) == 0 ) {
87 std::cout << std::endl;
91 if( nE % valuesPerLine ) std::cout << std::endl;
101 mTemperature = temperature;
109 mTemperature = temperature;
117 mTemperature = flux.mTemperature;
118 for( std::vector<GIDI_settings_flux_order>::const_iterator iter = flux.mFluxOrders.begin( ); iter < flux.mFluxOrders.end( ); ++iter )
addFluxOrder( *iter );
124 if (
this != &flux ) {
126 mTemperature = flux.mTemperature;
127 for( std::vector<GIDI_settings_flux_order>::const_iterator iter = flux.mFluxOrders.begin( ); iter < flux.mFluxOrders.end( ); ++iter )
addFluxOrder( *iter );
142 return( &(mFluxOrders[index]) );
153 if( order > (
int) mFluxOrders.size( ) )
throw 1;
154 mFluxOrders.push_back( fluxOrder );
161 std::cout <<
"FLUX: label = '" << mLabel <<
"': maximum order = " << (
size( ) + 1 ) << std::endl;
162 if( outline )
return;
163 for( std::vector<GIDI_settings_flux_order>::const_iterator iter = mFluxOrders.begin( ); iter < mFluxOrders.end( ); ++iter ) iter->print( valuesPerLine );
171GIDI_settings_fluxes_from_bdfls::GIDI_settings_fluxes_from_bdfls( std::string
const &fileName,
double temperature_MeV = 0 ) {
173 initialize( fileName.c_str( ), temperature_MeV );
178GIDI_settings_fluxes_from_bdfls::GIDI_settings_fluxes_from_bdfls(
char const *fileName,
double temperature_MeV = 0 ) {
185GIDI_settings_fluxes_from_bdfls::GIDI_settings_fluxes_from_bdfls( cbdfls_file
const *bdfls,
double temperature_MeV = 0 ) {
187 initialize2( bdfls, temperature_MeV );
192void GIDI_settings_fluxes_from_bdfls::initialize(
char const *fileName,
double temperature_MeV ) {
197 if( ( bdfls = cbdflsOpen( fileName, &Error ) ) == NULL )
throw Error;
198 initialize2( bdfls, temperature_MeV );
199 cbdflsRelease( bdfls );
204void GIDI_settings_fluxes_from_bdfls::initialize2( cbdfls_file
const *bdfls,
double temperature_MeV ) {
206 int nf, length, *fids, order;
207 double *energies, *fluxes;
210 nf = cbdflsFIDs( (cbdfls_file *) bdfls, &fids );
211 for(
int if1 = 0; if1 < nf; ++if1 ) {
212 sprintf( label,
"LLNL_fid_%.3d", fids[if1] );
214 order = cbdflsGetFluxOrder( (cbdfls_file *) bdfls, fids[if1] );
215 for(
int io = 0; io <= order; ++io ) {
216 length = cbdflsGetFlux( (cbdfls_file *) bdfls, fids[if1], io, &energies, &fluxes );
220 mFluxes.push_back( flux );
227GIDI_settings_fluxes_from_bdfls::~GIDI_settings_fluxes_from_bdfls( ) {
237 sprintf( label,
"LLNL_fid_%.3d", fid );
238 for(
int if1 = 0; if1 < (int) mFluxes.size( ); ++if1 ) {
239 if( mFluxes[if1].isLabel( label ) )
return( mFluxes[if1] );
246std::vector<std::string> GIDI_settings_fluxes_from_bdfls::getLabels(
void ) {
248 int size = (int) mFluxes.size( );
249 std::vector<std::string> labels( size );
251 for(
int if1 = 0; if1 < size; ++if1 ) labels[if1] = mFluxes[if1].getLabel( );
257std::vector<int> GIDI_settings_fluxes_from_bdfls::getFIDs(
void ) {
259 int size = (int) mFluxes.size( );
260 std::vector<int> fids( size );
263 for(
int if1 = 0; if1 < size; ++if1 ) {
264 fids[if1] = (int) strtol( &(mFluxes[if1].getLabel( ).c_str( )[9]), &e, 10 );
271void GIDI_settings_fluxes_from_bdfls::print(
bool outline,
int valuesPerLine ) {
273 int nfs = (int) mFluxes.size( );
275 std::cout <<
"BDFLS FLUXes: number of fluxes = " << nfs << std::endl;
276 for(
int if1 = 0; if1 < nfs ; ++if1 ) mFluxes[if1].
print( outline, valuesPerLine );
void print(G4double elem)
GIDI_settings_flux_order & operator=(const GIDI_settings_flux_order &fluxOrder)
~GIDI_settings_flux_order()
GIDI_settings_flux_order(int order)
void print(int valuesPerLine=10) const
GIDI_settings_flux_order const * operator[](int order) const
void print(bool outline=true, int valuesPerLine=10) const
GIDI_settings_flux(std::string const &label, double temperature_MeV)
void addFluxOrder(GIDI_settings_flux_order const &fluxOrder)
std::string getLabel() const
GIDI_settings_flux & operator=(const GIDI_settings_flux &flux)
void initialize(Config const *const theConfig)
Initialize the clustering model based on the Config object.