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

bdfls_tools.hpp

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: bdfls_tools.hpp 1735 2006-02-09 21:47:26Z dbrown $
00032  * 
00033  * ******** fete: From ENDF To ENDL *********
00034  */
00035 
00036 #ifndef BDFLS_TOOLS
00037 #define BDFLS_TOOLS
00038 
00039 #include <stdio.h>             // standard I/O package
00040 #include <fstream>             // standard file streams
00041 #include <iostream>            // for file I/O functions
00042 #include <iomanip>             // I/O formatting
00043 #include <string>              // for string fun
00044 #include <cmath>               // math library
00045 #include <list>                // using linked lists
00046 
00047 using namespace std;
00048 
00049 // ------------------------ class mass_life_link ---------------
00050 //!A link to hold ZA, mass, and lifetime
00051 class mass_life_link
00052 {
00053 private:
00054   int za_;
00055   double mass_;
00056   double lifetime_;
00057 
00058 public:
00059   //!Common name used to access the ZA value of this list.
00060   inline int& ZA()
00061   {
00062     return za_;
00063   }
00064 
00065   //!Common name used to access contents of the first double in the pair.
00066   inline double& Mass( )
00067   {
00068     return mass_;
00069   }
00070 
00071   //!Common name used to access contents of the second double in the pair.
00072   inline double& LifeTime( )
00073   {
00074     return lifetime_;
00075   }
00076 
00077   void print( );
00078 };
00079 
00080 // ------------------------ class mass_life_list ---------------
00081 //!A list of mass_life links
00082 class mass_life_list : public list< mass_life_link >
00083 {
00084 public:
00085   //! Function to get the link at "x".
00086   // Returns "false" if the entry is not found.
00087   bool at(int x, mass_life_list::iterator& link);
00088 
00089   void print( );
00090 };
00091 
00092 // ------------------------ class bdflsClass ---------------
00093 //! Class to read in and store the bdfls file information.
00094 class bdflsClass
00095 {
00096   // Only three of the sets of information is interesting for us -
00097   // the masses, the lifetimes and the nuclear constants.
00098   // The class was designed as if all data is to be stored but
00099   // I didn't finish all the sections.  Anyone interested in
00100   // having any of the other info availabe will have to write
00101   // some code in the appropriate switch case.
00102   
00103 public:
00104 
00105   //! Nuclear constants are stored in this array.
00106   double nuclear_constants[20];
00107 
00108   //! Masses and lifetimes stored in a list of mass_life_links as function of ZA.
00109   mass_life_list Mass_Life;
00110 
00111   //! Default constructor.
00112   bdflsClass();  
00113 
00114   //!Default destructor.
00115   ~bdflsClass(); 
00116 
00117   //! Opens bdfls, loops over sections and then closes bdfls file.
00118   void read();
00119 
00120 private:
00121 
00122   string stringbuff;                     //Temporary string buffer
00123   string section[10]; 
00124   int nsection,lastsection,nsection_max; //Section counters and such
00125   int nc_index;                          //index used while reading in nuclear constants
00126 
00127   //!bdfls ifstream object.
00128   ifstream bdflsFile; 
00129 
00130   //! Reads in each section of the bdfls file.
00131   void read_sections();
00132   
00133   //! Read in a line and test it for end-of-section.
00134   bool EndofSection();
00135 
00136 };
00137 
00138 #endif
00139 
00140 
00141 

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