00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include <sstream>
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 #include <stdio.h>
00041 #include <glob.h>
00042 #include "convert.hpp"
00043 #include "version.hpp"
00044 #include "b6stream.hpp"
00045 #include "bdfls_tools.hpp"
00046 #include "endl_formats.hpp"
00047 #include "load_data.hpp"
00048 #include "global_params.hpp"
00049 #include "messaging.hpp"
00050 #include "mf12classes.hpp"
00051 #include "mf13classes.hpp"
00052 #include "logger.hpp"
00053
00054 #define CLEAN_TEMP_FILES
00055
00056 using namespace std;
00057
00058 #ifdef CLEAN_TEMP_FILES
00059
00060
00061
00062 vector< string > glob(string pattern){
00063 glob_t globbuf;
00064 glob(pattern.c_str(), GLOB_ERR, NULL, &globbuf);
00065 vector< string > names;
00066 for (int i=0; i<globbuf.gl_pathc; ++i)
00067 names.push_back(static_cast<string>( globbuf.gl_pathv[i]) );
00068 return names;
00069 }
00070
00071
00072
00073 bool clean_files( string pattern )
00074 {
00075 bool result=true;
00076 vector<string> filelist = glob(pattern);
00077 for( unsigned int i=0; i<filelist.size(); ++i )
00078 {
00079 result = result && remove(filelist[i].c_str())!=-1;
00080 }
00081 return result;
00082 }
00083
00084 #endif
00085
00086
00087
00088
00089
00090 GlobalParameterClass Global;
00091
00092
00093 bdflsClass bdfls;
00094
00095
00096
00097 ENDLClass ENDL;
00098
00099
00100 map< int, cascade > cascade_gammas;
00101
00102
00103 C55_gammas C55;
00104
00105
00106
00107 MessageLogger messageLog;
00108
00109
00110
00111
00112 int main( int argc, char* argv[] )
00113 {
00114
00115 cout << "+" << 40*string("-") << "+"<<endl;
00116 cout << "|" << center("fete: from ENDF to endl...",40)<< "|"<<endl;
00117 cout << "|" << center("Version "+string(FETE_VERSION),40) << "|" <<endl;
00118 cout << "|" << center("Revision "+string(FETE_REVISION),40) << "|" <<endl;
00119 cout << "|" << center("Last SVN commit "+string(FETE_VERSION_DATE),40) << "|" <<endl;
00120 cout << "+" << 40*string("-") << "+"<<endl;
00121
00122 #ifdef CLEAN_TEMP_FILES
00123
00124 if (!clean_files("yo*")) cout<<"\n\nRemoving old yo* files failed"<<endl;
00125
00126 #endif
00127
00128
00129 string inFile = Global.read_command_line(argc, argv);
00130
00131
00132 Global.print();
00133
00134 bdfls.read();
00135
00136 b6stream Eval(inFile);
00137
00138
00139 if ( MESSAGELEVEL_INFO )
00140 {
00141 Eval.print_MT_MF( );
00142 }
00143
00144
00145 for( iMF_array_list::iterator this_mt = Eval.MT_MF_list.begin();
00146 this_mt != Eval.MT_MF_list.end(); ++this_mt)
00147 {
00148 if ( ( this_mt->MT() != 151 ) && ( ( this_mt->MT() < 450 ) || ( this_mt->MT() > 461 ) ) )
00149 cout << endl << " ------ Processing MT = " << this_mt->MT() << " ------ " << endl;
00150
00151 int mt = this_mt->MT();
00152 bool skip_mt = false;
00153 bool skip_xs = false;
00154
00155
00156 if(
00157 ( mt == 4 && ( Eval.MT_MF_list.found( 50 ) || Eval.MT_MF_list.found( 91 ) ) ) ||
00158 ( mt == 103 && ( Eval.MT_MF_list.found( 600 ) || Eval.MT_MF_list.found( 649 ) ) ) ||
00159 ( mt == 104 && ( Eval.MT_MF_list.found( 650 ) || Eval.MT_MF_list.found( 699 ) ) ) ||
00160 ( mt == 105 && ( Eval.MT_MF_list.found( 700 ) || Eval.MT_MF_list.found( 749 ) ) ) ||
00161 ( mt == 106 && ( Eval.MT_MF_list.found( 750 ) || Eval.MT_MF_list.found( 799 ) ) ) ||
00162 ( mt == 107 && ( Eval.MT_MF_list.found( 800 ) || Eval.MT_MF_list.found( 849 ) ) )
00163 )
00164 {
00165 if ( Global.Value( "translate_all" ) == 0 )
00166 {
00167 Info( "main", pastenum("Skipping mt: ", mt) + ". Use detailed reaction data");
00168 skip_xs = true;
00169 skip_mt = true;
00170 }
00171 }
00172 if( !skip_mt )
00173 {
00174 ENDL.global( Eval.ZA, Eval.AWR, Eval.TEMP, Eval.ELIS, Eval.yi, Eval.date );
00175 ENDL.T = mt;
00176 ENDL.C = 0;
00177 ENDL.S = 0;
00178 ENDL.LR = 0;
00179 ENDL.write_file = true;
00180 ENDL.append = false;
00181 bool xs_exist = false;
00182
00183 for( iMF_array_link::iterator this_mf = this_mt->begin( );
00184 this_mf != this_mt->end( ); ++this_mf )
00185 {
00186 int mf = *this_mf;
00187
00188
00189 if( ( mf == 3 ) || ( ( mf <= 13 ) && ( ( mt >= 3 ) && ( mt <= 4 ) ) ) ) xs_exist = true;
00190
00191 if( mf == 4 ) ENDL.angles_CM = this_mt->angle_cm( );
00192 if( xs_exist && Global.Value( "translate_all" ) > 0 )
00193 {
00194 ENDL.F = mf;
00195 if( !( mf==3 && skip_xs ) ) LoadData( mf, mt );
00196 }
00197 else if ( mt < 151 ) Info("main",pastenum("Skipping mt: ",mt)+
00198 pastenum(" mf: ",mf)+". No cross section data");
00199 }
00200 }
00201 }
00202 if( ( C55.has_MT3 ) || ( C55.has_MT4 ) )
00203 {
00204 C55.write_endl( );
00205 }
00206 messageLog.write();
00207
00208 #ifdef CLEAN_TEMP_FILES
00209
00210 if (!clean_files("mf??mt???")) cout<<"\n\nRemoving temporary mf*mt* files failed"<<endl;
00211
00212 #endif
00213
00214 }