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

b6stream.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: 1752 $
00029  * $Date: 2006-03-16 11:24:52 -0800 (Thu, 16 Mar 2006) $
00030  * $Author: dbrown $
00031  * $Id: b6stream.hpp 1752 2006-03-16 19:24:52Z dbrown $
00032  * 
00033  * ******** fete: From ENDF To ENDL *********
00034  */
00035 
00036 #ifndef B6STREAM_CLASS
00037 #define B6STREAM_CLASS
00038 
00039 #include <stdio.h>  // standard I/O package
00040 #include <fstream>  // standard file stream package
00041 #include <iostream> // for file I/O functions
00042 #include <string>   // for c++ strings
00043 #include <cmath>
00044 #include <list>
00045 #include <vector>
00046 
00047 using namespace std;
00048 
00049 // ------------------------ class iMF_array_link ---------------
00050 //! A vector of MF values for a given reaction (MT)
00051 class iMF_array_link : public vector< int >
00052 {
00053 private:
00054   int MT_;
00055 
00056 public:
00057   //!Common name used to access the MT value of this list.
00058   inline int& MT( )
00059   {
00060     return MT_;
00061   }
00062 
00063   //! Print the MF values for this MT
00064   void print_MF( );
00065 
00066   //! Scans the vector to determine whether angular data should be CM
00067   bool angle_cm( );
00068 };
00069 
00070 // ----------------------- class iMF_array_list -------------------
00071 //!List of iMF_array_links.
00072 class iMF_array_list : public list< iMF_array_link >
00073 {
00074 public:
00075   //! Function to get the link at "x".
00076   // Returns "false" if the entry is not found.
00077   bool at( int x, iMF_array_list::iterator& link );
00078 
00079   //! Check for the presence of MT data
00080   bool found( int MT );
00081 };
00082 
00083 // ------------------------ class b6stream ---------------
00084 //! Reads in an ENDF file, creates single reaction files and gathers global info.
00085 
00086 class b6stream
00087 { // This class reads the preprocessed ENDF file in, fills the global
00088   // ENDF variables and then sends the data into output files.
00089   // The output files are named by the MF and MT data they contain.
00090   // The MAT, MF, MT and NS numbers are removed from all the data
00091   // lines since they are either redundant or unused (NS). 
00092 
00093 public:
00094   // Here are the global ENDF file variables as defined in the manual
00095   int NTAPE;
00096   int MAT, NS, yi, date;
00097   int LRP, LFI, NLIB, NMOD, LIS, LISO, NFOR;
00098   int ZA, NSUB, NVER, LDRV, NWD, NXC;
00099   double AWR, ELIS, STA, AWI, TEMP;
00100 
00101   // Here is the arrays of MF, MT, listed at end of comments.
00102   // The MT (reaction) numbers tag a linked list with
00103   // links containing the MF (data ID) numbers for each reaction.
00104   iMF_array_list MT_MF_list;
00105 
00106   // default Endf input file name
00107   string input_file;
00108 
00109   // Other useful (dummy) variables
00110   int iDummy;
00111   double dDummy;
00112 
00113   ifstream Efile; //instantiate the input file stream
00114   ofstream oFile;  //instantiate output file stream
00115 
00116   //! Default constructor.
00117   b6stream(string inputFile="endf.prepro"); 
00118 
00119   //! Default destructor.
00120   ~b6stream();
00121 
00122   //!Reads a single line from the ENDF file stream.
00123   void readENDF();
00124 
00125   //! Reads the MAT, MF, MT and NS entries at the end of the ENDF line
00126   //! and then strips them from the output stream.
00127   void get_MAT_MF_MT_NS();  //
00128   
00129   //! computes the yi given the sublibrary designator
00130   int NSUB_to_yi(int NSUB);
00131 
00132   void print_summary();
00133 
00134   //! Print all of the MT and MF values
00135   void print_MT_MF( );
00136 
00137 private:
00138   // These variables used only internally
00139   int MF, MT;
00140   int prev_mf, prev_mt;
00141   string sBuff;
00142   bool lofile;
00143   // The "END" records are logicals in our code
00144   bool SEND, FEND, MEND, TEND, DONE;
00145 
00146   // The first 6 lines of the input file are special.
00147   // We can't use NS to count the lines in the file,
00148   // because it resets to 0 after 99999.
00149   bool file_top;
00150 
00151   // A consistency check for the data
00152   void check_mf_mt( );
00153 
00154 protected:
00155 
00156 };
00157 
00158 #endif

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