00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include <vector>
00039
00040 #include "endl_formats.hpp"
00041 #include "messaging.hpp"
00042 #include "mf14table.hpp"
00043
00044 extern ENDLClass ENDL;
00045
00046
00047
00048 void MF14_table_raw::read_data( mf14_file& angle_file, int num_gamma )
00049 {
00050 int NR;
00051 int NE;
00052 double EG;
00053
00054 mf4_table new_table;
00055 MF14_table_raw::iterator this_data;
00056
00057
00058 for( int count = 0; count < num_gamma; ++count )
00059 {
00060
00061 angle_file.read_EG( &EG, &NR, &NE );
00062
00063
00064 insert( begin( ), new_table );
00065 this_data = begin( );
00066
00067
00068 this_data->E_gamma( ) = EG * ENDL.eV2MeV;
00069
00070
00071 angle_file.get_regions( NR, this_data->NBT, this_data->INT );
00072
00073
00074 this_data->read_data( angle_file, NE );
00075
00076
00077 this_data->set_interp( );
00078 }
00079 }
00080
00081 void MF14_table_raw::fill_E_in( )
00082
00083 {
00084 list< double > E_in_list;
00085 list< double >::iterator E_in_ptr;
00086 MF14_table_raw::iterator this_gamma;
00087 mf4_table::iterator this_E;
00088 double E_in;
00089
00090
00091 for( this_gamma = begin( ); this_gamma != end( ); ++this_gamma )
00092 {
00093
00094 for( this_E = this_gamma->begin( ); this_E != this_gamma->end( );
00095 ++this_E )
00096 {
00097 E_in = this_E->E_in( );
00098 E_in_list.push_back( E_in );
00099 }
00100 }
00101
00102 E_in_list.sort( );
00103
00104
00105 E_in_list.unique( );
00106
00107
00108 for( this_gamma = begin( ); this_gamma != end( ); ++this_gamma )
00109 {
00110 one_d_table new_table;
00111 mf4_table::iterator new_table_ptr;
00112 mf4_table::iterator prev_E;
00113
00114
00115 this_E = this_gamma->begin( );
00116 E_in = this_E->E_in( );
00117
00118
00119 E_in_ptr = E_in_list.begin( );
00120 for( ; *E_in_ptr < E_in; ++E_in_ptr )
00121 {
00122
00123
00124
00125 if( E_in_ptr == E_in_list.end( ) )
00126 {
00127 SevereError( "MF14_table_raw::fill_E_in",
00128 " passed the end of E_in_list" );
00129 }
00130
00131 this_gamma->insert( this_E, new_table );
00132 new_table_ptr = this_E;
00133 --new_table_ptr;
00134 new_table_ptr->copy( *this_E );
00135 new_table_ptr->E_in( ) = *E_in_ptr;
00136 }
00137
00138
00139 for( ; E_in_ptr != E_in_list.end( ); ++E_in_ptr )
00140 {
00141 E_in = *E_in_ptr;
00142
00143
00144 if( this_E == this_gamma->end( ) )
00145 {
00146
00147
00148
00149 this_gamma->insert( this_E, new_table );
00150 new_table_ptr = this_E;
00151 --new_table_ptr;
00152 new_table_ptr->copy( *prev_E );
00153 new_table_ptr->E_in( ) = E_in;
00154 }
00155
00156 else if( this_E->E_in( ) == E_in )
00157 {
00158 prev_E = this_E;
00159 ++this_E;
00160 }
00161 else
00162 {
00163
00164
00165
00166 this_gamma->insert( this_E, new_table );
00167 new_table_ptr = this_E;
00168 --new_table_ptr;
00169 new_table_ptr->list_interp( E_in, *prev_E, *this_E );
00170
00171 }
00172 }
00173 }
00174
00175
00176 fill_mu( );
00177 }
00178
00179 void MF14_table_raw::fill_mu( )
00180
00181 {
00182 list< double > mu_list;
00183 double mu;
00184 vector< mf4_table::iterator > E_in_ptrs;
00185 MF14_table_raw::iterator this_gamma;
00186 one_d_table::iterator this_mu_p;
00187
00188
00189 for( this_gamma = begin( ); this_gamma != end( ); ++this_gamma )
00190 {
00191 mf4_table::iterator E_in_ptr = this_gamma->begin( );
00192 E_in_ptrs.push_back( E_in_ptr );
00193 }
00194 int num_gamma = E_in_ptrs.size( );
00195 int j;
00196
00197
00198 this_gamma = begin( );
00199 for( ; E_in_ptrs[ 0 ] != this_gamma->end( ); )
00200 {
00201
00202 for( j = 0; j < num_gamma; ++j )
00203 {
00204 for( this_mu_p = E_in_ptrs[ j ]->begin( );
00205 this_mu_p != E_in_ptrs[ j ]->end( ); ++this_mu_p )
00206 {
00207 mu = this_mu_p->x;
00208 mu_list.push_back( mu );
00209 }
00210 }
00211
00212 mu_list.sort( );
00213 mu_list.unique( );
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223 for( j = 0; j < num_gamma; ++j )
00224 {
00225 list< double >::iterator mu_list_ptr = mu_list.begin( );
00226 dd_link new_pair;
00227 one_d_table::iterator prev_mu_p;
00228
00229 this_mu_p = E_in_ptrs[ j ]->begin( );
00230 mu = this_mu_p->x;
00231
00232
00233 mu_list_ptr = mu_list.begin( );
00234 for( ; *mu_list_ptr < mu; ++mu_list_ptr )
00235 {
00236
00237
00238
00239
00240 if( mu_list_ptr == mu_list.end( ) )
00241 {
00242 SevereError( "MF14_table_raw::fill_mu",
00243 " passed the end of mu_list" );
00244 }
00245
00246 new_pair.x = *mu_list_ptr;
00247 new_pair.y = 0.0;
00248 E_in_ptrs[ j ]->insert( this_mu_p, new_pair );
00249 }
00250
00251
00252 for( ; mu_list_ptr != mu_list.end( ); ++mu_list_ptr )
00253 {
00254 mu = *mu_list_ptr;
00255
00256
00257 if( this_mu_p == E_in_ptrs[ j ]->end( ) )
00258 {
00259
00260
00261
00262
00263 new_pair.x = *mu_list_ptr;
00264 new_pair.y = 0.0;
00265 E_in_ptrs[ j ]->insert( this_mu_p, new_pair );
00266 }
00267
00268 else if( this_mu_p->mu( ) == mu )
00269 {
00270 prev_mu_p = this_mu_p;
00271 ++this_mu_p;
00272 }
00273 else
00274 {
00275
00276
00277
00278
00279 new_pair.x = *mu_list_ptr;
00280 new_pair.y = E_in_ptrs[ j ]->linlin_interp( new_pair.x,
00281 *prev_mu_p, *this_mu_p );
00282 E_in_ptrs[ j ]->insert( this_mu_p, new_pair );
00283 }
00284 }
00285 }
00286
00287
00288 mu_list.erase( mu_list.begin( ), mu_list.end( ) );
00289
00290
00291 for( j = 0; j < num_gamma; ++j )
00292 {
00293 ++E_in_ptrs[ j ];
00294 }
00295 }
00296 }
00297
00298
00299
00300 void MF14_table::master( mf12_file& mult_file, mf14_file& angle_file,
00301 int num_mf12, int num_mf14 )
00302 {
00303
00304 line_mult.inFile = &mult_file;
00305
00306
00307 int NR;
00308 int NP;
00309 mult_file.read_line2( &NR, &NP );
00310 mult_file.get_regions( NR, multiple.NBT, multiple.INT );
00311 multiple.read_data( NP, mult_file );
00312
00313 if( ENDL.F == 13 )
00314 {
00315 multiple.divide_by_xs( );
00316 }
00317 multiple.write_endl( 9 );
00318
00319
00320 read_mf12( mult_file, num_mf12 );
00321
00322
00323 endf_mf14.read_data( angle_file, num_mf14 );
00324
00325
00326 endf_mf14.fill_E_in( );
00327
00328
00329 mult_weight( );
00330
00331
00332 ENDL_order( );
00333
00334
00335 widen_deltas( );
00336
00337
00338 make_i1( );
00339
00340
00341 write_endl( );
00342 }
00343
00344 void MF14_table::read_mf12( mf12_file& mult_file, int num_mf12 )
00345
00346 {
00347 for( int count = 0; count < num_mf12; ++count )
00348 {
00349 double EG;
00350 double ES;
00351 int LP;
00352 int LF;
00353 int NR;
00354 int NP;
00355
00356 mult_file.gamma_line1( &EG, &ES, &LP, &LF, &NR, &NP );
00357
00358 if( ( LF != 2 ) || ( LP == 2 ) )
00359 {
00360 SevereError( "MF14_table::master", " strange mf12 data" );
00361 }
00362 line_mult.one_line( EG * ENDL.eV2MeV, NR, NP );
00363 }
00364 }
00365
00366 void MF14_table::mult_weight( )
00367
00368 {
00369
00370 MF12_raw::iterator this_mult = line_mult.begin( );
00371
00372 for( MF14_table_raw::iterator this_gamma = endf_mf14.begin( );
00373 this_gamma != endf_mf14.end( ); ++this_gamma, ++this_mult )
00374 {
00375
00376 if( ( this_gamma->E_gamma( ) != this_mult->E_gamma( ) ) ||
00377 this_mult == line_mult.end( ) )
00378 {
00379 SevereError( "MF14_table::mult_weight",
00380 " gamma energy mismatch" );
00381 }
00382
00383
00384 for( mf4_table::iterator this_E = this_gamma->begin( );
00385 this_E != this_gamma->end( ); ++this_E )
00386 {
00387 double mult = this_mult->evaluate( this_E->E_in( ) );
00388
00389 *this_E *= mult;
00390 }
00391 }
00392 }
00393
00394 void MF14_table::ENDL_order( )
00395
00396 {
00397 two_d_ENDL_table ENDL_E_in;
00398 MF14_table::iterator ENDL_E_in_ptr;
00399 mf4_table::iterator E_in_ptr;
00400 MF14_table_raw::iterator this_gamma;
00401 one_d_table::iterator this_mu_p;
00402
00403
00404
00405 this_gamma = endf_mf14.begin( );
00406 for( E_in_ptr = this_gamma->begin( ); E_in_ptr != this_gamma->end( );
00407 ++E_in_ptr )
00408 {
00409
00410 insert( end( ), ENDL_E_in );
00411 ENDL_E_in_ptr = end( );
00412 --ENDL_E_in_ptr;
00413 ENDL_E_in_ptr->E_in( ) = E_in_ptr->E_in( );
00414
00415
00416 for( this_mu_p = E_in_ptr->begin( ); this_mu_p != E_in_ptr->end( );
00417 ++this_mu_p )
00418 {
00419 one_d_table new_table;
00420 new_table.mu( ) = this_mu_p->x;
00421 ENDL_E_in_ptr->insert( ENDL_E_in_ptr->end( ), new_table );
00422 dd_link new_pair;
00423 }
00424 }
00425
00426
00427
00428 for( this_gamma = endf_mf14.begin( ); this_gamma != endf_mf14.end( );
00429 ++this_gamma )
00430 {
00431 double E_gam = this_gamma->E_gamma( );
00432
00433
00434 ENDL_E_in_ptr = begin( );
00435
00436
00437 for( E_in_ptr = this_gamma->begin( ), ENDL_E_in_ptr = begin( );
00438 E_in_ptr != this_gamma->end( ); ++E_in_ptr, ++ENDL_E_in_ptr )
00439 {
00440 dd_link new_pair;
00441 new_pair.x = E_gam;
00442
00443
00444 two_d_ENDL_table::iterator ENDL_mu = ENDL_E_in_ptr->begin( );
00445 for( this_mu_p = E_in_ptr->begin( ); this_mu_p != E_in_ptr->end( );
00446 ++this_mu_p, ++ENDL_mu )
00447 {
00448 new_pair.y = this_mu_p->y;
00449 ENDL_mu->insert( ENDL_mu->end( ), new_pair );
00450 }
00451 }
00452 }
00453 }
00454
00455 void MF14_table::widen_deltas( )
00456
00457 {
00458 for( MF14_table::iterator ENDL_E_in_ptr = begin( );
00459 ENDL_E_in_ptr != end( ); ++ENDL_E_in_ptr )
00460 {
00461 for( two_d_ENDL_table::iterator mu_ptr = ENDL_E_in_ptr->begin( );
00462 mu_ptr != ENDL_E_in_ptr->end( ); ++mu_ptr )
00463 {
00464 mu_ptr->widen_delta( );
00465 }
00466 }
00467 }
00468
00469 void MF14_table::make_i1( )
00470
00471 {
00472 for( MF14_table::iterator ENDL_E_in_ptr = begin( );
00473 ENDL_E_in_ptr != end( ); ++ENDL_E_in_ptr )
00474 {
00475
00476 one_d_table new_cos;
00477 cosines.push_back( new_cos );
00478
00479
00480 two_d_list<one_d_table>::iterator cos_ptr = cosines.end( );
00481 --cos_ptr;
00482 ENDL_E_in_ptr->make_cos_link( ENDL_E_in_ptr->E_in( ), cos_ptr );
00483 }
00484 }