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

endl_formats.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: 1833 $
00029  * $Date: 2006-04-11 16:15:50 -0700 (Tue, 11 Apr 2006) $
00030  * $Author: hedstrom $
00031  * $Id: endl_formats.hpp 1833 2006-04-11 23:15:50Z hedstrom $
00032  * 
00033  * ******** fete: From ENDF To ENDL *********
00034  */
00035 
00036 // routines for writing endl files
00037 
00038 #ifndef ENDL_FORMATS
00039 #define ENDL_FORMATS
00040 
00041 #include <iostream>
00042 #include <iomanip>
00043 #include <fstream>
00044 #include <sstream>
00045 #include <string>
00046 #include <cmath>
00047 #include <vector>
00048 #include <map>
00049 #include <sstream>
00050 #include "bdfls_tools.hpp"
00051 #include "file_names.hpp"
00052 
00053 using namespace std;
00054 
00055 // --------------------- MTCPair ---------------------
00056 class MTCPair
00057 //! Class for storing MT <-> C number associations.  
00058 //! Note: each MT gets a unique C number, but not necessarily the other way around 
00059 {
00060 public:
00061     int MT;
00062     int C;
00063     MTCPair( int mt, int c ): MT(mt), C(c) {}
00064     MTCPair( const MTCPair& other ): MT(other.MT), C(other.C) {}
00065     bool operator==( const MTCPair& other ) const { return MT == other.MT; }
00066     bool operator<( const MTCPair& other ) const { return MT < other.MT; }
00067 };
00068 
00069 
00070 // --------------------- YoList ---------------------
00071 class YoList
00072 //! Class for storing the outgoing particle list (not including the residual)
00073 {
00074 public:
00075     vector<int> yos;
00076     string reactionName;
00077     YoList( string rxnName="", bool fission=false, 
00078         int nN=0, int nP=0, int nD=0, int nT=0, int nH=0, int nA=0, int nG=0):
00079         reactionName(rxnName), yos(8,0)
00080         {
00081             yos[0]=int(fission);
00082             yos[1]=nN;
00083             yos[2]=nP;
00084             yos[3]=nD;
00085             yos[4]=nT;
00086             yos[5]=nH;
00087             yos[6]=nA;
00088             yos[7]=nG;
00089         }
00090     YoList( const YoList& other ): reactionName(other.reactionName), yos(other.yos) {}
00091     bool operator==( const YoList& other ) const { return yos == other.yos; }
00092     bool operator<( const YoList& other ) const { return yos < other.yos; }
00093     int operator[]( int i ) const { return yos[i]; }
00094     int& operator[]( int i ) { return yos[i]; }
00095     YoList& operator+=(const YoList& other)
00096     {
00097         for(unsigned int i=0;i<yos.size();++i) {yos[i]=yos[i]+other.yos[i];}
00098         return *this;
00099     }
00100     bool fission() { return yos[0]!=0; }
00101     string str() 
00102     { 
00103         stringstream ss; 
00104         for(unsigned int i=0;i<yos.size();++i) {ss<<yos[i];}
00105         return ss.str()+" "+reactionName;
00106     }
00107 };
00108 
00109 
00110 
00111 // --------------------- ENDLClass ---------------------
00112 class ENDLClass
00113 //! Class for writing ENDL files
00114 {
00115 private:
00116 
00117   // to set up the yoList <-> MT,C map
00118   void fill_yoMap();
00119 
00120   // This map controls the association of yos to Mt & C numbers
00121   map< MTCPair, YoList > yoMap;
00122 
00123 public:
00124   //Some of the variables are valid for all reactions
00125   int ZA, incident_particle,date,twelve;
00126   double atomic_weight, lifetime, temp, zero;
00127   double projectile_mass, target_mass;
00128   double Max_E_in;  // maximum incident energy for this particle
00129   //Some variables are reaction dependent
00130   int outgoing_particle;
00131   double Max_E_out;  // maximum energy for outgoing particle
00132   int res_za;  // to keep track of the residual ZA
00133   int intermediate_C;  // to keep track of the intermediate C number, for breakup reactions
00134   int current_za;  // the current compund nucleus
00135   double excitation_level;
00136   double threshold;
00137   int C, S, I, T, F, LR, yi;
00138   double QM,QI,X[5];
00139   // Some ENDL angular data is in center-of mass frame, some lab
00140   bool angles_CM;
00141   //Conversion constants
00142   double K2MeV,N2AMU,eV2MeV;
00143   //ENDL header lines
00144   string header_line_1, header_line_2, eof_line;
00145   string file_name;
00146   bool write_file;
00147   bool append;
00148   
00149   ENDLClass();
00150   ~ENDLClass();
00151 
00152   //! Converts and stores global data for ENDL.
00153   void global( int eZA, double eAWR, double eTEMP, double eELIS, int yi, int Date );
00154 
00155   //! Converts reaction data to proper units for ENDL.
00156   void reaction( int lr, double eQM, double eQI );
00157 
00158   //! Returns the particle number corresponding to given ZA
00159   int za_to_yo( int za );
00160 
00161   //! Returns the ZA corresponding to the particle number
00162   int yo_to_za( int yo );
00163 
00164   //! Function to set the ENDL yo identifier.
00165   void set_yo( int yo );
00166 
00167   //! sets the break-up flag for special reactions
00168   //! Identifies the outgoing particle from the MT number
00169   int get_ZAP( int mt );
00170 
00171   //! set the outgoing particle using its ZA
00172   void set_outgoing_ZA( int eZAP );
00173 
00174   //! Calculates the residual ZA
00175   int get_resid( );
00176 
00177   //! Determine ENDL s number.
00178   void set_s_number( );
00179 
00180   //! Hard-wires the ENDL s identifier.
00181   inline void set_s_number( int es )
00182   {
00183     S = es;
00184   }
00185 
00186   //! Set the Q-value and X1, depending on the S number
00187   void set_QValue( );
00188 
00189   //! Converts an ENDF reaction identifier (MT), to an ENDL reaction c number.
00190   void set_c_number( );
00191   
00192   //! Function to hard-wire the ENDL c identifier.
00193   inline void set_c_number( int ec)
00194   {
00195     C = ec;
00196   }
00197 
00198   inline void set_LR( int lr )
00199   {
00200     LR=lr;
00201   }
00202 
00203   //! Reassigns the c number to include the products of residual decay if the residual breaks up
00204   void adjust_c_number_for_breakup();
00205 
00206   //! Function to set the ENDL X_0 value
00207   inline void set_x0( double x0)
00208   {
00209     X[0] = x0;
00210   }
00211 
00212   //! Function to set the ENDL X_1 value
00213   inline void set_x1( double x1)
00214   {
00215     X[1] = x1;
00216   }
00217 
00218   //! Sets the ENDL I number and builds the header lines.
00219   void set_I_number( int eI );
00220 
00221   //! Tests whether a new ENDL file is needed.
00222   bool new_file( );
00223 
00224   // Function that writes out the one double
00225   string data( double d );
00226   
00227   //! Function that writes out the two column data in ENDL format.
00228   string data( double d1, double d2 );
00229   
00230   //! Function that writes out the three column data in ENDL format.
00231   string data( double d1, double d2 , double d3 );
00232   
00233   //! Function that writes out the four column data in ENDL format.
00234   string data( double d1, double d2 , double d3, double d4);
00235 
00236   //! Function that returns the multiplicity of this outgoing particle.
00237   int yo_mult( );
00238  
00239   //! Function that returns the charge of this incident particle.
00240   int get_Z( int yi );
00241 };
00242 
00243 #endif

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