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

list_3d.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: list_3d.cpp 1735 2006-02-09 21:47:26Z dbrown $
00032  * 
00033  * ******** fete: From ENDF To ENDL *********
00034  */
00035 
00036 // implementation of the classes for 3-d linked lists
00037 
00038 #include "list_3d.hpp"
00039 #include "endl_formats.hpp"
00040 #include "global_params.hpp"
00041 
00042 extern ENDLClass ENDL;
00043 extern GlobalParameterClass Global;
00044 
00045 // ********* for class three_d_link *************
00046 // ----------- three_d_link::make_cos_link -----------------
00047 void three_d_link::make_cos_link(double e_in,
00048   two_d_arbitrary::iterator new_cos)
00049 // construct the (cosine, probability) list and normalize
00050 {
00051   new_cos->E_in() = e_in;
00052 
00053   // loop through the double differential list
00054   for(two_d_arbitrary::iterator this_cos = begin(); this_cos != end();
00055     ++this_cos)
00056   {
00057     // make a new (cosine, probability) link
00058     double prob = this_cos->get_norm();
00059     dd_link new_link(this_cos->mu(), prob);
00060     new_cos->insert(new_cos->end(), new_link);
00061 
00062     // renormalize the double differential data
00063     this_cos->renorm(prob);
00064   }
00065 
00066   // normalize the (cosine, probability) list
00067   new_cos->renorm();
00068 }
00069 
00070 // ********* for class three_d_list *************
00071 
00072 // ----------- three_d_list constructor ------------
00073 // the default constructor
00074 three_d_list::three_d_list()
00075 {
00076   // debug_on = true;  // for checking the 3-d interpolation
00077   debug_on = false;
00078 
00079   // how many angles to use = 2*Num_mu+1
00080   Num_mu = static_cast<int>( Global.Value("num_mu_3d")); //Load from Global parameters
00081 }
00082 // ----------- three_d_list::print -----------------
00083 void three_d_list::print()
00084 // to print the list
00085 {
00086 // loop through the list
00087   for(three_d_list::iterator this_e_in = begin();
00088       this_e_in != end(); ++this_e_in)
00089     {
00090       cout<<"----------- E_in = " << this_e_in->E_in() << endl;
00091       this_e_in->print();
00092     }   
00093   cout << endl;
00094 } 
00095 
00096 // ----------- three_d_list::write_endl -----------------
00097 void three_d_list::write_endl()
00098   // The three_d_list is used to hold the double differential data
00099   // These data are stored in two different files - i=1 and 1=3.
00100 {
00101 
00102   ENDL.set_I_number( 3 );
00103 
00104   fstream endl_file;
00105   string file_name = ENDL.file_name;
00106 
00107   if(empty())
00108   {
00109     Warning("three_d_list::write_endl","The file "+file_name+" is empty.");
00110     return;
00111   }
00112 
00113   if ( ENDL.new_file() )
00114   {
00115     endl_file.open(file_name.c_str(),ios::out);
00116     Info("three_d_list::write_endl","Opening ENDL file "+file_name);
00117   }
00118   else
00119   {
00120     endl_file.open(file_name.c_str(),ios::out|ios::app);
00121     Info("three_d_list::write_endl","Appending ENDL file "+file_name);
00122   }
00123 
00124   //Shove the header info in
00125   endl_file<<ENDL.header_line_1<<endl;
00126   endl_file<<ENDL.header_line_2<<endl;
00127   endl_file.setf(ios::scientific,ios::floatfield);
00128   
00129   //Now loop over the data and write it out
00130   double old_E_in = -1.0;
00131   for(three_d_list::iterator E_in_link = begin();
00132       E_in_link != end(); 
00133       ++E_in_link)
00134     {
00135       // check for double value of E_in
00136       if(E_in_link->E_in() == old_E_in)
00137       {
00138         Warning("three_d_list::write_endl",
00139             pastenum("Widen the jump in three_d_list at E_in: ",old_E_in));
00140       }
00141       old_E_in = E_in_link->E_in();
00142       double old_mu = -2.0;
00143       for(two_d_list<one_d_table>::iterator cos_link = E_in_link->begin();
00144       cos_link != E_in_link->end(); 
00145       ++cos_link)
00146     {
00147           // check for double value of x
00148           if(cos_link->mu() == old_mu)
00149           {
00150             Warning("three_d_list::write_endl",
00151                 pastenum("Widen the jump in cos_list at E_in: ",old_E_in)+
00152                 pastenum(" mu: ",old_mu));
00153           }
00154           old_mu = cos_link->mu();
00155           double old_x = -2.0;
00156       for(dd_list::iterator E_out_link = cos_link->begin();
00157           E_out_link != cos_link->end(); 
00158           ++E_out_link)
00159         {
00160               // check for double value of x
00161               if(E_out_link->x == old_x)
00162               {
00163                 Warning("three_d_list::write_endl",
00164                     pastenum("Widen the jump in one_d_list at E_in: ",old_E_in)+
00165                     pastenum(" mu: ",old_mu)+
00166                     pastenum(" x: ",old_x));
00167               }
00168               old_x = E_out_link->x;
00169           endl_file << ENDL.data( E_in_link->E_in(), 
00170                     cos_link->mu(), 
00171                     E_out_link->E_out(), 
00172                     E_out_link->y )
00173                <<endl;
00174         }
00175     }
00176     }
00177   
00178   //Put on end of file/section line into output file
00179   endl_file<<ENDL.eof_line<<endl;
00180   
00181   //Finally, we close the output file
00182   Info("three_d_list::write_endl","Closing ENDL file "+file_name);
00183   endl_file.close();
00184   
00185   //************************************************
00186   //Now the cosine data
00187   cosines.write_endl(1);
00188 }
00189 

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