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
00037
00038 #include <cmath>
00039
00040 #include "multiplicity.hpp"
00041 #include "endl_formats.hpp"
00042 #include "endl_precision.hpp"
00043
00044 extern ENDLClass ENDL;
00045
00046
00047
00048
00049
00050
00051 void multiplicity::read_data( int NP, ENDF_file& inFile )
00052 {
00053 one_d_table::read_data( NP, inFile, ENDL.Max_E_in );
00054 if( ENDL.write_file )
00055 {
00056 expand_interp( ENDL.Max_E_in );
00057 }
00058 }
00059
00060
00061
00062 int multiplicity::get_mult( )
00063 {
00064 multiplicity::iterator left_ptr = begin( );
00065 multiplicity::iterator right_ptr = end( );
00066 --right_ptr;
00067 double dm = ENDL_EPSILON( 1.0 );
00068
00069 if( abs( left_ptr->y - right_ptr->y ) > dm )
00070 {
00071 Warning( "multiplicity::get_mult", pastenum(
00072 pastenum( pastenum("Multiplicity not constant: ",left_ptr->y)+" vs. ", right_ptr->y )+" at E = ",left_ptr->x) );
00073 }
00074 return static_cast<int>( dm + 0.5*( left_ptr->y + right_ptr->y ) );
00075 }
00076
00077
00078
00079 bool multiplicity::check_const_mult( )
00080 {
00081 return check_const_mult( multiplicity::begin()->y );
00082 }
00083
00084
00085
00086 bool multiplicity::check_const_mult( double first_mult )
00087 {
00088 double dm = ENDL_EPSILON( 1.0 );
00089
00090 for( multiplicity::iterator itr = multiplicity::begin(); itr != multiplicity::end(); ++itr )
00091 {
00092 if( abs( itr->y - first_mult ) > dm ) return false;
00093 }
00094 return true;
00095 }
00096
00097
00098
00099
00100 void multiplicity::set_min_mult( double min_mult ){
00101 for( multiplicity::iterator itr = multiplicity::begin(); itr != multiplicity::end(); ++itr )
00102 {
00103 if( itr->y < min_mult )
00104 {
00105 Warning("multiplicity::set_min_mult",
00106 pastenum("Multiplicity at E = ",itr->x)+
00107 pastenum("MeV is ",itr->y)+
00108 pastenum(". Resetting to minimum allowed value of ",min_mult));
00109 itr->y = min_mult;
00110 }
00111 }
00112 }
00113
00114
00115
00116
00117 void multiplicity::set_max_mult( double max_mult ){
00118 for( multiplicity::iterator itr = multiplicity::begin(); itr != multiplicity::end(); ++itr )
00119 {
00120 if( itr->y > max_mult )
00121 {
00122 Warning("multiplicity::set_min_mult",
00123 pastenum("Multiplicity at E = ",itr->x)+
00124 pastenum("MeV is ",itr->y)+
00125 pastenum(". Resetting to maximum allowed value of ",max_mult));
00126 itr->y = max_mult;
00127 }
00128 }
00129 }
00130
00131
00132
00133
00134 void multiplicity::set_mult( int mult )
00135 {
00136 for( multiplicity::iterator itr = multiplicity::begin(); itr != multiplicity::end(); ++itr )
00137 {
00138 itr->y=static_cast<double>(mult);
00139 }
00140 }
00141
00142
00143
00144 void multiplicity::scale_by_xs( )
00145 {
00146 mf3_file xs_File;
00147 xs_File.open(3, ENDL.T);
00148 one_d_table xs;
00149
00150
00151 int ZA;
00152 double AWR;
00153 xs_File.read_line1(&ZA, &AWR);
00154
00155
00156 double QM, QI;
00157 int LR, NR, NP;
00158 xs_File.read_line2(
00159 &QM,
00160 &QI,
00161 &LR,
00162 &NR,
00163 &NP
00164 );
00165 xs_File.get_regions( NR, xs.NBT, xs.INT );
00166 xs.read_data( NP, xs_File, ENDL.Max_E_in );
00167 xs_File.close();
00168
00169 *this *= xs;
00170
00171 thinit();
00172 }
00173
00174
00175 void multiplicity::divide_by_xs()
00176 {
00177 mf3_file xs_File;
00178 xs_File.open(3, ENDL.T);
00179 one_d_table xs;
00180
00181
00182 int ZA;
00183 double AWR;
00184 xs_File.read_line1(&ZA, &AWR);
00185
00186
00187 double QM, QI;
00188 int LR, NR, NP;
00189 xs_File.read_line2(
00190 &QM,
00191 &QI,
00192 &LR,
00193 &NR,
00194 &NP
00195 );
00196 xs_File.get_regions(NR, xs.NBT, xs.INT);
00197 xs.read_data( NP, xs_File, ENDL.Max_E_in );
00198 xs_File.close();
00199
00200 *this /= xs;
00201
00202 }
00203
00204
00205 void multiplicity::check_count( )
00206 {
00207 multiplicity::iterator this_link;
00208
00209 for( this_link = begin( ); this_link != end( );
00210 ++this_link )
00211 {
00212 if( this_link->y > 1.0 )
00213 {
00214 Warning( "multiplicity::check_count",
00215 " the multiplicity of a single gamma exceeds 1" );
00216 break;
00217 }
00218 }
00219 }
00220
00221
00222 void multiplicity::list_interp( double e_in, multiplicity& left_list,
00223 multiplicity& right_list )
00224
00225 {
00226 if( !empty() )
00227 {
00228 SevereError("multiplicity::list_interp",
00229 "You are trying to fill a multiplicity which has already been made");
00230 }
00231
00232
00233 multiplicity::iterator left_ptr = left_list.begin( );
00234 multiplicity::iterator right_ptr = right_list.begin( );
00235
00236 double left_e_in = left_ptr->x;
00237 double right_e_in = right_ptr->x;
00238
00239 dd_link XYdata;
00240 XYdata.x = ( left_e_in < right_e_in ) ? left_e_in : right_e_in;
00241 XYdata.y = 0.0;
00242 insert( end( ), XYdata );
00243
00244
00245 left_ptr = left_list.end( );
00246 --left_ptr;
00247 right_ptr = right_list.end( );
00248 --right_ptr;
00249
00250 left_e_in = left_ptr->x;
00251 right_e_in = right_ptr->x;
00252
00253 XYdata.x = ( left_e_in < right_e_in ) ? left_e_in : right_e_in;
00254 insert( end( ), XYdata );
00255 }