Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

mf5classes.cpp

Go to the documentation of this file.
00001 /*
00002  * ******** fete: From ENDF To ENDL *********
00003  * 
00004  * Copyright (c) 2006, The Regents of the University of California. 
00005  * All rights reserved.
00006  * 
00007  * Produced at the Lawrence Livermore National Laboratory. 
00008  * Written by David A. Brown, Gerry Hedstrom, Tony Hill
00009  * 
00010  * This file is part of fete v1.0  (UCRL-CODE-218718)
00011  * 
00012  * Please read the COPYING file for "Our Notice and GNU General 
00013  * Public License" in the root of this software distribution.  
00014  * 
00015  * This program is free software; you can redistribute it and/or modify 
00016  * it under the terms of the GNU General Public License (as published by 
00017  * the Free Software Foundation) version 2, dated June 1991. 
00018  * 
00019  * This program is distributed in the hope that it will be useful, 
00020  * but WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF 
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms 
00022  * and conditions of the GNU General Public License for more details. 
00023  * 
00024  * You should have received a copy of the GNU General Public License along 
00025  * with this program; if not, write to the Free Software Foundation, Inc., 
00026  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00027  * 
00028  * $Revision: 1882 $
00029  * $Date: 2006-05-24 15:20:29 -0700 (Wed, 24 May 2006) $
00030  * $Author: dbrown $
00031  * $Id: mf5classes.cpp 1882 2006-05-24 22:20:29Z dbrown $
00032  * 
00033  * ******** fete: From ENDF To ENDL *********
00034  */
00035 
00036 // implementation of the classes used to translate the MF=5 data
00037 
00038 #include "mf5classes.hpp"
00039 #include "global_params.hpp"
00040 
00041 extern ENDLClass ENDL;
00042 extern GlobalParameterClass Global;
00043 
00044 // ********* for class mf5_table *************
00045 // ----------- mf5_table::read_data -----------------
00046 void mf5_table::read_data( mf5_file& inFile, int NR, int NP )
00047 // read in the ENDF/B-VI tabulated  data
00048 // NR is the number of interpolation regions
00049 // NP is the number of (energy, weight) pairs
00050 {
00051   duplicate_Ein = false;
00052 
00053   if( ENDL.S == 7 )
00054   {
00055     // there is no weight information
00056   }
00057   else
00058   {
00059     // read the weights for this model
00060     inFile.get_regions( NR, _weight.NBT, _weight.INT );
00061     // read the weight with energy in MeV
00062     _weight.read_data( inFile, NP, ENDL.eV2MeV, 1.0 );
00063     _weight.expand_interp( ENDL.Max_E_in );
00064   }
00065 
00066   int iZERO, NE;
00067   double ZERO;
00068 
00069   inFile.read_line2( &ZERO, &iZERO, &NR, &NE );
00070 
00071   // read the interpolation information
00072   inFile.get_regions(NR, NBT, INT);
00073   // read the data
00074   for (int iNE=0; iNE < NE; iNE++ )
00075   {
00076     one_E_in(inFile);
00077   }
00078   // record the types of interpolation between 1-d lists
00079   set_interp();
00080   if((NR > 1) || (INT[0] != 2))
00081   {
00082     table_interp( );
00083     // remove any extra inserted points
00084     thinit( );
00085   }
00086 }
00087 
00088 // ----------- mf5_table::one_E_in -----------------
00089 void mf5_table::one_E_in(mf5_file& inFile)
00090 //read in the tabulated ENDF/B-VI data at the current incident neutron energy
00091 {
00092   double ZERO;  // zero
00093   int iZERO;    // zero
00094   
00095   string linebuff;  // the input line
00096   string strbuff;   // a substring
00097 
00098   double E_1;   // incident neutron energy
00099   int NR;       // number of regions
00100   int NP;       // number of data points
00101       
00102   getline( inFile, linebuff ); //read next line
00103   read_ddiiii(&linebuff, &ZERO, // zero
00104           &E_1,             // incident energy
00105           &iZERO,           // zero
00106           &iZERO,           // zero
00107           &NR ,             // number of regions
00108           &NP);             // number of data points
00109   
00110   if( NP < 1 )
00111     {
00112       SevereError("mf5_table::one_E_in",
00113         pastenum("Negative number of data points ",NP)+"in mf5_table class.");
00114     }
00115 
00116   // make a new link for this incident energy
00117   //  one_d_distrib new_link(NONE);
00118   one_d_table new_link;
00119 
00120   // insert the 1-d list as a link
00121   insert(end(), new_link);
00122   two_d_iterator this_link = end();
00123   --this_link;
00124 
00125   // change to MeV
00126   this_link->E_in() = E_1 * ENDL.eV2MeV;
00127 
00128   // read the interpolation information for this E_in
00129   inFile.get_regions(NR, this_link->NBT, this_link->INT);
00130 
00131   // read the data for this E_in; check the order of the energies
00132   double prev_x = -1.0;
00133   for( int iNP=0; iNP < NP; iNP++ ) //Loop over NP data pairs
00134   { 
00135     int iP=iNP % 3;  //There are 3 pairs per line
00136     if ( iP == 0 )
00137     {
00138       getline( inFile, linebuff); //Read in new line
00139     }
00140     strbuff = linebuff.substr(iP*22, 22); //Grab the right pair
00141     double X,Y; //Real variables we will put the data pair
00142     read_dd(&strbuff, &X, &Y );
00143     if ( X==-999. || Y==-999. ) //read_PAIR sends -999. if problem
00144     {
00145       SevereError("mf5_table::one_E_in","read_PAIR fucked up!");
00146     }
00147     else
00148     {
00149       X *= ENDL.eV2MeV;
00150       Y /= ENDL.eV2MeV;
00151       if( X < prev_x ){
00152         SevereError( "mf5_table::one_E_in",
00153            pastenum( "energy out of order: ", X ) );
00154       }
00155       else if( X == prev_x ){
00156         duplicate_Ein = true;
00157         Warning( "mf5_table::one_E_in",
00158             pastenum( "duplicate outgoing energy: ", prev_x ) );
00159       }
00160       dd_link XYdata( X, Y );
00161       this_link->insert(this_link->end(), XYdata);
00162       prev_x = X;
00163     }
00164   }
00165   // expand the interpolation for this incident energy
00166   this_link->expand_interp( ENDL.Max_E_out );
00167   if (this_link->needs_widening())  this_link->widen_jumps( 0.0 );
00168   this_link->renorm( );
00169   if( ENDL.S != 7 )
00170   {
00171     this_link->weight = _weight.evaluate( this_link->E_in() );
00172   }
00173 }
00174 // ----------- mf5_table::table_interp -----------------
00175 void mf5_table::table_interp( )
00176 // Interpolate between tables according to the INT array
00177 // This coding is based on two_d_Legendre::expand_interp
00178 {
00179   if(INT[0] == -7)
00180   {
00181     SevereError("mf5_table::table_interp","table_interp called twice");
00182   }
00183 
00184   // construct the equiprobable bins
00185   for( mf5_table::iterator this_link = begin();
00186     this_link != end(); ++this_link )
00187   {
00188     this_link->get_bins();
00189   }
00190   // fill in to get good linear interpolation
00191   thicken();
00192 
00193   // flag to ensure that we don't do this twice on the same data
00194   INT[0] = -7;
00195 }
00196 
00197 // ********* for class two_d_evap *************
00198 // ----------- two_d_evap::two_d_evap ------
00199 two_d_evap::two_d_evap()
00200 // constructor
00201 {
00202   UU = -10.0;  //  negative to ensure error message if not set
00203   Max_energy = ENDL.Max_E_in;
00204 }
00205 // ----------- two_d_evap::two_d_evap ------
00206 two_d_evap::two_d_evap(double U)
00207 // constructor
00208 {
00209   UU = U*ENDL.eV2MeV;  // convert to MeV
00210   Max_energy = ENDL.Max_E_in;
00211 }
00212 // ----------- two_d_evap::~two_d_evap ------
00213 two_d_evap::~two_d_evap()
00214 // destructor
00215 {
00216 }
00217 // ----------- two_d_evap::make_list ------
00218 void two_d_evap::make_list()
00219 // expand the data into a list
00220 {
00221   const double EPS = Global.Value( "mf5_tol" );  // tolerance for mf5 data
00222 
00223   dd_list::iterator theta_ptr = _theta.begin();
00224   bool pass_maxE = false;  // does the data exceed that maximum energy?
00225 
00226   // ignore this data if the threshold is above Max_energy
00227   if (theta_ptr->x > Max_energy)
00228   {
00229     ENDL.write_file = false;
00230   }
00231   else
00232   {
00233     // make a 1-d list for each (incident energy, theta) pair
00234     for( ; ( (theta_ptr!= _theta.end()) && !pass_maxE );
00235        ++theta_ptr)
00236     {
00237       // check against the maximum energy
00238       if(theta_ptr->x > Max_energy)
00239       {
00240         pass_maxE = true;
00241       }
00242       // insert and expand the model
00243       insert(end(), theta_ptr->x, theta_ptr->y);
00244 
00245       // we may be done
00246       if(theta_ptr->x > (1 - EPS)*Max_energy)
00247       {
00248         break;
00249       }
00250     }
00251     // record the types of interpolation between 1-d lists
00252     set_interp();
00253 
00254     // do we want to replace the last list with one at Max_energy?
00255     if( pass_maxE )
00256     {
00257       chop_highE( Max_energy );
00258     }
00259     // fill in to get good linear interpolation
00260     thicken();
00261 
00262     // normalize the probability
00263     renorm();
00264   }
00265 }
00266 // ----------- two_d_evap::read_data -----------------
00267 void two_d_evap::read_data(mf5_file& inFile, int NR, int NP)
00268 // NR is the number of interpolation regions
00269 // NP is the number of (energy, weight) pairs
00270 {
00271   duplicate_Ein = false;
00272 
00273   string linebuff;
00274   string strbuff;
00275   dd_link XYdata;  // for links in our lists
00276 
00277   // read the interpolation information
00278   inFile.get_regions(NR, _weight.NBT, _weight.INT);
00279   // read the weight with energy in MeV
00280   _weight.read_data( inFile, NP, ENDL.eV2MeV, 1.0 );
00281   _weight.expand_interp( ENDL.Max_E_in );
00282 
00283   // for the theta data
00284   double zero;
00285   int izero;
00286   int nr, np;
00287   inFile.read_line2(&zero, &izero, &nr, &np);
00288 
00289   // read the interpolation information
00290   inFile.get_regions(nr, NBT, INT);
00291   // read the parameters for this model
00292   // and check for duplication of energies
00293   double prev_x = -1.0;
00294   for( int iNP=0; iNP < np; iNP++ ) //Loop over NP data pairs
00295   { 
00296     int iP=iNP % 3;  //There are 3 pairs per line
00297     if ( iP == 0 )
00298     {
00299       getline( inFile, linebuff); //Read in new line
00300     }
00301     strbuff = linebuff.substr(iP*22, 22); //Grab the right pair
00302     read_dd(&strbuff, &XYdata.x, &XYdata.y );
00303     // convert to MeV
00304     XYdata.x *= ENDL.eV2MeV;
00305     XYdata.y *= ENDL.eV2MeV;
00306     if( XYdata.x < prev_x ){
00307       SevereError( "two_d_evap::read_data",
00308            pastenum( "energy out of order: ", XYdata.x ) );
00309     }
00310     else if( XYdata.x == prev_x ){
00311       duplicate_Ein = true;
00312       Warning( "two_d_evap::read_data",
00313            pastenum( "duplicate energy: ", prev_x ) );
00314     }
00315     _theta.insert(_theta.end(), XYdata);
00316     prev_x = XYdata.x;
00317   }
00318 }
00319 // ----------- two_d_evap::insert -----------------
00320 void two_d_evap::insert(two_d_iterator where, double e_in, double Theta)
00321 // insert a distribution for this e_in
00322 {
00323   one_d_evap new_link;
00324 
00325   // insert the 1-d list as a link
00326   two_d_list<one_d_evap>::insert(where, new_link);
00327 
00328   // expand the 1-d model
00329   two_d_iterator this_link = where;
00330   --this_link;
00331   this_link->weight = _weight.evaluate( e_in );
00332   this_link->initiate(e_in, Theta, UU);
00333 }
00334 // ********* for class two_d_Maxwell *************
00335 // ----------- two_d_Maxwell::two_d_Maxwell ------
00336 two_d_Maxwell::two_d_Maxwell()
00337 // constructor
00338 {
00339   UU = -10.0;  //  negative to ensure error message if not set
00340   Max_energy = ENDL.Max_E_in;
00341 }
00342 // ----------- two_d_Maxwell::two_d_Maxwell ------
00343 two_d_Maxwell::two_d_Maxwell(double U)
00344 // constructor
00345 {
00346   UU = U*ENDL.eV2MeV;  // convert to MeV
00347   Max_energy = ENDL.Max_E_in;
00348 }
00349 // ----------- two_d_Maxwell::~two_d_Maxwell ------
00350 two_d_Maxwell::~two_d_Maxwell()
00351 // destructor
00352 {
00353 }
00354 // ----------- two_d_Maxwell::make_list ------
00355 void two_d_Maxwell::make_list()
00356 // expand the data into a list
00357 {
00358   const double EPS = Global.Value( "mf5_tol" );  // tolerance for mf5 data
00359 
00360   dd_list::iterator theta_ptr = _theta.begin();
00361   bool pass_maxE = false;  // does the data exceed that maximum energy?
00362 
00363   // ignore this data if the threshold is above Max_energy
00364   if (theta_ptr->x > Max_energy)
00365   {
00366     ENDL.write_file = false;
00367   }
00368   else
00369   {
00370     // make a 1-d list for each (incident energy, theta) pair
00371     for( ; ( (theta_ptr!= _theta.end()) && !pass_maxE );
00372        ++theta_ptr)
00373     {
00374       // check against the maximum energy
00375       if(theta_ptr->x > Max_energy)
00376       {
00377         pass_maxE = true;
00378       }
00379       // insert and expand the model
00380       insert(end(), theta_ptr->x, theta_ptr->y);
00381 
00382       // we may be done
00383       if(theta_ptr->x > (1 - EPS)*Max_energy)
00384       {
00385         break;
00386       }
00387     }
00388     // record the types of interpolation between 1-d lists
00389     set_interp();
00390 
00391     // do we want to replace the last list with one at Max_energy?
00392     if( pass_maxE )
00393     {
00394       chop_highE( Max_energy );
00395     }
00396     // fill in to get good linear interpolation
00397     thicken();
00398 
00399     // normalize the probability
00400     renorm();
00401   }
00402 }
00403 // ----------- two_d_Maxwell::read_data -----------------
00404 void two_d_Maxwell::read_data(mf5_file& inFile, int NR, int NP)
00405 // NR is the number of interpolation regions
00406 // NP is the number of (energy, weight) pairs
00407 {
00408   duplicate_Ein = false;
00409 
00410   string linebuff;
00411   string strbuff;
00412   dd_link XYdata;  // for links in our lists
00413 
00414   // read the interpolation information
00415   inFile.get_regions(NR, _weight.NBT, _weight.INT);
00416   // read the weights for this model with energy in MeV
00417   _weight.read_data( inFile, NP, ENDL.eV2MeV, 1.0 );
00418   _weight.expand_interp( ENDL.Max_E_in );
00419 
00420   // for the theta data
00421   double zero;
00422   int izero;
00423   int nr, np;
00424   inFile.read_line2(&zero, &izero, &nr, &np);
00425   double prev_x = -1.0;
00426   // read the interpolation information
00427   inFile.get_regions(nr, NBT, INT);
00428   // read the parameters for this model
00429 
00430   for( int iNP=0; iNP < np; iNP++ ) //Loop over NP data pairs
00431   { 
00432     int iP=iNP % 3;  //There are 3 pairs per line
00433     if ( iP == 0 )
00434     {
00435       getline( inFile, linebuff); //Read in new line
00436     }
00437     strbuff = linebuff.substr(iP*22, 22); //Grab the right pair
00438     read_dd(&strbuff, &XYdata.x, &XYdata.y );
00439     // convert to MeV
00440     XYdata.x *= ENDL.eV2MeV;
00441     XYdata.y *= ENDL.eV2MeV;
00442     if( XYdata.x < prev_x ){
00443       SevereError( "two_d_Maxwell::read_data",
00444            pastenum( "energy out of order: ", XYdata.x ) );
00445     }
00446     else if( XYdata.x == prev_x ){
00447       duplicate_Ein = true;
00448       Warning( "two_d_Maxwell::read_data",
00449            pastenum( "duplicate energy: ", prev_x ) );
00450     }
00451     _theta.insert(_theta.end(), XYdata);
00452     prev_x = XYdata.x;
00453   }
00454 }
00455 // ----------- two_d_Maxwell::insert -----------------
00456 void two_d_Maxwell::insert(two_d_iterator where, double e_in, double Theta)
00457 // insert a distribution for this e_in
00458 {
00459   one_d_Maxwell new_link;
00460 
00461   // insert the 1-d list as a link
00462   two_d_list<one_d_Maxwell>::insert(where, new_link);
00463 
00464   // expand the 1-d model
00465   two_d_iterator this_link = where;
00466   --this_link;
00467   this_link->initiate(e_in, Theta, UU);
00468   this_link->weight = _weight.evaluate( this_link->E_in() );
00469 }
00470 // ********* for class two_d_Watt *************
00471 // ----------- two_d_Watt::two_d_Watt ------
00472 two_d_Watt::two_d_Watt()
00473 // constructor
00474 {
00475   UU = -10.0;  //  negative to ensure error message if not set
00476   Max_energy = ENDL.Max_E_in;
00477 }
00478 // ----------- two_d_Watt::two_d_Watt ------
00479 two_d_Watt::two_d_Watt(double U)
00480 // constructor
00481 {
00482   UU = U*ENDL.eV2MeV;  // convert to MeV
00483   Max_energy = ENDL.Max_E_in;
00484 }
00485 // ----------- two_d_Watt::~two_d_Watt ------
00486 two_d_Watt::~two_d_Watt()
00487 // destructor
00488 {
00489 }
00490 // ----------- two_d_Watt::make_list ------
00491 void two_d_Watt::make_list()
00492 // expand the data into a list
00493 {
00494   const double EPS = Global.Value( "mf5_tol" );  // tolerance for mf5 data
00495 
00496   dd_list::iterator a_ptr = Watt_a.begin();
00497   dd_list::iterator b_ptr = Watt_b.begin();
00498   bool pass_maxE = false;  // does the data exceed that maximum energy?
00499 
00500   // ignore this data if the threshold is above Max_energy
00501   if (a_ptr->x > Max_energy)
00502   {
00503     ENDL.write_file = false;
00504   }
00505   else
00506   {
00507     // Set up a 1-d list for each (incident energy, a) pair
00508     for( ; ( (a_ptr != Watt_a.end()) && !pass_maxE ); ++a_ptr )
00509     {
00510       // check against the maximum energy
00511       if(a_ptr->x > Max_energy)
00512       {
00513         pass_maxE = true;
00514       }
00515       // insert a link with these E_in and a values
00516       insert( end(), a_ptr->x, a_ptr->y );
00517 
00518       // we may be done
00519       if(a_ptr->x > (1 - EPS)*Max_energy)
00520       {
00521         break;
00522       }
00523     }
00524     // record the types of interpolation for a between 1-d lists
00525     set_interp();
00526 
00527     // set the b values and expand the lists
00528     set_b();
00529 
00530     // do we want to replace the last list with one at Max_energy?
00531     if( pass_maxE )
00532     {
00533       chop_highE( Max_energy );
00534     }
00535     // fill in to get good linear interpolation
00536     thicken();
00537 
00538     // normalize the probability
00539     renorm();
00540   }
00541 }
00542 // ----------- two_d_Watt::read_data -----------------
00543 void two_d_Watt::read_data(mf5_file& inFile, int NR, int NP)
00544 // NR is the number of interpolation regions
00545 // NP is the number of (energy, weight) pairs
00546 {
00547   duplicate_Ein = false;
00548 
00549   string linebuff;
00550   string strbuff;
00551   dd_link XYdata;  // for links in our lists
00552 
00553   // read the interpolation information
00554   inFile.get_regions(NR, _weight.NBT, _weight.INT);
00555 
00556   // read the weights for this model with energy in MeV
00557   _weight.read_data( inFile, NP, ENDL.eV2MeV, 1.0 );
00558   _weight.expand_interp( ENDL.Max_E_in );
00559 
00560   // for the Watt_a data
00561   double zero;
00562   int izero;
00563   int nr, np;
00564   inFile.read_line2(&zero, &izero, &nr, &np);
00565 
00566   // read the interpolation information
00567   inFile.get_regions(nr, NBT, INT);
00568   // read the parameters for this model
00569   // and check for duplication of energies
00570   double prev_x = -1.0;
00571   for( int iNP=0; iNP < np; iNP++ ) //Loop over NP data pairs
00572   { 
00573     int iP=iNP % 3;  //There are 3 pairs per line
00574     if ( iP == 0 )
00575     {
00576       getline( inFile, linebuff); //Read in new line
00577     }
00578     strbuff = linebuff.substr(iP*22, 22); //Grab the right pair
00579     read_dd(&strbuff, &XYdata.x, &XYdata.y );
00580     // convert to MeV
00581     XYdata.x *= ENDL.eV2MeV;
00582     XYdata.y *= ENDL.eV2MeV;
00583     if( XYdata.x < prev_x ){
00584       SevereError( "two_d_Watt::read_data",
00585            pastenum( "energy out of order: ", XYdata.x ) );
00586     }
00587     else if( XYdata.x == prev_x ){
00588       duplicate_Ein = true;
00589       Warning( "two_d_Watt::read_data",
00590            pastenum( "duplicate energy: ", prev_x ) );
00591     }
00592     Watt_a.insert(Watt_a.end(), XYdata);
00593     prev_x = XYdata.x;
00594   }
00595 
00596   // for the Watt_b data
00597   inFile.read_line2(&zero, &izero, &nr, &np);
00598 
00599   // read the interpolation information
00600   inFile.get_regions(nr, Watt_b.NBT, Watt_b.INT);
00601   // read the parameters for this model
00602 
00603   for( int iNP=0; iNP < np; iNP++ ) //Loop over NP data pairs
00604   { 
00605     int iP=iNP % 3;  //There are 3 pairs per line
00606     if ( iP == 0 )
00607     {
00608       getline( inFile, linebuff); //Read in new line
00609     }
00610     strbuff = linebuff.substr(iP*22, 22); //Grab the right pair
00611     read_dd(&strbuff, &XYdata.x, &XYdata.y );
00612     // convert to MeV
00613     XYdata.x *= ENDL.eV2MeV;
00614     XYdata.y /= ENDL.eV2MeV;
00615     Watt_b.insert(Watt_b.end(), XYdata);
00616   }
00617   // ensure that the Watt_a and Watt_b lists have the same E_in values
00618   fill_in_lists(Watt_a, Watt_b);
00619 }
00620 // ----------- two_d_Watt::insert -----------------
00621 void two_d_Watt::insert( two_d_iterator where, double e_in, double a )
00622 // insert a distribution for this e_in
00623 {
00624   one_d_Watt new_link;
00625 
00626   // insert the 1-d list as a link
00627   two_d_list<one_d_Watt>::insert(where, new_link);
00628 
00629   // set the U and a parameters for this e_in
00630   two_d_iterator this_link = where;
00631   --this_link;
00632   this_link->set_EUa( e_in, UU, a );
00633   this_link->weight = _weight.evaluate( this_link->E_in() );
00634 }
00635 // ----------- two_d_Watt::set_b -----------------
00636 void two_d_Watt::set_b( )
00637 // set the b values and expand the lists
00638 {
00639   const double EPS = Global.Value( "mf5_tol" );  // tolerance for mf5 data
00640   dd_list::iterator a_ptr = Watt_a.begin();
00641   dd_list::iterator b_ptr = Watt_b.begin();
00642 
00643   double E_a = a_ptr->x;
00644   double E_b = b_ptr->x;
00645   if( abs( E_a - E_b ) > EPS*E_a )
00646   {
00647     SevereError("two_d_Watt::set_b",
00648         "Watt a and b lists should start at the same energies.");
00649   }
00650 
00651   int n_NBT = 0;  // for counting the NBT and INT arrays
00652   // set up the first list
00653   two_d_Watt::iterator list_ptr = begin();
00654   list_ptr->same_b( b_ptr->y, Watt_b.INT[ n_NBT ] );
00655 
00656   // the next a and b terms
00657   ++a_ptr;
00658   ++b_ptr;
00659   E_a = a_ptr->x;
00660   E_b = b_ptr->x;
00661   int b_count = 1;  // count the b entries
00662 
00663   // loop through the a and b lists
00664   for( ++list_ptr; list_ptr != end(); )
00665   {
00666     // we may have the same energies
00667     if( abs( E_a - E_b ) < EPS*E_a )
00668     {
00669       list_ptr->same_b( b_ptr->y, Watt_b.INT[ n_NBT ] );
00670 
00671       // the next a and b terms
00672       ++a_ptr;
00673       ++b_ptr;
00674       E_a = a_ptr->x;
00675       E_b = b_ptr->x;
00676       ++list_ptr;  // next list
00677       ++b_count;
00678       if( b_count >= Watt_b.NBT[ n_NBT ] )
00679       {
00680         ++n_NBT;
00681       }
00682     }
00683     else if( E_b < E_a )
00684     {
00685       // set up a new 1-d list at energy E_b
00686       one_d_Watt new_link;
00687 
00688       // insert the 1-d list as a link
00689       two_d_list<one_d_Watt>::insert(list_ptr, new_link);
00690       two_d_iterator this_link = list_ptr;
00691       --this_link;  // points to the new list
00692 
00693       // interpolate to get the intermediate a and make a new list
00694       dd_list::iterator prev_a = a_ptr;
00695       --prev_a;
00696       double a_value = Watt_a.interp( E_b, *prev_a, *a_ptr,
00697         list_ptr->interp_type );
00698       this_link->weight = _weight.evaluate( this_link->E_in() );
00699       this_link->intermediate_b( E_b, UU, a_value,
00700         list_ptr->interp_type, b_ptr->y, Watt_b.INT[ n_NBT ] );
00701 
00702       // the next b term
00703       ++b_ptr;
00704       E_b = b_ptr->x;
00705       ++b_count;
00706       if( b_count >= Watt_b.NBT[ n_NBT ] )
00707       {
00708         ++n_NBT;
00709       }
00710     }
00711     else // E_a < E_b
00712     {
00713       // interpolate to get the intermediate b
00714       dd_list::iterator prev_b = b_ptr;
00715       --prev_b;
00716       double b_value = Watt_b.interp( E_a, *prev_b, *b_ptr,
00717         Watt_b.INT[ n_NBT ] );
00718       list_ptr->same_b( b_value, Watt_b.INT[ n_NBT ] );
00719 
00720       // the next a term
00721       ++a_ptr;
00722       E_a = a_ptr->x;
00723       ++list_ptr;  // next list
00724     }
00725   }
00726 }
00727 // ********* for class two_d_Madland *************
00728 // ----------- two_d_Madland::two_d_Madland ------
00729 two_d_Madland::two_d_Madland()
00730 // constructor
00731 {
00732   EFL_ = -10.0;  //  negative to ensure error message if not set
00733   EFH_ = -10.0;
00734   Max_energy = ENDL.Max_E_in;
00735 }
00736 // ----------- two_d_Madland::~two_d_Madland ------
00737 two_d_Madland::~two_d_Madland()
00738 // destructor
00739 {
00740 }
00741 // ----------- two_d_Madland::make_list ------
00742 void two_d_Madland::make_list()
00743 // expand the data into a list
00744 {
00745   const double EPS = Global.Value( "mf5_tol" );  // tolerance for mf5 data
00746 
00747   dd_list::iterator TM_ptr = Madland_TM.begin();
00748   bool pass_maxE = false;  // does the data exceed that maximum energy?
00749 
00750   // ignore this data if the threshold is above Max_energy
00751   if (TM_ptr->x > Max_energy)
00752   {
00753     ENDL.write_file = false;
00754   }
00755   else
00756   {
00757     // Make a 1-d list for each (incident energy, TM) pair.
00758     for( ; ( (TM_ptr != Madland_TM.end()) && !pass_maxE );
00759        ++TM_ptr)
00760     {
00761       // check against the maximum energy
00762       if(TM_ptr->x > Max_energy)
00763       {
00764         pass_maxE = true;
00765       }
00766       // insert and expand the model
00767       insert(end(), TM_ptr->x, TM_ptr->y);
00768 
00769       // we may be done
00770       if(TM_ptr->x > (1 - EPS)*Max_energy)
00771       {
00772         break;
00773       }
00774     }
00775   }
00776   // record the types of interpolation between 1-d lists
00777   set_interp();
00778 
00779   // do we want to replace the last list with one at Max_energy?
00780   if( pass_maxE )
00781   {
00782     chop_highE( Max_energy );
00783   }
00784   // fill in to get good linear interpolation
00785   thicken();
00786 }
00787 // ----------- two_d_Madland::read_data -----------------
00788 void two_d_Madland::read_data(mf5_file& inFile, int NR, int NP)
00789 // NR is the number of interpolation regions
00790 // NP is the number of (energy, weight) pairs
00791 {
00792   duplicate_Ein = false;
00793 
00794   string linebuff;
00795   string strbuff;
00796   dd_link XYdata;  // for links in our lists
00797 
00798   // read the interpolation information
00799   inFile.get_regions(NR, _weight.NBT, _weight.INT);
00800 
00801   // read the weights for this model with energy in MeV
00802   _weight.read_data( inFile, NP, ENDL.eV2MeV, 1.0 );
00803   _weight.expand_interp( ENDL.Max_E_in );
00804 
00805   // for the Madland_TM data
00806   int nr, ne;
00807   double EFL, EFH;  // average energies of fission fragments
00808   inFile.read_Madland( &EFL, &EFH, &nr, &ne);
00809   set_EF( EFL, EFH );  // save them as MeV
00810 
00811   // read the interpolation information
00812   inFile.get_regions(nr, NBT, INT);
00813   // read the parameters for this model
00814   // and check for duplication of energies
00815   double prev_x = -1.0;
00816   for( int iNE=0; iNE < ne; iNE++ ) //Loop over NE data pairs
00817   { 
00818     int iP=iNE % 3;  //There are 3 pairs per line
00819     if ( iP == 0 )
00820     {
00821       getline( inFile, linebuff); //Read in new line
00822     }
00823     strbuff = linebuff.substr(iP*22, 22); //Grab the right pair
00824     read_dd(&strbuff, &XYdata.x, &XYdata.y );
00825     // convert to MeV
00826     XYdata.x *= ENDL.eV2MeV;
00827     XYdata.y *= ENDL.eV2MeV;
00828     if( XYdata.x < prev_x ){
00829       SevereError( "two_d_Madland::read_data",
00830            pastenum( "energy out of order: ", XYdata.x ) );
00831     }
00832     else if( XYdata.x == prev_x ){
00833       duplicate_Ein = true;
00834       Warning( "two_d_Madland::read_data",
00835            pastenum( "duplicate energy: ", prev_x ) );
00836     }
00837     Madland_TM.insert(Madland_TM.end(), XYdata);
00838     prev_x = XYdata.x;
00839   }
00840 }
00841 // ----------- two_d_Madland::insert -----------------
00842 void two_d_Madland::insert(two_d_iterator where, double e_in, double TM)
00843 // insert a distribution for this e_in
00844 {
00845   one_d_Madland new_link;
00846 
00847   // insert the 1-d list as a link
00848   two_d_list<one_d_Madland>::insert(where, new_link);
00849 
00850   // expand the 1-d model
00851   two_d_iterator this_link = where;
00852   --this_link;
00853   this_link->initiate( e_in, EFL_, EFH_, TM );
00854   this_link->weight = _weight.evaluate( this_link->E_in() );
00855 }
00856 // ********* for class add_them_up *************
00857 // ----------- add_them_up::constructor-----------
00858 add_them_up::  add_them_up( int NK )
00859 {
00860   NK_ = NK;
00861 
00862   // set up space for the models
00863   table_vec = new mf5_table[ NK ];
00864   evap_vec = new two_d_evap[ NK ];
00865   Maxwell_vec = new two_d_Maxwell[ NK ];
00866   Watt_vec = new two_d_Watt[ NK ];
00867   Madland_vec = new two_d_Madland[ NK ];
00868 
00869   num_table = 0;
00870   num_evap = 0;
00871   num_Maxwell = 0;
00872   num_Watt = 0;
00873   num_Madland = 0;
00874 
00875   // debug_ = true;
00876   debug_ = false;
00877 }
00878 // ----------- add_them_up::destructor-----------
00879 add_them_up::~add_them_up( )
00880 {
00881   if( num_table > 0 )
00882   {
00883     delete [] table_vec;
00884   }
00885   if( num_evap > 0 )
00886   {
00887     delete [] evap_vec;
00888   }
00889   if( num_Maxwell > 0 )
00890   {
00891     delete [] Maxwell_vec;
00892   }
00893   if( num_Watt > 0 )
00894   {
00895     delete [] Watt_vec;
00896   }
00897   if( num_Madland > 0 )
00898   {
00899     delete [] Madland_vec;
00900   }
00901 }
00902 // ----------- add_them_up::manager-----------
00903 // manage NK output models
00904 void add_them_up::manager( mf5_file& inFile )
00905 {
00906   // expand the models
00907   for( int j = 0; j < NK_; ++j )
00908   {
00909     one_model( inFile );
00910   }
00911 
00912   // ensure that all lists have common incident energies
00913   common_Ein( );
00914 
00915   // do a weighted add
00916   wt_add( );
00917 
00918   // check for total weight != 1
00919   check_total_wt( );
00920 
00921   // widen any post-add jumps
00922   widen_jumps( );
00923 
00924   // make sure that the probabilities are normalized
00925   renorm( );
00926   if (ENDL.write_file)
00927   {
00928     write_endl( 4 ); //write the ENDL file
00929   }
00930 }
00931 // ----------- add_them_up::one_model -----------
00932 void add_them_up::one_model( mf5_file& inFile )
00933 // Handles one output model
00934 {
00935   double U;
00936   int LF, NR, NP;
00937 
00938   // read the first line for the model
00939   inFile.read_line2(&U, &LF, &NR, &NP);
00940 
00941   if ( LF == 1  ) //Arbitrary tabulated function
00942   {
00943     // data for an mf5_table
00944     table_vec[num_table].read_data( inFile, NR, NP );  //read in the data
00945     if( table_vec[num_table].duplicate_Ein )
00946         table_vec[num_table].widen_jumps( );
00947     // Insert 1-d lists where the weight has jumps
00948     table_vec[num_table].weight_jumps();
00949     ++num_table;
00950   }
00951   else if ( LF == 5  ) //General evaporation Spectrum
00952   {
00953     Warning("add_them_up::one_model","Need new code for LF = 5");
00954     return;
00955   }
00956   else if ( LF == 7  )  // Simple fission spectrum (Maxwellian)
00957   {
00958     Maxwell_vec[num_Maxwell].set_U( U );
00959     Maxwell_vec[num_Maxwell].read_data( inFile, NR, NP );    //read in the data
00960     Maxwell_vec[num_Maxwell].make_list();   // expand the data
00961     if( Maxwell_vec[num_Maxwell].duplicate_Ein )
00962         Maxwell_vec[num_Maxwell].widen_jumps( );
00963     // Insert 1-d lists where the weight has jumps
00964     Maxwell_vec[num_Maxwell].weight_jumps();
00965     ++num_Maxwell;
00966   }
00967   else if ( LF == 9  )  // Evaporation spectrum
00968   {
00969     evap_vec[num_evap].set_U( U );
00970     evap_vec[num_evap].read_data( inFile, NR, NP );    //read in the data
00971     evap_vec[num_evap].make_list();   // expand the data
00972     if( evap_vec[num_evap].duplicate_Ein )
00973         evap_vec[num_evap].widen_jumps( );
00974     // Insert 1-d lists where the weight has jumps
00975     evap_vec[num_evap].weight_jumps();
00976     ++num_evap;
00977   }
00978   else if ( LF == 11 )  //Energy-Dependent Watt spectrum
00979   {
00980     Watt_vec[num_Watt].set_U( U );
00981     Watt_vec[num_Watt].read_data( inFile, NR, NP );    //read in the data
00982     Watt_vec[num_Watt].make_list();   // expand the data
00983     if( Watt_vec[num_Watt].duplicate_Ein )
00984         Watt_vec[num_Watt].widen_jumps( );
00985     // Insert 1-d lists where the weight has jumps
00986     Watt_vec[num_Watt].weight_jumps();
00987     ++num_Watt;
00988   }
00989   else if ( LF == 12 ) //Energy dep fission neutron spectrum (Madland & Nix)
00990   {
00991     Madland_vec[num_Madland].read_data( inFile, NR, NP );    //read in the data
00992     Madland_vec[num_Madland].make_list();   // expand the data
00993     if( Madland_vec[num_Madland].duplicate_Ein )
00994         Madland_vec[num_Madland].widen_jumps( );
00995     // Insert 1-d lists where the weight has jumps
00996     Madland_vec[num_Madland].weight_jumps();
00997     ++num_Madland;
00998   }
00999   else
01000   {
01001     SevereError("add_them_up::one_model",
01002       pastenum("There is no model for LF = ",LF)+" for MF = 5 data.");
01003   }
01004 }
01005 // ----------- add_them_up::common_Ein -----------
01006 void add_them_up::common_Ein( )
01007 // ensure that all lists have common incident energies
01008 {
01009   int j;
01010   list< double > E_incident;
01011 
01012   // first collect all of the incident energies
01013   for( j = 0; j < num_table; ++j )
01014   {
01015     table_vec[j].collect_Ein( E_incident );
01016   }
01017   for( j = 0; j < num_evap; ++j )
01018   {
01019     evap_vec[j].collect_Ein( E_incident );
01020   }
01021   for( j = 0; j < num_Maxwell; ++j )
01022   {
01023     Maxwell_vec[j].collect_Ein( E_incident );
01024   }
01025   for( j = 0; j < num_Watt; ++j )
01026   {
01027     Watt_vec[j].collect_Ein( E_incident );
01028   }
01029   for( j = 0; j < num_Madland; ++j )
01030   {
01031     Madland_vec[j].collect_Ein( E_incident );
01032   }
01033 
01034   // sort and delete duplicates
01035   E_incident.sort( );
01036   E_incident.unique( );
01037 
01038   // then do the fills
01039   for( j = 0; j < num_table; ++j )
01040   {
01041     table_vec[j].fill_in_list( E_incident );
01042   }
01043   for( j = 0; j < num_evap; ++j )
01044   {
01045     evap_vec[j].fill_in_list( E_incident );
01046   }
01047   for( j = 0; j < num_Maxwell; ++j )
01048   {
01049     Maxwell_vec[j].fill_in_list( E_incident );
01050   }
01051   for( j = 0; j < num_Watt; ++j )
01052   {
01053     Watt_vec[j].fill_in_list( E_incident );
01054   }
01055   for( j = 0; j < num_Madland; ++j )
01056   {
01057     Madland_vec[j].fill_in_list( E_incident );
01058   }
01059 }
01060 // ----------- add_them_up::wt_add -----------
01061 void add_them_up::wt_add( )
01062 // Adds the next list to the weighted sum
01063 {
01064   int j;
01065   bool started = false;
01066 
01067    // add up the lists
01068   for( j = 0; j < num_table; ++j )
01069   {
01070     if( started )
01071     {
01072       sum_lists( *this, table_vec[j] );
01073     }
01074     else
01075     {
01076       copy_data( table_vec[j] );
01077       started = true;
01078       use_weight( );
01079     }
01080   }
01081 
01082   for( j = 0; j < num_evap; ++j )
01083   {
01084     if( started )
01085     {
01086       sum_lists( *this, evap_vec[j] );
01087     }
01088     else
01089     {
01090       copy_data( evap_vec[j] );
01091       started = true;
01092       use_weight( );
01093     }
01094   }
01095 
01096   for( j = 0; j < num_Maxwell; ++j )
01097   {
01098     if( started )
01099     {
01100       sum_lists( *this, Maxwell_vec[j] );
01101     }
01102     else
01103     {
01104       copy_data( Maxwell_vec[j] );
01105       started = true;
01106       use_weight( );
01107     }
01108   }
01109 
01110   for( j = 0; j < num_Watt; ++j )
01111   {
01112     if( started )
01113     {
01114       sum_lists( *this, Watt_vec[j] );
01115     }
01116     else
01117     {
01118       copy_data( Watt_vec[j] );
01119       started = true;
01120       use_weight( );
01121     }
01122   }
01123 
01124   for( j = 0; j < num_Madland; ++j )
01125   {
01126     if( started )
01127     {
01128       sum_lists( *this, Madland_vec[j] );
01129     }
01130     else
01131     {
01132       copy_data( Madland_vec[j] );
01133       started = true;
01134       use_weight( );
01135     }
01136   }
01137 }
01138 // ----------- add_them_up::check_total_wt -----------
01139 void add_them_up::check_total_wt( )
01140 // Check the total weight; it should be 1
01141 {
01142   const double EPS = Global.Value( "mf5_weight_tol" );
01143   for( mf5_table::iterator this_list = begin( );
01144        this_list != end( ); ++this_list )
01145   {
01146     if( abs( this_list->weight - 1.0 ) > EPS )
01147     {
01148       Warning( "add_them_up::check_total_wt",
01149            pastenum( pastenum( "bad total weight for E_in ",
01150              this_list->E_in( ) )+": ",this_list->weight) );
01151     }
01152   }
01153 }
01154 
01155 // ********* for class fission_delay *************
01156 // ----------- fission_delay::manager ------
01157 void fission_delay::manager(mf1_file& inFile)
01158 // manage everything for delayed neutrons
01159 {
01160   // get the time constants and the total multiplicity
01161   read_mf1(inFile);
01162 
01163   // the data for the channels is in an mf5 file
01164   mf5_file mf5_in;
01165   mf5_in.open(5, 455);
01166   ENDL.set_c_number(15);
01167   ENDL.set_s_number(7);
01168 
01169   if( !mf5_in )
01170   {
01171     Info("fission_delay::manager",
01172         "No mf05mt455 file; writing total delayed neutron multiplicity");
01173     ENDL.set_yo(1);
01174     total_mult.widen_jumps();
01175     if ( ENDL.write_file ) total_mult.write_endl( 7 );
01176     return;
01177   }
01178 
01179   // read the first line of the file
01180   int ZA;
01181   double AWR;
01182   int NK;  // number of channels
01183   mf5_in.read_line1(&ZA, &AWR, &NK);
01184   if(NK != time_consts.size())
01185   {
01186     SevereError("fission_delay::manager","Wrong count for delayed neutron decay channels");
01187   }
01188 
01189   // loop over the decay channels
01190   ENDL.append = false;  // make new output files on the first pass
01191   for(int count = 0; count < NK; ++count)
01192   {
01193     // read the multiplicity and get the model
01194     int LF = one_mult(mf5_in, count);
01195     if( LF == 5 )
01196     {
01197       // general evaporation model
01198       one_gen_evap( mf5_in, count );
01199     }
01200     else if( LF == 1 )
01201     {
01202       // probability table
01203       one_table( mf5_in, count );
01204     }
01205     else
01206     {
01207       Unimplemented("fission_delay::manager",
01208         pastenum(" Implement model LF = ", LF) );
01209     }
01210     ENDL.append = true;  // now just append to the output files
01211   }
01212   Info("fission_delay::manager","Closing file "+endf_file_name(5, 455)+"...");
01213   mf5_in.close();
01214   ENDL.append = false;  // go back to making new output files
01215 }
01216 // ----------- fission_delay::read_mf1 -----------------
01217 void fission_delay::read_mf1(mf1_file& inFile)
01218 // get the time constants and the total multiplicity
01219 {
01220   int NC;  // number of time constants
01221   inFile.delay_head(&NC);
01222   time_consts.reserve(NC);
01223   time_consts.resize(NC);
01224 
01225   string linebuff;
01226   string strbuff;
01227 
01228   for( int iNC=0; iNC < NC; iNC++ ) //Loop over NC data items
01229   {
01230     int iC=iNC % 6;  //There are 6 items per line
01231     if ( iC == 0 )
01232     {
01233       getline( inFile, linebuff); //Read in new line
01234     }
01235     strbuff = linebuff.substr(iC*11, 11); //Grab the right entry
01236     read_d(&strbuff, &time_consts[iNC] );
01237   }
01238 
01239   // for the total multiplicity
01240   int NR;
01241   int NP;
01242   inFile.mult_head(&NR, &NP);
01243 
01244   // read the interpolation information
01245   inFile.get_regions(NR, total_mult.NBT, total_mult.INT);
01246   if((NR > 1) || (total_mult.INT[0] != 2))
01247   {
01248     Unimplemented("fission_delay::read_mf1",
01249         "Implement interpolation for delayed fission neutrons");
01250   }
01251 
01252   // read the multiplicities
01253   for( int iNP=0; iNP < NP; iNP++ ) //Loop over NP data pairs
01254   { 
01255     int iP=iNP % 3;  //There are 3 pairs per line
01256     if ( iP == 0 )
01257     {
01258       getline( inFile, linebuff); //Read in new line
01259     }
01260     strbuff = linebuff.substr(iP*22, 22); //Grab the right pair
01261     dd_link XYdata;
01262     read_dd(&strbuff, &XYdata.x, &XYdata.y );
01263     // convert to MeV
01264     XYdata.x *= ENDL.eV2MeV;
01265     total_mult.insert(total_mult.end(), XYdata);
01266   }
01267 }
01268 // ----------- fission_delay::one_mult -----------------
01269 int fission_delay::one_mult(mf5_file& inFile, int j)
01270 // get the multiplicities for j-th channel and return the model
01271 {
01272   double U;  // not used
01273   int LF;    // mf5 model
01274   int NR;    // number of interpolation regions
01275   int NP;    // number of energy-multiplicity pairs
01276   inFile.read_line2(&U, &LF, &NR, &NP);
01277  
01278   multiplicity partial_mult; // multiplicity for one channel
01279   dd_link XYdata;
01280 
01281   inFile.get_regions(NR, partial_mult.NBT, partial_mult.INT);
01282   string linebuff;
01283   string strbuff;
01284 
01285   for( int iNP=0; iNP < NP; iNP++ ) //Loop over NP data pairs
01286   {
01287     int iP=iNP % 3;  //There are 3 pairs per line
01288     if ( iP == 0 )
01289     {
01290       getline( inFile, linebuff); //Read in new line
01291     }
01292     strbuff = linebuff.substr(iP*22, 22); //Grab the right pair
01293     read_dd(&strbuff, &XYdata.x, &XYdata.y );
01294     // convert to MeV
01295     XYdata.x *= ENDL.eV2MeV;
01296     partial_mult.insert(partial_mult.end(), XYdata);
01297   }
01298   partial_mult *= total_mult;  // scale by the total multiplicity
01299   ENDL.set_c_number(15);
01300   ENDL.set_yo(1);
01301   ENDL.set_s_number(7);
01302   ENDL.set_x1(time_consts[j]);
01303   if ( ENDL.write_file ) partial_mult.write_endl( 7 );
01304 
01305   return LF;
01306 }
01307 // ----------- fission_delay::one_gen_evap -----------------
01308 void fission_delay::one_gen_evap(mf5_file& inFile, int count)
01309 // get the energy distribution for the j-th channel
01310 // for the general evaporation model
01311 {
01312   two_d_table e_dist;
01313   one_d_table one_E_in;
01314   dd_link XYdata;
01315 
01316   // start an empty list
01317   e_dist.insert(e_dist.end(), one_E_in);
01318   two_d_table::iterator dist_ptr = e_dist.end();
01319   --dist_ptr;
01320 
01321   double U;  // not used
01322   int LF;    // not used
01323   int NR;    // number of interpolation regions
01324   int N_theta;    // number of energy-theta pairs
01325 
01326   inFile.read_line2(&U, &LF, &NR, &N_theta);
01327   inFile.get_regions(NR, theta.NBT, theta.INT);
01328   string linebuff;
01329   string strbuff;
01330 
01331   for( int iNP=0; iNP < N_theta; iNP++ ) //Loop over N_theta data pairs
01332   {
01333     int iP=iNP % 3;  //There are 3 pairs per line
01334     if ( iP == 0 )
01335     {
01336       getline( inFile, linebuff); //Read in new line
01337     }
01338     strbuff = linebuff.substr(iP*22, 22); //Grab the right pair
01339     read_dd(&strbuff, &XYdata.x, &XYdata.y );
01340     // convert to MeV
01341     XYdata.x *= ENDL.eV2MeV;
01342     theta.insert(theta.end(), XYdata);
01343   }
01344 
01345   // Read in the values of g(E'/theta) for the energy distribution
01346   int NP;  // number of (x, g(x)) pairs
01347   inFile.read_line2(&U, &LF, &NR, &NP);
01348   inFile.get_regions(NR, dist_ptr->NBT, dist_ptr->INT);
01349 
01350   for( int iNP=0; iNP < NP; iNP++ ) //Loop over NP data pairs
01351   {
01352     int iP=iNP % 3;  //There are 3 pairs per line
01353     if ( iP == 0 )
01354     {
01355       getline( inFile, linebuff); //Read in new line
01356     }
01357     strbuff = linebuff.substr(iP*22, 22); //Grab the right pair
01358     read_dd(&strbuff, &XYdata.x, &XYdata.y );
01359     // convert to MeV
01360     XYdata.x *= ENDL.eV2MeV;
01361     dist_ptr->insert(dist_ptr->end(), XYdata);
01362   }
01363   // expand to lin-lin interpolation
01364   dist_ptr->expand_interp( ENDL.Max_E_out );
01365 
01366   // fill out the 2-d list
01367   gen_mf5_expand( N_theta, e_dist );
01368 
01369   // print it
01370   ENDL.set_yo(1);
01371   ENDL.set_x1(time_consts[count]);
01372   if ( ENDL.write_file ) e_dist.write_endl( 4 );
01373 }
01374 // ----------- fission_delay::gen_mf5_expand -----------------
01375 void fission_delay::gen_mf5_expand(int N_theta, two_d_table& e_dist)
01376 // form the 2-list of energy distributions for general evaporation model
01377 {
01378   one_d_table one_E_in;
01379   two_d_table::iterator g_list = e_dist.end();
01380   --g_list;
01381   two_d_table::iterator next_list = g_list;
01382   dd_link XYdata;
01383   dd_list::iterator g_list_ptr;
01384   int count;
01385 
01386   // append N_theta - 1 more one_d_distrib links to the list
01387   for(count = 1; count < N_theta; ++count)
01388   {
01389     e_dist.insert(e_dist.end(), one_E_in);
01390     ++next_list;  // pointer to the new list
01391     // copy the first list
01392     for(g_list_ptr = g_list->begin();
01393       g_list_ptr != g_list->end(); ++g_list_ptr)
01394     {
01395       XYdata.x = g_list_ptr->x;
01396       XYdata.y = g_list_ptr->y;
01397       next_list->insert(next_list->end(), XYdata);
01398     }
01399   }
01400 
01401   // set the incident energy and scale E' = theta*x
01402   dd_list::iterator theta_ptr = theta.begin();
01403   for(g_list = e_dist.begin(); g_list != e_dist.end();
01404     ++g_list, ++theta_ptr)
01405   {
01406     g_list->E_in() = theta_ptr->x;
01407     double scale_E = theta_ptr->y;
01408     // copy the first list
01409     for(dd_list::iterator g_list_ptr = g_list->begin();
01410       g_list_ptr != g_list->end(); ++g_list_ptr)
01411     {
01412       XYdata.x *= scale_E;
01413     }
01414     // normalize
01415     g_list->renorm();
01416   }
01417 }
01418 // ----------- fission_delay::one_table -----------------
01419 void fission_delay::one_table( mf5_file& inFile, int count )
01420 // get the energy distribution for the j-th channel
01421 // for an mf5 table
01422 {
01423   mf5_table dist_table;
01424 
01425   // zeros because there are no weights
01426   dist_table.read_data( inFile, 0, 0 );
01427 
01428   // print it
01429   ENDL.set_yo(1);
01430   ENDL.set_x1(time_consts[count]);
01431   if ( ENDL.write_file ) dist_table.write_endl( 4 );
01432 }

Generated on Thu Sep 7 10:30:12 2006 for fete -- From ENDFB6 To ENDL by doxygen 1.3.4