Geant4 Cross Reference |
1 /* 1 2 # <<BEGIN-copyright>> 3 # <<END-copyright>> 4 */ 5 6 #include <iostream> 7 #include <stdlib.h> 8 9 #include "GIDI_settings.hh" 10 11 /* ---- GIDI_settings_flux_order ---- */ 12 /* 13 ============================================== 14 */ 15 GIDI_settings_flux_order::GIDI_settings_flux_o 16 17 if( order < 0 ) throw 1; 18 mOrder = order; 19 } 20 /* 21 ============================================== 22 */ 23 GIDI_settings_flux_order::GIDI_settings_flux_o 24 25 initialize( order, length, energies, fluxe 26 } 27 /* 28 ============================================== 29 */ 30 GIDI_settings_flux_order::GIDI_settings_flux_o 31 32 int length = (int) energies.size( ); 33 34 if( length != (int) fluxes.size( ) ) throw 35 initialize( order, length, &(energies[0]), 36 } 37 /* 38 ============================================== 39 */ 40 GIDI_settings_flux_order::GIDI_settings_flux_o 41 42 initialize( fluxOrder.mOrder, fluxOrder.si 43 } 44 /* 45 ============================================== 46 */ 47 void GIDI_settings_flux_order::initialize( int 48 49 if( order < 0 ) throw 1; 50 mOrder = order; 51 mEnergies.resize( length, 0 ); 52 mFluxes.resize( length, 0 ); 53 for( int i1 = 0; i1 < length; ++i1 ) mEner 54 for( int i1 = 0; i1 < length; ++i1 ) mFlux 55 } 56 /* 57 ============================================== 58 */ 59 GIDI_settings_flux_order& GIDI_settings_flux_o 60 if ( this != &fluxOrder ) { 61 initialize( fluxOrder.mOrder, fluxOrder.si 62 } 63 return *this; 64 } 65 /* 66 ============================================== 67 */ 68 GIDI_settings_flux_order::~GIDI_settings_flux_ 69 70 } 71 /* 72 ============================================== 73 */ 74 void GIDI_settings_flux_order::print( int valu 75 76 int nE = (int) mEnergies.size( ); 77 bool printIndent = true; 78 char buffer[2 * 128]; 79 80 std::cout << " ORDER: " << mOrder << st 81 for( int iE = 0; iE < nE; ++iE ) { 82 if( printIndent ) std::cout << " "; 83 printIndent = false; 84 snprintf( buffer, sizeof buffer, " % 85 std::cout << buffer; 86 if( ( ( iE + 1 ) % valuesPerLine ) == 87 std::cout << std::endl; 88 printIndent = true; 89 } 90 } 91 if( nE % valuesPerLine ) std::cout << std: 92 } 93 94 /* ---- GIDI_settings_flux ---- */ 95 /* 96 ============================================== 97 */ 98 GIDI_settings_flux::GIDI_settings_flux( std::s 99 100 mLabel = label; 101 mTemperature = temperature; 102 } 103 /* 104 ============================================== 105 */ 106 GIDI_settings_flux::GIDI_settings_flux( char c 107 108 mLabel = label; 109 mTemperature = temperature; 110 } 111 /* 112 ============================================== 113 */ 114 GIDI_settings_flux::GIDI_settings_flux( GIDI_s 115 116 mLabel = flux.getLabel( ); 117 mTemperature = flux.mTemperature; 118 for( std::vector<GIDI_settings_flux_order> 119 } 120 /* 121 ============================================== 122 */ 123 GIDI_settings_flux& GIDI_settings_flux::operat 124 if ( this != &flux ) { 125 mLabel = flux.getLabel(); 126 mTemperature = flux.mTemperature; 127 for( std::vector<GIDI_settings_flux_order> 128 } 129 return *this; 130 } 131 /* 132 ============================================== 133 */ 134 GIDI_settings_flux::~GIDI_settings_flux( ) { 135 136 } 137 /* 138 ============================================== 139 */ 140 GIDI_settings_flux_order const *GIDI_settings_ 141 142 return( &(mFluxOrders[index]) ); 143 } 144 /* 145 ============================================== 146 */ 147 void GIDI_settings_flux::addFluxOrder( GIDI_se 148 /* 149 * Orders can only be added in sequence (e.g. 150 */ 151 int order = fluxOrder.getOrder( ); 152 153 if( order > (int) mFluxOrders.size( ) ) th 154 mFluxOrders.push_back( fluxOrder ); 155 } 156 /* 157 ============================================== 158 */ 159 void GIDI_settings_flux::print( bool outline, 160 161 std::cout << "FLUX: label = '" << mLabel < 162 if( outline ) return; 163 for( std::vector<GIDI_settings_flux_order> 164 } 165 166 #if 0 167 /* ---- GIDI_settings_fluxes_from_bdfls ---- 168 /* 169 ============================================== 170 */ 171 GIDI_settings_fluxes_from_bdfls::GIDI_settings 172 173 initialize( fileName.c_str( ), temperature 174 } 175 /* 176 ============================================== 177 */ 178 GIDI_settings_fluxes_from_bdfls::GIDI_settings 179 180 initialize( fileName, temperature_MeV ); 181 } 182 /* 183 ============================================== 184 */ 185 GIDI_settings_fluxes_from_bdfls::GIDI_settings 186 187 initialize2( bdfls, temperature_MeV ); 188 } 189 /* 190 ============================================== 191 */ 192 void GIDI_settings_fluxes_from_bdfls::initiali 193 194 cbdfls_file *bdfls; 195 cbdflsErrors Error; 196 197 if( ( bdfls = cbdflsOpen( fileName, &Error 198 initialize2( bdfls, temperature_MeV ); 199 cbdflsRelease( bdfls ); 200 } 201 /* 202 ============================================== 203 */ 204 void GIDI_settings_fluxes_from_bdfls::initiali 205 206 int nf, length, *fids, order; 207 double *energies, *fluxes; 208 char label[100]; 209 210 nf = cbdflsFIDs( (cbdfls_file *) bdfls, &f 211 for( int if1 = 0; if1 < nf; ++if1 ) { 212 snprintf( label, sizeof label, "LLNL_f 213 GIDI_settings_flux flux = GIDI_setting 214 order = cbdflsGetFluxOrder( (cbdfls_fi 215 for( int io = 0; io <= order; ++io ) { 216 length = cbdflsGetFlux( (cbdfls_fi 217 GIDI_settings_flux_order flux_orde 218 flux.addFluxOrder( flux_order ); 219 } 220 mFluxes.push_back( flux ); 221 } 222 return; 223 } 224 /* 225 ============================================== 226 */ 227 GIDI_settings_fluxes_from_bdfls::~GIDI_setting 228 229 } 230 /* 231 ============================================== 232 */ 233 GIDI_settings_flux GIDI_settings_fluxes_from_b 234 235 char label[100]; 236 237 snprintf( label, sizeof label, "LLNL_fid_% 238 for( int if1 = 0; if1 < (int) mFluxes.size 239 if( mFluxes[if1].isLabel( label ) ) re 240 } 241 throw 1; 242 } 243 /* 244 ============================================== 245 */ 246 std::vector<std::string> GIDI_settings_fluxes_ 247 248 int size = (int) mFluxes.size( ); 249 std::vector<std::string> labels( size ); 250 251 for( int if1 = 0; if1 < size; ++if1 ) labe 252 return( labels ); 253 } 254 /* 255 ============================================== 256 */ 257 std::vector<int> GIDI_settings_fluxes_from_bdf 258 259 int size = (int) mFluxes.size( ); 260 std::vector<int> fids( size ); 261 char *e; 262 263 for( int if1 = 0; if1 < size; ++if1 ) { 264 fids[if1] = (int) strtol( &(mFluxes[if 265 } 266 return( fids ); 267 } 268 /* 269 ============================================== 270 */ 271 void GIDI_settings_fluxes_from_bdfls::print( b 272 273 int nfs = (int) mFluxes.size( ); 274 275 std::cout << "BDFLS FLUXes: number of flux 276 for( int if1 = 0; if1 < nfs ; ++if1 ) mFlu 277 } 278 #endif 279