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

mf6_gammas.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: 1735 $
00029  * $Date: 2006-02-09 13:47:26 -0800 (Thu, 09 Feb 2006) $
00030  * $Author: dbrown $
00031  * $Id: mf6_gammas.cpp 1735 2006-02-09 21:47:26Z dbrown $
00032  * 
00033  * ******** fete: From ENDF To ENDL *********
00034  */
00035 
00036 // implementation of the class mf6_gammas
00037 
00038 #include "mf6_gammas.hpp"
00039 
00040 extern ENDLClass ENDL;
00041 extern GlobalParameterClass Global;
00042 
00043 // ********* for class mf6_table *************
00044 // ----------- mf6_table::new_one_d -----------------
00045 mf6_table::iterator mf6_table::new_one_d( mf6_table::iterator where )
00046 {
00047   SevereError("mf6_table::new_one_d", "Implement the routine");
00048   return 0;
00049 }
00050 
00051 // ----------- mf6_table::read_data -----------------
00052 void mf6_table::read_data( mf6_file& inFile, int LEP, int NE )
00053 // read in the ENDF/B-VI tabulated  data
00054 // LEP is the interpolation type
00055 // NE is the number of incident energies
00056 {
00057   // handle each incident neutron energy
00058   for ( int iNE=0; iNE < NE; iNE++ )
00059   {
00060     one_E_in( inFile, LEP );
00061   }
00062 }
00063 
00064 // ------------ mf6_table::one_E_in ---------
00065 void mf6_table::one_E_in( mf6_file& inFile, int LEP )
00066 {
00067   double E_1;   // incident neutron energy
00068   int ND;   // number of discrete energies
00069   int NEP;  // number of secondary energies
00070 
00071   string linebuff;
00072   string strbuff;
00073   
00074   inFile.gamma_ein( &E_1,   // incident energy
00075                     &ND,    // number of discrete energies
00076                     &NEP ); // number of E_out values
00077   
00078   // change to MeV
00079   E_1 *= ENDL.eV2MeV;
00080   // this E_1 corresponds to a new link in the 2d list
00081   one_d_table e_in_link;
00082   e_in_link.E_in() = E_1;
00083   insert(end(), e_in_link);
00084   mf6_table::iterator this_ein = end();
00085   --this_ein;
00086 
00087   // read the data for this E_in
00088   // we may need a list of gamma lines
00089   one_d_table gamma_lines;
00090   gamma_lines.E_in() = E_1;
00091 
00092   for( int iNP=0; iNP < NEP; iNP++ ) //Loop over NEP data pairs
00093   { 
00094     int iP=iNP % 3;  //There are 3 pairs per line
00095     if ( iP == 0 )
00096     {
00097       getline( inFile, linebuff ); //Read in new line
00098     }
00099     strbuff = linebuff.substr( iP*22, 22 );  // grab the right pair
00100     double X, Y; //Real variables we will put the data pair
00101     read_dd(&strbuff, &X, &Y );
00102     // to MeV
00103     X *= ENDL.eV2MeV;
00104     dd_link XYdata( X, Y );
00105     // is this a line?
00106     if( iNP < ND )
00107     { 
00108       if ( Y > 0.0 )
00109       {
00110         // find where to insert the line
00111         one_d_table::iterator next_line = gamma_lines.find_next( X );
00112         gamma_lines.insert( next_line, XYdata );
00113       }
00114     }
00115     else
00116     {
00117       this_ein->insert( this_ein->end( ), XYdata );
00118     }
00119   }
00120   // expand the interpolation
00121   this_ein->dd_list::expand_interp( LEP, ENDL.Max_E_out );
00122 
00123   if( gamma_lines.size( ) > 0 )
00124   {
00125     gamma_lines.widen_delta( );
00126     if( this_ein->size( ) > 0 )
00127     {
00128       // add the lines to the continuum
00129       (*this_ein) += gamma_lines;
00130     }
00131     else
00132     {
00133       // just copy the lines
00134       this_ein->copy( gamma_lines );
00135     }
00136   }
00137   this_ein->renorm( );
00138 }
00139 
00140 // ********* for class mf6_gamma *************
00141 // ----------- mf6_gamma::read_data -----------------
00142 void mf6_gammas::read_data( mf6_file& inFile, int LEP,
00143   int NR, int num_E_in )
00144 // read in the gamma data and make it into a three_d_list
00145 {
00146   // get the interpolation rules
00147   inFile.get_regions( NR, NBT, INT );
00148 
00149   // make the isotropic energy distributions
00150   mf6_table e_dist;
00151   e_dist.read_data( inFile, LEP, num_E_in );
00152 
00153   // now make a three_d_link for each incident energy
00154   for(mf6_table::iterator e_dist_ptr = e_dist.begin();
00155       e_dist_ptr != e_dist.end(); ++e_dist_ptr)
00156   {
00157     mf6_table e_in_link;
00158     insert(end(), e_in_link);
00159 
00160     // make a pointer to the new 3-d link
00161     mf6_gammas::iterator this_link = end();
00162     --this_link;
00163 
00164     // Expand this data into a 3-d link
00165     expand_E_in(e_dist_ptr, this_link);
00166 
00167     // add a link to the cosine list
00168     one_d_table new_cos;
00169     cosines.insert(cosines.end(), new_cos);
00170 
00171     // expand this cosine link
00172     two_d_table::iterator cos_ptr = cosines.end();
00173     --cos_ptr;
00174     cos_ptr->E_in() = e_dist_ptr->E_in();
00175 
00176     // make 2 isotropic links
00177     dd_link new_link(-1.0, 0.5);
00178     cos_ptr->insert(cos_ptr->end(), new_link);
00179     new_link.x = 1.0;
00180     cos_ptr->insert(cos_ptr->end(), new_link);
00181   }
00182   // print the ENDL i=1 and i=3 files
00183   write_endl( );
00184 }
00185 // ----------- mf6_gammas::expand_E_in -----------------
00186 void mf6_gammas::expand_E_in(mf6_table::iterator e_dist_ptr,
00187   mf6_gammas::iterator this_link)
00188 // make isotropic double differential data for 1 incident energy
00189 {
00190   this_link->E_in() = e_dist_ptr->E_in();
00191 
00192   for (int count = 0; count < 2; ++count)
00193   {
00194     double this_mu = -1.0 + 2*count;
00195     // mu corresponds to a new 2d link in the list for this E_in
00196     one_d_table mu_link;
00197     mu_link.mu() = this_mu;
00198     this_link->insert(this_link->end(), mu_link);
00199 
00200     // add energy links for this mu
00201     mf6_table::iterator mu_ptr = this_link->end();
00202     --mu_ptr;
00203     // copy the entries from e_dist_ptr
00204     for(dd_list::iterator e_dist_link = e_dist_ptr->begin();
00205         e_dist_link != e_dist_ptr->end(); ++e_dist_link)
00206     {
00207       dd_link e_out_link(e_dist_link->x, e_dist_link->y);
00208       mu_ptr->insert(mu_ptr->end(), e_out_link);
00209     }
00210   }
00211 }

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