Import Geant4 11.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2025-12-05 08:54:02 +01:00
parent a499fb82e9
commit b4a16de652
6484 changed files with 232674 additions and 221097 deletions
+22 -2
View File
@@ -6,10 +6,30 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-05-14 Bret Beck, Caleb Matoon, Godfree Gert, Douglas M Wright (hadr-lend-V11-03-02)
## 2025-11-21 Gabriele Cosmo (hadr-lend-V11-03-07)
- Fixed implicit type conversions from size_t to int (reported on macOS/XCode)
in G4GIDI_target.cc.
## 2025-11-19 Gabriele Cosmo (hadr-lend-V11-03-06)
- Fixed compilation error on macOS with CXX23 enabled in MCGIDI_string.hpp
for use of size_t.
## 2025-11-14 Bret Beck, Caleb Mattoon, Godfree Gert, Douglas M Wright (hadr-lend-V11-03-05)
- Remove the default evaluation string from G4LEND. This change means the user only needs to
update the G4LENDDATA environment variable to switch to a different nuclear data library
- Fixes for various issues identified by Coverity and by compiling with the -Wconversion flag in clang.
## 2025-11-13 Gabriele Cosmo (hadr-lend-V11-03-04)
- Fixed implicit type conversions from size_t to int (reported on macOS/XCode) in headers:
GIDI.hpp, MCGIDI.hpp and MCGIDI_headerSource.hpp.
## 2025-06-20 Bret Beck, Caleb Mattoon, Godfree Gert, Douglas M Wright (hadr-lend-V11-03-03)
- Fixes for all high and most medium impact issues identified by Coverity.
## 2025-05-14 Bret Beck, Caleb Mattoon, Godfree Gert, Douglas M Wright (hadr-lend-V11-03-02)
- Fixes aimed for high impact issues identified by Coverity.
## 2025-02-04 Bret Beck, Caleb Matoon, Godfree Gert, Douglas M Wright (hadr-lend-V11-03-01)
## 2025-02-04 Bret Beck, Caleb Mattoon, Godfree Gert, Douglas M Wright (hadr-lend-V11-03-01)
- Major update of GIDIplus interface with refactored c++ code including:
o uses official GNDS formatted data
o added feature for high-fidelity gamma cascades following reactions such as neutron capture and inelastic scattering
@@ -1,4 +1,4 @@
LEND directory with G4GIDI and GIDI+ assembled on 2025-03-25 13:27:37
G4GIDI git hash = 62db2f9b95bcd850c8821e70db50c4c94874cc4d
G4GIDI git describe = G4GIDI.1.1.0-13-g62db2f9
GIDI+ git describe = GIDI_plus.3.32.0-21-g25ae8f5
LEND directory with G4GIDI and GIDI+ assembled on 2025-11-14 10:32:01
G4GIDI git hash = 67ec00868c75fdae76066418afc6c418eca69081
G4GIDI git describe = G4GIDI.1.1.0-22-g67ec008
GIDI+ git describe = GIDI_plus.3.34.0-9-g0042ff7
@@ -51,6 +51,7 @@ class G4GIDI_target {
MCGIDI::Protare *m_MCGIDI_protare;
std::string m_target;
std::string m_fileName;
std::string m_evaluation;
int m_targetZ;
int m_targetA;
int m_targetM;
@@ -70,6 +71,7 @@ class G4GIDI_target {
std::string const *getName( ) const { return( &m_target ); }
std::string const *getFilename( ) const { return( &m_fileName ); }
std::string const *getEvaluation( ) const { return( &m_evaluation ); }
int getZ( ) const { return( m_targetZ ); }
int getA( ) const { return( m_targetA ); }
int getM( ) const { return( m_targetM ); }
@@ -49,7 +49,7 @@ class G4LENDElasticCrossSection : public G4LENDCrossSection
//G4LENDElasticCrossSection()
//{;};
G4LENDElasticCrossSection( G4ParticleDefinition* pd )
:G4LENDCrossSection("LENDElasitcCrossSection")
:G4LENDCrossSection("LENDElasticCrossSection")
{
proj = pd;
//name = "LEND Elastic Cross Section for ";
@@ -44,7 +44,7 @@ namespace GRIN {
class GRIN_continuumGammas;
}
typedef std::set<int> ExcludeReactionsSet;
typedef std::set<std::size_t> ExcludeReactionsSet;
namespace Functions {
class XYs1d;
@@ -99,8 +99,9 @@ class GNDS_FileTypeInfo {
public:
GNDS_FileTypeInfo( );
GNDS_FileTypeInfo( GNDS_FileType a_GNDS_fileType, std::string a_projectileID = "", std::string a_targetID = "", std::string a_evaluation = "",
std::string a_interaction = "" );
GNDS_FileTypeInfo( GNDS_FileType a_GNDS_fileType, std::string const &a_projectileID = "",
std::string const &a_targetID = "", std::string const &a_evaluation = "",
std::string const &a_interaction = "" );
GNDS_FileTypeInfo( GNDS_FileTypeInfo const &a_GNDS_fileTypeInfo );
GNDS_FileTypeInfo &operator=( GNDS_FileTypeInfo const &a_rhs );
@@ -464,6 +465,11 @@ enum class FileType { XML, HDF };
#define GIDI_conserveNumberChars "number"
#define GIDI_conserveEnergyOutChars "energyOut"
// TargetInfo.
#define GIDI_targetInfoChars "targetInfo"
#define GIDI_atomFractionChars "atomFraction"
#define GIDI_isotopicAbundancesChars "isotopicAbundances"
// GRIN.
#define GIDI_GRIN_continuumGammasChars "GRIN_continuumGammas"
#define GIDI_captureNeutronSeparationEnergyChars "captureNeutronSeparationEnergy"
@@ -711,7 +717,7 @@ class PhysicalQuantity : public Form {
public:
PhysicalQuantity( HAPI::Node const &a_node, SetupInfo &a_setupInfo );
PhysicalQuantity( double a_value, std::string a_unit );
PhysicalQuantity( double a_value, std::string const &a_unit );
PhysicalQuantity( PhysicalQuantity const &a_physicalQuantity ) :
Form( FormType::physicalQuantity ),
m_value( a_physicalQuantity.value( ) ),
@@ -799,7 +805,7 @@ class Axis : public Form {
public:
Axis( HAPI::Node const &a_node, SetupInfo &a_setupInfo, FormType a_type = FormType::axis );
Axis( int a_index, std::string a_label, std::string a_unit, FormType a_type = FormType::axis );
Axis( int a_index, std::string const &a_label, std::string const &a_unit, FormType a_type = FormType::axis );
Axis( Axis const &a_axis );
virtual ~Axis( );
@@ -884,11 +890,11 @@ namespace Array {
class FullArray {
public:
FullArray( std::vector<int> a_shape );
FullArray( std::vector<int> a_shape, std::vector<double> a_flattenedValues );
FullArray( std::vector<std::size_t> const &a_shape );
FullArray( std::vector<std::size_t> const &a_shape, std::vector<double> const &a_flattenedValues );
~FullArray( ) {}
std::vector<int> m_shape; /**< The shape of the array. */
std::vector<std::size_t> m_shape; /**< The shape of the array. */
std::vector<double> m_flattenedValues; /**< A *std::vector<double>* representing the flattened arrary. */
std::size_t size( ) const { return( m_flattenedValues.size( ) ); }
@@ -903,7 +909,7 @@ class FullArray {
class Array : public Form {
private:
std::vector<int> m_shape; /**< The shape of the array. */
std::vector<std::size_t> m_shape; /**< The shape of the array. */
std::string m_compression; /**< The compression of the array. Allowed values are *none*, *diagonal*, *flattened* or *embedded*. */
std::string m_symmetry; /**< The symmetry of the array. Allowed values are *none*, *lower* or *upper*. */
std::string m_permutation; /**< The permutation of the array. Allowed values are *none*, *-1*, and *1*. */
@@ -920,7 +926,7 @@ class Array : public Form {
std::size_t dimension( ) const { return( m_shape.size( ) ); } /**< Returns the dimension of the array. */
std::size_t size( ) const ;
std::vector<int> const &shape( ) const { return( m_shape ); } /**< Returns a const reference to member *m_shape*. */
std::vector<std::size_t> const &shape( ) const { return( m_shape ); } /**< Returns a const reference to member *m_shape*. */
FullArray constructArray( ) const ;
void toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const ;
@@ -936,21 +942,18 @@ class Array : public Form {
class FlattenedArrayData : public Form {
public:
std::vector<int> m_shape; /**< The shape of the flattened array. */
std::vector<std::size_t> m_shape; /**< The shape of the flattened array. */
std::size_t m_numberOfStarts; /**< The number of start values. */
std::size_t m_numberOfLengths; /**< The number of length values. */
nf_Buffer<int> m_starts; /**< The start values. */
nf_Buffer<int> m_lengths; /**< The length values. */
nf_Buffer<double> m_dValues; /**< The given array data. */
// int32_t *m_starts; /**< The start values. */
// int32_t *m_lengths; /**< The length values. */
// std::vector<double> m_dValues; /**< The given array data. */
FlattenedArrayData( HAPI::Node const &a_node, SetupInfo &a_setupInfo, int a_dimensions, int a_useSystem_strtod );
~FlattenedArrayData( );
std::vector<int> const &shape( ) const { return( m_shape ); }
void setToValueInFlatRange( int a_start, int a_end, double a_value );
std::vector<std::size_t> const &shape( ) const { return( m_shape ); }
void setToValueInFlatRange( std::size_t a_start, std::size_t a_end, double a_value );
void toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const ;
};
@@ -972,7 +975,7 @@ class Array3d : public Form {
Matrix matrix( std::size_t a_index ) const ;
void modifiedMultiGroupElasticForTNSL( int maxTNSL_index );
void modifiedMultiGroupElasticForTNSL( std::size_t maxTNSL_index );
void toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const { m_array.toXMLList( a_writeInfo, a_indent ); }
};
@@ -1036,7 +1039,7 @@ class Function1dForm : public FunctionForm {
Function1dForm &operator=( Function1dForm const &a_rhs );
virtual double evaluate( double a_x1 ) const = 0;
virtual void mapToXsAndAdd( int a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const ;
virtual void mapToXsAndAdd( std::size_t a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const ;
virtual XYs1d *asXYs1d( bool a_asLinlin, double a_accuray, double a_lowerEps, double a_upperEps ) const ;
virtual void write( FILE *a_file, std::string const &a_format ) const ;
@@ -1065,7 +1068,7 @@ class Constant1d : public Function1dForm {
double domainMax( ) const { return( m_domainMax ); } /**< Returns the value of the *m_domainMax* member. */
double evaluate( double a_x1 ) const ;
void mapToXsAndAdd( int a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const ;
void mapToXsAndAdd( std::size_t a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const ;
XYs1d *asXYs1d( bool a_asLinlin, double a_accuray, double a_lowerEps, double a_upperEps ) const ;
void toXMLList_func( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, bool a_embedded, bool a_inRegions ) const ;
@@ -1094,7 +1097,7 @@ class XYs1d : public Function1dForm {
~XYs1d( );
XYs1d &operator=( XYs1d const &a_rhs );
std::size_t size( ) const { return( ptwXY_length( nullptr, m_ptwXY ) ); } /**< Returns the number of points (i.e., x,y pairs) in this. */
std::size_t size( ) const { return( static_cast<std::size_t>( ptwXY_length( nullptr, m_ptwXY ) ) ); } /**< Returns the number of points (i.e., x,y pairs) in this. */
ptwXYPoints const *ptwXY( ) const { return( m_ptwXY ); } /**< Returns the value of the *m_ptwXY* member. */
ptwXYPoints *ptwXY( ) { return( m_ptwXY ); } /**< Returns the value of the *m_ptwXY* member. */
@@ -1117,7 +1120,7 @@ class XYs1d : public Function1dForm {
XYs1d domainSliceMax( double a_domainMax ) const ;
double evaluate( double a_x1 ) const ;
void mapToXsAndAdd( int a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const ;
void mapToXsAndAdd( std::size_t a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const ;
XYs1d *asXYs1d( bool a_asLinlin, double a_accuray, double a_lowerEps, double a_upperEps ) const ;
double integrate( double a_dommainMin, double a_dommainMax );
@@ -1194,7 +1197,7 @@ class Polynomial1d : public Function1dForm {
std::vector<double> const &coefficients( ) const { return( m_coefficients ); } /**< Returns the value of the *m_coefficients* member. */
double evaluate( double a_x1 ) const ;
void mapToXsAndAdd( int a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const ;
void mapToXsAndAdd( std::size_t a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const ;
XYs1d *asXYs1d( bool a_asLinlin, double a_accuray, double a_lowerEps, double a_upperEps ) const ;
void toXMLList_func( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, bool a_embedded, bool a_inRegions ) const ;
@@ -1251,7 +1254,7 @@ class Gridded1d : public Function1dForm {
Vector const &data( ) const { return( m_data ); } /**< Returns the value of the *m_data* member. */
void setData( Vector const &a_data ) { m_data = a_data; } /**< Sets the *m_data* member to *a_data*. */
void modifiedMultiGroupElasticForTNSL( int a_maxTNSL_index );
void modifiedMultiGroupElasticForTNSL( std::size_t a_maxTNSL_index );
double evaluate( double a_x1 ) const ;
void toXMLList_func( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, bool a_embedded, bool a_inRegions ) const ;
@@ -1337,7 +1340,7 @@ class Regions1d : public Function1dForm {
void append( Function1dForm *a_function );
double evaluate( double a_x1 ) const ;
void mapToXsAndAdd( int a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const ;
void mapToXsAndAdd( std::size_t a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const ;
XYs1d *asXYs1d( bool a_asLinlin, double a_accuray, double a_lowerEps, double a_upperEps ) const ;
std::vector<double> const &Xs( ) const { return( m_Xs ); } /**< Returns the value of the *m_Xs* member. */
@@ -1971,7 +1974,7 @@ class Gridded3d : public Function3dForm {
Array3d const &data( ) const { return( m_data ); } /**< Returns the value of the *m_data* member. */
void modifiedMultiGroupElasticForTNSL( int maxTNSL_index );
void modifiedMultiGroupElasticForTNSL( std::size_t maxTNSL_index );
void toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const ;
};
@@ -2569,7 +2572,7 @@ class Suite : public GUPI::Ancestry {
private:
std::string m_keyName; /**< The name of the key used to look up items in the suite. */
mutable Forms m_forms; /**< The list of nodes stored within *this*. */
std::map<std::string,int> m_map; /**< A map of *this* node labels to their index in *m_forms*. */
std::map<std::string,std::size_t> m_map; /**< A map of *this* node labels to their index in *m_forms*. */
Styles::Suite const *m_styles; /**< The Styles::Suite for the Protare that *this* resides in. */
bool m_allowsLazyParsing; /**< If **true**, the suite allows its elements to be lazy parsed. */
std::string m_href; /**< xlink to the to a Suite that has the elements for this Suite. */
@@ -2592,12 +2595,13 @@ class Suite : public GUPI::Ancestry {
const_iterator begin( ) const { return m_forms.begin( ); } /**< The C++ const *begin iterator* for *this*. */
iterator end( ) { return m_forms.end( ); } /**< The C++ *end iterator* for *this*. */
const_iterator end( ) const { return m_forms.end( ); } /**< The C++ const *end iterator* for *this*. */
int operator[]( std::string const &a_label ) const ;
std::size_t operator[]( std::string const &a_label ) const ;
template<typename T> T *get( std::size_t a_Index );
template<typename T> T const *get( std::size_t a_Index ) const ;
template<typename T> T *get( std::string const &a_label );
template<typename T> T const *get( std::string const &a_label ) const ;
template<typename T> T *getViaLineage( std::string const &a_label );
template<typename T> T *getViaLineage( std::string const &a_label ) const;
template<typename T> T *pop( std::size_t a_Index );
template<typename T> T *pop( std::string const &a_label );
@@ -2615,7 +2619,7 @@ class Suite : public GUPI::Ancestry {
iterator checkLazyParsingHelperFormIterator( iterator a_iter ) ;
const_iterator checkLazyParsingHelperFormIterator( const_iterator a_iter ) const ;
void modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> a_maximumTNSL_MultiGroupIndex );
void modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> const &a_maximumTNSL_MultiGroupIndex );
GUPI::Ancestry *findInAncestry3( std::string const &a_item );
GUPI::Ancestry const *findInAncestry3( std::string const &a_item ) const ;
std::vector<iterator> findAllOfMoniker( std::string const &a_moniker ) ;
@@ -2673,7 +2677,7 @@ template<typename T> T const *Suite::get( std::size_t a_index ) const {
template<typename T> T *Suite::get( std::string const &a_label ) {
int index = (*this)[a_label];
auto index = (*this)[a_label];
Form *__form = checkLazyParsingHelperForm( index );
T *object = dynamic_cast<T *>( __form );
@@ -2692,7 +2696,7 @@ template<typename T> T *Suite::get( std::string const &a_label ) {
template<typename T> T const *Suite::get( std::string const &a_label ) const {
int index = (*this)[a_label];
auto index = (*this)[a_label];
Form *__form = checkLazyParsingHelperForm( index );
T *object = dynamic_cast<T *>( __form );
@@ -2737,7 +2741,7 @@ template<typename T> T *Suite::pop( std::size_t a_index ) {
template<typename T> T *Suite::pop( std::string const &a_label ) {
int index = (*this)[a_label]; // This will throw an exception if *a_label* is not in *this*.
auto index = (*this)[a_label]; // This will throw an exception if *a_label* is not in *this*.
Form *__form = checkLazyParsingHelperForm( index );
T *object = dynamic_cast<T *>( __form );
@@ -2831,8 +2835,8 @@ class Data : public GUPI::Ancestry {
class Table : public Form {
private:
int m_rows; /**< The number of rows in the table. */
int m_coluns; /**< The number of columns in the table. */
std::size_t m_rows; /**< The number of rows in the table. */
std::size_t m_columns; /**< The number of columns in the table. */
std::string m_storageOrder; /**< The storageOrder for the data in the table. */
Suite m_columnHeaders; /**< The column header for the table. */
Data m_data; /**< The data for the table. */
@@ -2841,8 +2845,8 @@ class Table : public Form {
Table( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo );
~Table( );
int rows( ) const { return( m_rows ); } /**< Returns the value of the *m_rows* member. */
int columns( ) const { return( m_coluns ); } /**< Returns the value of the *m_coluns* member. */
std::size_t rows( ) const { return( m_rows ); } /**< Returns the value of the *m_rows* member. */
std::size_t columns( ) const { return( m_columns ); } /**< Returns the value of the *m_columns* member. */
std::string const &storageOrder( ) const { return( m_storageOrder ); } /**< Returns the value of the *m_storageOrder* member. */
Suite const &columnHeaders( ) const { return( m_columnHeaders ); } /**< Returns the value of the *m_columnHeaders* member. */
Data const &data( ) const { return( m_data ); } /**< Returns the value of the *m_data* member. */
@@ -2912,6 +2916,110 @@ class Transportable : public Form {
void toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const ;
};
namespace TargetInfo {
/*
============================================================
========================= nuclide =========================
============================================================
*/
class Nuclide : public GUPI::Entry {
private:
double m_atomFraction; /**< The atom fraction for *this* isotope. */
public:
Nuclide( HAPI::Node const &a_node );
~Nuclide( );
std::string const &pid( ) const { return( keyValue( ) ); } /**< Returns a const reference to the results of the call to the *keyValue()* method. */
double atomFraction( ) const { return( m_atomFraction ); } /**< Returns the value of the *m_atomFraction* member. */
GUPI::Ancestry *findInAncestry3( LUPI_maybeUnused std::string const &a_item ) { return( nullptr ); }
GUPI::Ancestry const *findInAncestry3( LUPI_maybeUnused std::string const &a_item ) const { return( nullptr ); }
void toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent = "" ) const ;
};
/*
============================================================
===================== ChemicalElement =====================
============================================================
*/
class ChemicalElement : public GUPI::Entry {
private:
GUPI::Suite m_nuclides; /**< The list of nuclies for the chemical element. */
public:
ChemicalElement( HAPI::Node const &a_node );
~ChemicalElement( );
GUPI::Suite &nuclides( ) { return( m_nuclides ); }
GUPI::Suite const &nuclides( ) const { return( m_nuclides ); }
std::string const &symbol( ) const { return( keyValue( ) ); } /**< Returns a const reference to the results of the call to the *keyValue()* method. */
Nuclide const *operator[]( std::string const &a_pid ) const ;
GUPI::Ancestry *findInAncestry3( LUPI_maybeUnused std::string const &a_item ) { return( nullptr ); }
GUPI::Ancestry const *findInAncestry3( LUPI_maybeUnused std::string const &a_item ) const { return( nullptr ); }
void toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent = "" ) const ;
};
/*
============================================================
==================== IsotopicAbundances ====================
============================================================
*/
class IsotopicAbundances : public GUPI::Ancestry {
private:
GUPI::Suite m_chemicalElements;
public:
IsotopicAbundances( );
~IsotopicAbundances( );
void initialize( HAPI::Node const &a_node );
GUPI::Suite &chemicalElements( ) { return( m_chemicalElements ); } /**< Returns a reference to the *m_chemicalElements* member. */
GUPI::Suite const &chemicalElements( ) const { return( m_chemicalElements ); } /**< Returns a const reference to the *m_chemicalElements* member. */
ChemicalElement const *operator[]( std::string const &a_symbol ) const ;
GUPI::Ancestry *findInAncestry3( LUPI_maybeUnused std::string const &a_item ) { return( nullptr ); }
GUPI::Ancestry const *findInAncestry3( LUPI_maybeUnused std::string const &a_item ) const { return( nullptr ); }
void toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent = "" ) const ;
};
/*
============================================================
======================== TargetInfo =======================
============================================================
*/
class TargetInfo : public GUPI::Ancestry {
private:
IsotopicAbundances m_isotopicAbundances; /**< The list of isotopic abundances for a TNSL protare. */
public:
TargetInfo( );
~TargetInfo( );
void parseEvaluatedTargetInfo( HAPI::Node const &a_node );
IsotopicAbundances const &isotopicAbundances( ) const { return( m_isotopicAbundances ); } /**< Returns a const reference to the *m_isotopicAbundances* member. */
GUPI::Ancestry *findInAncestry3( LUPI_maybeUnused std::string const &a_item ) { return( nullptr ); }
GUPI::Ancestry const *findInAncestry3( LUPI_maybeUnused std::string const &a_item ) const { return( nullptr ); }
void toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent = "" ) const ;
};
} // End of namespace targetInfo.
/*
============================================================
======================= ExternalFile =======================
@@ -2987,7 +3095,7 @@ namespace ExternalFiles {
class Suite : public GIDI::Suite {
public:
void registerBinaryFiles(std::string a_parentDir, SetupInfo &a_setupInfo);
void registerBinaryFiles( std::string const &a_parentDir, SetupInfo &a_setupInfo );
};
@@ -3027,6 +3135,9 @@ class Base : public Form {
Base const *getDerivedStyle( ) const ;
Base const *getDerivedStyle( std::string const &a_moniker ) const ;
std::vector<Base const *> chain( ) const ;
bool isStyleInDerivedForm( Base const *a_style ) const ;
std::string baseXMLAttributes( GUPI::WriteInfo &a_writeInfo ) const ;
};
@@ -3280,10 +3391,19 @@ class URR_probabilityTables : public Base {
*/
class Suite : public GIDI::Suite {
private:
std::vector<Base const *> m_chainEnds; /**< The list of all the ends of the style chains. */
std::vector<Base const *> m_preProcessingChainEnds; /**< The list of all the ends of the pre-processed style chains. */
public:
Suite( );
std::string const *findLabelInLineage( GIDI::Suite const &a_suite, std::string const &a_label ) const ;
std::vector< std::vector<Base const *> > chains( bool a_ends ) const ;
void updateChainEnds( );
std::vector<Base const *> const &chainEnds( ) const { return( m_chainEnds ); } /**< Returns a const reference to the **m_chainEnds** member. */
std::vector<Base const *> const &preProcessingChainEnds( ) const { return( m_preProcessingChainEnds ); }
/**< Returns a const reference to the **m_preProcessingChainEnds** member. */
};
/*
@@ -3331,6 +3451,16 @@ template<typename T> T *Suite::getViaLineage( std::string const &a_label ) {
return( get<T>( *label ) );
}
/*
=========================================================
*/
template<typename T> T *Suite::getViaLineage( std::string const &a_label ) const {
std::string const *label = m_styles->findLabelInLineage( (Styles::Suite &) *this, a_label );
return( get<T>( *label ) );
}
/*
============================================================
==================== Transporting stuff ====================
@@ -3365,16 +3495,16 @@ class MultiGroup {
~MultiGroup( );
MultiGroup &operator=( MultiGroup const &a_rhs );
double operator[]( int const a_index ) const { return( m_boundaries[a_index] ); } /**< Returns the multi-group boundary at index *a_index*. */
double operator[]( std::size_t const a_index ) const { return( m_boundaries[a_index] ); } /**< Returns the multi-group boundary at index *a_index*. */
std::size_t size( ) const { return( m_boundaries.size( ) ); } /**< Returns the number of multi-group boundaries. */
int numberOfGroups( ) const { return( (int) ( m_boundaries.size( ) - 1 ) ); } /**< Returns the number of multi-group groups. */
std::size_t numberOfGroups( ) const { return( ( m_boundaries.size( ) - 1 ) ); } /**< Returns the number of multi-group groups. */
std::vector<double> const &boundaries( ) const { return( m_boundaries ); } /**< Returns the value of the *m_boundaries* member. */
double const *pointer( ) const { return( &(m_boundaries[0]) ); } /**< Returns a pointer to the beginning of the multi-group boundaries. */
void set( std::string const &a_label, std::vector<double> const &a_boundaries );
std::string const &label( ) const { return( m_label ); } /**< Returns the value of the *m_label* member. */
int multiGroupIndexFromEnergy( double a_energy, bool a_encloseOutOfRange ) const ;
void print( std::string const &a_indent, bool a_outline = false, int a_valuesPerLine = 10 ) const ;
void print( std::string const &a_indent, bool a_outline = false, unsigned int a_valuesPerLine = 10 ) const ;
};
/*
@@ -3396,7 +3526,7 @@ class Groups_from_bdfls {
MultiGroup getViaGID( int a_gid ) const;
std::vector<std::string> labels( ) const;
std::vector<int> GIDs( ) const;
void print( bool a_outline = true, int a_valuesPerLine = 10 ) const;
void print( bool a_outline = true, unsigned int a_valuesPerLine = 10 ) const;
private:
void initialize( char const *a_fileName );
@@ -3410,23 +3540,23 @@ class Groups_from_bdfls {
class Flux_order {
private:
int m_order; /**< The Legendre order of the flux. */
std::size_t m_order; /**< The Legendre order of the flux. */
std::vector<double> m_energies; /**< List of flux energies. */
std::vector<double> m_fluxes; /**< List of flux values - one for each element of m_energies. */
public:
Flux_order( int a_order, int a_length, double const *a_energies, double const *a_fluxes );
Flux_order( int a_order, std::vector<double> const &a_energies, std::vector<double> const &a_fluxes );
Flux_order( std::size_t a_order, std::size_t a_length, double const *a_energies, double const *a_fluxes );
Flux_order( std::size_t a_order, std::vector<double> const &a_energies, std::vector<double> const &a_fluxes );
Flux_order( Flux_order const &a_fluxOrder );
~Flux_order( );
int order( ) const { return( m_order ); } /**< Returns the value of the *m_order* member. */
int size( ) const { return( (int) m_energies.size( ) ); } /**< Returns the number of energy, flux pairs. */
std::size_t order( ) const { return( m_order ); } /**< Returns the value of the *m_order* member. */
std::size_t size( ) const { return( m_energies.size( ) ); } /**< Returns the number of energy, flux pairs. */
double const *energies( ) const { return( &(m_energies[0]) ); } /**< Returns a pointer to the beginning of the energy data. */
std::vector<double> const &v_energies( ) const { return( m_energies ); } /**< Returns the value of the *m_energies* member. */
double const *fluxes( ) const { return( &(m_fluxes[0]) ); } /**< Returns a pointer to the beginning of the flux data. */
std::vector<double> const &v_fluxes( ) const { return( m_fluxes ); } /**< Returns the value of the *m_fluxes* member. */
void print( int a_valuesPerLine = 10 ) const;
void print( unsigned int a_valuesPerLine = 10 ) const;
};
/*
@@ -3447,15 +3577,16 @@ class Flux {
Flux( Flux const &a_flux );
~Flux( );
Flux_order const &operator[]( int a_order ) const { return( m_fluxOrders[a_order] ); } /**< Returns the Flux_order for Legendre order *a_order*. */
int maxOrder( ) const { return( (int) m_fluxOrders.size( ) - 1 ); } /**< Returns the maximum number of Legendre orders for *this*. */
int size( ) const { return( (int) m_fluxOrders.size( ) ); } /**< Returns the number of stored Legendre orders. */
Flux_order const &operator[]( std::size_t a_order ) const { return( m_fluxOrders[a_order] ); }
/**< Returns the Flux_order for Legendre order *a_order*. */
std::size_t maxOrder( ) const { return( m_fluxOrders.size( ) - 1 ); } /**< Returns the maximum number of Legendre orders for *this*. */
std::size_t size( ) const { return( m_fluxOrders.size( ) ); } /**< Returns the number of stored Legendre orders. */
std::string const &label( ) const { return( m_label ); } /**< Returns the value of the *m_label* member. */
double temperature( ) const { return( m_temperature ); } /**< Returns the value of the *m_temperature* member. */
void addFluxOrder( Flux_order const &a_fluxOrder );
ProcessedFlux process( std::vector<double> const &a_multiGroup ) const ;
void print( std::string const &a_indent, bool a_outline = true, int a_valuesPerLine = 10 ) const ;
void print( std::string const &a_indent, bool a_outline = true, unsigned int a_valuesPerLine = 10 ) const ;
};
/*
@@ -3477,7 +3608,7 @@ class Fluxes_from_bdfls {
Functions::XYs3d *get3dViaFID( int a_fid ) const ;
std::vector<std::string> labels( ) const ;
std::vector<int> FIDs( ) const ;
void print( bool a_outline = true, int a_valuesPerLine = 10 ) const ;
void print( bool a_outline = true, unsigned int a_valuesPerLine = 10 ) const ;
private:
void initialize( char const *a_fileName, double a_temperature_MeV );
@@ -3516,7 +3647,7 @@ class Particle {
Transporting::Conserve m_conserve; /**< Indicates the conservation option for this transportable. */
MultiGroup m_multiGroup; /**< Coarse multi-group to collapse to. */
MultiGroup m_fineMultiGroup; /**< Fine multi-group to collapse from. For internal use only. */
std::vector<int> m_collapseIndices; /**< Indices for collapsing to m_multiGroup. */
std::vector<std::size_t> m_collapseIndices; /**< Indices for collapsing to m_multiGroup. */
std::vector<Flux> m_fluxes; /**< One flux for each temperature. */
std::vector<ProcessedFlux> m_processedFluxes; /**< One processed flux for each temperature. */
@@ -3533,12 +3664,12 @@ class Particle {
Transporting::Conserve conserve( ) const { return( m_conserve ); } /**< Returns the value of the *m_conserve* member. */
int multiGroupIndexFromEnergy( double a_e_in, bool a_encloseOutOfRange ) const { return( m_multiGroup.multiGroupIndexFromEnergy( a_e_in, a_encloseOutOfRange ) ); }
/**< Returns the coarse multi-group index corresponding to energy *a_e_in*. See MultiGroup::multiGroupIndexFromEnergy. */
int numberOfGroups( ) const { return( m_multiGroup.numberOfGroups( ) ); } /**< Returns the number of coarse multi-group groups. */
std::size_t numberOfGroups( ) const { return( m_multiGroup.numberOfGroups( ) ); } /**< Returns the number of coarse multi-group groups. */
MultiGroup multiGroup( ) const { return( m_multiGroup ); } /**< Returns the value of the *m_multiGroup* member. */
MultiGroup fineMultiGroup( ) const { return( m_fineMultiGroup ); } /**< Returns the value of the *m_fineMultiGroup* member. */
int appendFlux( Flux const &a_flux );
ProcessedFlux const *nearestProcessedFluxToTemperature( double a_temperature ) const;
std::vector<int> const &collapseIndices( ) const { return( m_collapseIndices ); } /**< Returns the value of the *m_collapseIndices* member. */
std::vector<std::size_t> const &collapseIndices( ) const { return( m_collapseIndices ); } /**< Returns the value of the *m_collapseIndices* member. */
void process( Transportable const &a_transportable, double a_epsilon = 1e-6 );
void print( std::string const &a_indent ) const ;
@@ -3635,7 +3766,7 @@ class MG : public Settings {
/**< Sets the *m_useMultiGroupSummedData* member to *a_useMultiGroupSummedData*. */
Form const *form( LUPI::StatusMessageReporting &a_smr, GIDI::Suite const &a_suite, Styles::TemperatureInfo const &a_temperatureInfo,
std::string a_dataType ) const ;
std::string a_dataType, std::string const &a_label = "" ) const ;
};
} // End of namespace Transporting.
@@ -3774,7 +3905,7 @@ class Product : public Form {
Component const &averageMomentum( ) const { return( m_averageMomentum ); } /**< Returns a const reference to the *m_averageMomentum* member. */
OutputChannel *outputChannel( ) const { return( m_outputChannel ); } /**< Returns a reference to the *m_outputChannel* member. */
void modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> a_maximumTNSL_MultiGroupIndex );
void modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> const &a_maximumTNSL_MultiGroupIndex );
bool hasFission( ) const ;
bool isDelayedFissionNeutronComplete( bool a_isDelayedNeutron ) const ;
@@ -3793,7 +3924,7 @@ class Product : public Form {
Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_productID ) const ;
Matrix multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID,
int a_order ) const ;
std::size_t a_order ) const ;
Vector multiGroupAverageEnergy( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_productID ) const ;
@@ -3803,7 +3934,7 @@ class Product : public Form {
void continuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID, double a_energy,
double &a_productEnergy, double &a_productMomentum, double &a_productGain, bool a_ignoreIncompleteParticles ) const ;
void mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
std::vector<double> const &a_energies, int a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const ;
bool isCompleteParticle( ) const ;
@@ -3848,7 +3979,7 @@ class DelayedNeutron : public Form {
Vector multiGroupMultiplicity( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
std::string const &a_productID ) const ;
Matrix multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
Transporting::Particles const &a_particles, std::string const &a_productID, int a_order ) const ;
Transporting::Particles const &a_particles, std::string const &a_productID, std::size_t a_order ) const ;
Vector multiGroupAverageEnergy( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
std::string const &a_productID ) const ;
Vector multiGroupAverageMomentum( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
@@ -3858,7 +3989,7 @@ class DelayedNeutron : public Form {
void continuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID, double a_energy,
double &a_productEnergy, double &a_productMomentum, double &a_productGain, bool a_ignoreIncompleteParticles ) const ;
void mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
std::vector<double> const &a_energies, int a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const ;
void calculateMultiGroupData( ProtareSingle const *a_protare, Styles::TemperatureInfo const &a_temperatureInfo,
std::string const &a_heatedMultiGroupLabel, MultiGroupCalulationInformation const &a_multiGroupCalulationInformation,
@@ -3880,7 +4011,7 @@ class DelayedNeutronProduct {
Product const *m_product;
public:
DelayedNeutronProduct( int a_delayedNeutronIndex, PhysicalQuantity a_rate, Product const *a_product ) :
DelayedNeutronProduct( int a_delayedNeutronIndex, PhysicalQuantity const &a_rate, Product const *a_product ) :
m_delayedNeutronIndex( a_delayedNeutronIndex ),
m_rate( a_rate ),
m_product( a_product ) {
@@ -3934,7 +4065,7 @@ class FissionFragmentData : public GUPI::Ancestry {
Vector multiGroupMultiplicity( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
std::string const &a_productID ) const ;
Matrix multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
Transporting::Particles const &a_particles, std::string const &a_productID, int a_order ) const ;
Transporting::Particles const &a_particles, std::string const &a_productID, std::size_t a_order ) const ;
Vector multiGroupAverageEnergy( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
std::string const &a_productID ) const ;
Vector multiGroupAverageMomentum( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
@@ -3945,7 +4076,7 @@ class FissionFragmentData : public GUPI::Ancestry {
void continuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID, double a_energy,
double &a_productEnergy, double &a_productMomentum, double &a_productGain, bool a_ignoreIncompleteParticles ) const ;
void mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
std::vector<double> const &a_energies, int a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const ;
void calculateMultiGroupData( ProtareSingle const *a_protare, Styles::TemperatureInfo const &a_temperatureInfo,
std::string const &a_heatedMultiGroupLabel, MultiGroupCalulationInformation const &a_multiGroupCalulationInformation,
@@ -3972,7 +4103,7 @@ class OutputChannel : public GUPI::Ancestry {
Construction::FissionResiduals m_fissionResiduals; /**< This member specifies what fission redisual products will be added to the list of products produced in a fission reaction. */
public:
OutputChannel( bool a_twoBody, bool a_fissions, std::string a_process );
OutputChannel( bool a_twoBody, bool a_fissions, std::string const &a_process );
OutputChannel( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pops,
PoPI::Database const &a_internalPoPs, Styles::Suite const *a_styles, bool a_isFission, bool a_addFissionResiduals );
~OutputChannel( );
@@ -3990,7 +4121,7 @@ class OutputChannel : public GUPI::Ancestry {
Construction::FissionResiduals fissionResiduals( ) const { return( m_fissionResiduals ); } /**< Returns the value of the *m_fissionResiduals* member. */
void modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> a_maximumTNSL_MultiGroupIndex );
void modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> const &a_maximumTNSL_MultiGroupIndex );
bool areAllProductsTracked( Transporting::Particles const &a_particles ) const ;
GUPI::Ancestry *findInAncestry3( std::string const &a_item );
@@ -4009,7 +4140,7 @@ class OutputChannel : public GUPI::Ancestry {
Vector multiGroupMultiplicity( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
std::string const &a_productID ) const ;
Matrix multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
Transporting::Particles const &a_particles, std::string const &a_productID, int a_order ) const ;
Transporting::Particles const &a_particles, std::string const &a_productID, std::size_t a_order ) const ;
Vector multiGroupAverageEnergy( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
std::string const &a_productID ) const ;
Vector multiGroupAverageMomentum( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
@@ -4020,7 +4151,7 @@ class OutputChannel : public GUPI::Ancestry {
void continuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID, double a_energy,
double &a_productEnergy, double &a_productMomentum, double &a_productGain, bool a_ignoreIncompleteParticles ) const ;
void mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
std::vector<double> const &a_energies, int a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const ;
void calculateMultiGroupData( ProtareSingle const *a_protare, Styles::TemperatureInfo const &a_temperatureInfo,
std::string const &a_heatedMultiGroupLabel, MultiGroupCalulationInformation const &a_multiGroupCalulationInformation,
@@ -4116,7 +4247,7 @@ class Reaction : public Form {
friend class ProtareSingle;
private:
mutable int m_reactionIndex; /**< The index of the reaction in the ProtareSingle. */
mutable std::size_t m_reactionIndex; /**< The index of the reaction in the ProtareSingle. */
bool m_active; /**< If true, this reaction is used for calcualtion (e.g., its cross section is added to the total for its protare), otherwise, this reaction is ignored. */
int m_ENDF_MT; /**< The ENDF MT value for the reaction. */
int m_ENDL_C; /**< The ENDL C value for the reaction. */
@@ -4137,18 +4268,18 @@ class Reaction : public Form {
Component m_availableEnergy; /**< The GNDS <**availableEnergy**> node. */
Component m_availableMomentum; /**< The GNDS <**availableMomentum**> node. */
OutputChannel *m_outputChannel; /**< The reaction's output channel. */
void setReactionIndex( int a_reactionIndex ) const
void setReactionIndex( std::size_t a_reactionIndex ) const
{ m_reactionIndex = a_reactionIndex ; } /**< Sets *m_reactionIndex* to *a_reactionIndex*. */
public:
Reaction( int a_ENDF_MT, std::string a_fissionGenre );
Reaction( int a_ENDF_MT, std::string const &a_fissionGenre );
Reaction( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, Protare const &a_protare,
Styles::Suite const *a_styles );
~Reaction( );
bool active( ) const { return( m_active ); } /**< Returns the value of the *m_active* member. */
void setActive( bool a_active ) { m_active = a_active; } /**< Sets *m_active* to *a_active*. */
int reactionIndex( ) const { return( m_reactionIndex ); } /**< Returns the value of the *m_reactionIndex* member. */
std::size_t reactionIndex( ) const { return( m_reactionIndex ); } /**< Returns the value of the *m_reactionIndex* member. */
int depth( ) const { return( m_outputChannel->depth( ) ); } /**< Returns the maximum product depth for this reaction. */
int ENDF_MT( ) const { return( m_ENDF_MT ); } /**< Returns the value of the *m_ENDF_MT* member. */
int ENDL_C( ) const { return( m_ENDL_C ); } /**< Returns the value of the *m_ENDL_C* member. */
@@ -4176,7 +4307,7 @@ class Reaction : public Form {
OutputChannel *outputChannel( ) const { return( m_outputChannel ); } /**< Returns a reference to the *m_outputChannel* member. */
void setOutputChannel( OutputChannel *a_outputChannel );
void modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> a_maximumTNSL_MultiGroupIndex );
void modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> const &a_maximumTNSL_MultiGroupIndex );
GUPI::Ancestry *findInAncestry3( std::string const &a_item );
GUPI::Ancestry const *findInAncestry3( std::string const &a_item ) const ;
@@ -4195,17 +4326,17 @@ class Reaction : public Form {
bool areAllProductsTracked( Transporting::Particles const &a_particles ) const ;
Vector multiGroupCrossSection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo )
const ;
Vector multiGroupCrossSection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_label = "" ) const ;
Vector multiGroupQ( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
bool a_final ) const ;
Vector multiGroupMultiplicity( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
std::string const &a_productID ) const ;
Matrix multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
Transporting::Particles const &a_particles, std::string const &a_productID, int a_order ) const ;
Transporting::Particles const &a_particles, std::string const &a_productID, std::size_t a_order ) const ;
Matrix multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo,
Transporting::Particles const &a_particles, int a_order ) const ;
Transporting::Particles const &a_particles, std::size_t a_order ) const ;
Vector multiGroupAvailableEnergy( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings, Styles::TemperatureInfo const &a_temperatureInfo )
const ;
@@ -4229,7 +4360,7 @@ class Reaction : public Form {
void continuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID, double a_energy,
double &a_productEnergy, double &a_productMomentum, double &a_productGain, bool a_ignoreIncompleteParticles ) const ;
void mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
std::vector<double> const &a_energies, int a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const ;
bool modifyCrossSection( Functions::XYs1d const *a_offset, Functions::XYs1d const *a_slope, bool a_updateMultiGroup = false );
@@ -4434,7 +4565,7 @@ class Protare : public GUPI::Ancestry {
virtual Documentation_1_10::Suite &documentations( ) = 0;
virtual Styles::Base &style( std::string const a_label ) = 0;
virtual Styles::Base &style( std::string const &a_label ) = 0;
virtual Styles::Suite &styles( ) = 0;
virtual Styles::Suite const &styles( ) const = 0;
@@ -4453,7 +4584,7 @@ class Protare : public GUPI::Ancestry {
virtual std::size_t numberOfOrphanProducts( ) const = 0;
virtual Reaction *orphanProduct( std::size_t a_index ) = 0;
virtual Reaction const *orphanProduct( std::size_t a_index ) const = 0;
virtual void updateReactionIndices( int a_offset ) const = 0;
virtual void updateReactionIndices( std::size_t a_offset ) const = 0;
virtual bool hasFission( ) const = 0;
virtual bool isDelayedFissionNeutronComplete( ) const = 0;
@@ -4467,7 +4598,8 @@ class Protare : public GUPI::Ancestry {
Styles::TemperatureInfo const &a_temperatureInfo ) const = 0;
virtual Vector multiGroupCrossSection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const = 0;
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {},
std::string const &a_label = "" ) const = 0;
virtual Vector multiGroupQ( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, bool a_final, bool a_effectivePhotoAtomic = true,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const = 0;
@@ -4483,12 +4615,12 @@ class Protare : public GUPI::Ancestry {
virtual Matrix multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles,
std::string const &a_productID, int a_order, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const = 0;
std::string const &a_productID, std::size_t a_order, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const = 0;
virtual Matrix multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const = 0;
virtual Vector multiGroupTransportCorrection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
TransportCorrectionType a_transportCorrectionType, double a_temperature,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const = 0;
@@ -4534,9 +4666,10 @@ class ProtareSingle : public Protare {
private:
HAPI::File *m_doc; /**< If data read from file, this member is a pointer to the opened **HAPI::File** instance. */
HAPI::DataManager *m_dataManager; /**< If data read from hybrid file, this member is a pointer to the **HAPI::DataManager** instance. */
int m_numberOfLazyParsingHelperForms; /**< This counts the number of LazyParsingHelperForms instantiated. */
int m_numberOfLazyParsingHelperForms; /**< This counts the number of LazyParsingHelperForms instantiated. */
int m_numberOfLazyParsingHelperFormsReplaced; /**< This counts the number of LazyParsingHelperForms replaced with the appropriate form. */
LUPI::FormatVersion m_formatVersion; /**< Store the GNDS format version. */
TargetInfo::TargetInfo m_targetInfo; /**< Information about the target. Currently, the isotopic data for TNSL GNDS 2.1 files as stored in the evaluaed style. */
PoPI::Database m_internalPoPs; /**< The *PoPs* specified under the protare (e.g., reactionSuite) node. */
std::vector<std::string> m_libraries; /**< The list of libraries *this* was found in. */
@@ -4606,6 +4739,7 @@ class ProtareSingle : public Protare {
void incrementNumberOfLazyParsingHelperFormsReplaced( ) { ++m_numberOfLazyParsingHelperFormsReplaced; }
/**> Increments the *m_numberOfLazyParsingHelperFormsReplaced* member of this by 1. */
TargetInfo::TargetInfo const &targetInfo( ) const { return( m_targetInfo ); } /**< Returns a const reference to the *m_targetInfo* member. */
double projectileEnergyMin( ) const { return( m_projectileEnergyMin ); }
double projectileEnergyMax( ) const { return( m_projectileEnergyMax ); }
bool isTNSL_ProtareSingle( ) const { return( m_isTNSL_ProtareSingle ); } /**< Returns *true* if the instance is a ProtareSingle instance with only TNSL data and *false* otherwise. */
@@ -4663,8 +4797,8 @@ class ProtareSingle : public Protare {
ExternalFile const &externalFile( std::string const a_label ) const { return( *m_externalFiles.get<ExternalFile>( a_label ) ); } /**< Returns the external file with label *a_label*. */
ExternalFiles::Suite const &externalFiles( ) const { return( m_externalFiles ); } /**< Returns the value of the *m_externalFiles* member. */
Styles::Base &style( std::string const a_label ) { return( *m_styles.get<Styles::Base>( a_label ) ); } /**< Returns the style with label *a_label*. */
Styles::Base const &style( std::string const a_label ) const { return( *m_styles.get<Styles::Base const>( a_label ) ); } /**< Returns the const style with label *a_label*. */
Styles::Base &style( std::string const &a_label ) { return( *m_styles.get<Styles::Base>( a_label ) ); } /**< Returns the style with label *a_label*. */
Styles::Base const &style( std::string const &a_label ) const { return( *m_styles.get<Styles::Base const>( a_label ) ); } /**< Returns the const style with label *a_label*. */
Styles::Suite &styles( ) { return( m_styles ); } /**< Returns the value of the *m_styles* member. */
Styles::Suite const &styles( ) const { return( m_styles ); } /**< Returns a *const* reference to the *m_styles* member. */
@@ -4692,7 +4826,7 @@ class ProtareSingle : public Protare {
std::size_t numberOfIncompleteReactions( ) const { return( m_incompleteReactions.size( ) ); } /**< Returns the number of incomplete reactions in the **Protare**. */
Reaction *incompleteReaction( std::size_t a_index ) { return( m_incompleteReactions.get<Reaction>( a_index ) ); } /**< Returns the *a_index* - 1 reaction. */
Reaction const *incompleteReaction( std::size_t a_index ) const { return( m_incompleteReactions.get<Reaction>( a_index ) ); } /**< Returns the *a_index* - 1 reaction. */
void updateReactionIndices( int a_offset ) const;
void updateReactionIndices( std::size_t a_offset ) const;
bool hasFission( ) const ;
bool isDelayedFissionNeutronComplete( ) const ;
@@ -4706,7 +4840,8 @@ class ProtareSingle : public Protare {
Styles::TemperatureInfo const &a_temperatureInfo ) const ;
Vector multiGroupCrossSection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {},
std::string const &a_label = "" ) const ;
Vector multiGroupQ( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, bool a_final, bool a_effectivePhotoAtomic = true,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
@@ -4721,12 +4856,12 @@ class ProtareSingle : public Protare {
Matrix multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles,
std::string const &a_productID, int a_order, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
std::string const &a_productID, std::size_t a_order, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
Matrix multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
Vector multiGroupTransportCorrection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
TransportCorrectionType a_transportCorrectionType, double a_temperature,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
@@ -4758,6 +4893,8 @@ class ProtareSingle : public Protare {
void saveAs( std::string const &a_fileName ) const ;
void toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent = "" ) const ;
void parseEvaluatedTargetInfo( HAPI::Node const &a_node );
};
/*
@@ -4797,7 +4934,7 @@ class ProtareComposite : public Protare {
Documentation_1_10::Suite &documentations( );
Styles::Base &style( std::string const a_label );
Styles::Base &style( std::string const &a_label );
Styles::Suite &styles( );
Styles::Suite const &styles( ) const ;
@@ -4816,7 +4953,7 @@ class ProtareComposite : public Protare {
std::size_t numberOfOrphanProducts( ) const ;
Reaction *orphanProduct( std::size_t a_index );
Reaction const *orphanProduct( std::size_t a_index ) const ;
void updateReactionIndices( int a_offset ) const;
void updateReactionIndices( std::size_t a_offset ) const;
bool hasFission( ) const ;
bool isDelayedFissionNeutronComplete( ) const ;
@@ -4831,7 +4968,8 @@ class ProtareComposite : public Protare {
Vector multiGroupCrossSection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {},
std::string const &a_label = "" ) const ;
Vector multiGroupQ( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, bool a_final, bool a_effectivePhotoAtomic = true,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
@@ -4846,12 +4984,12 @@ class ProtareComposite : public Protare {
Matrix multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles,
std::string const &a_productID, int a_order, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
std::string const &a_productID, std::size_t a_order, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
Matrix multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
Vector multiGroupTransportCorrection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
TransportCorrectionType a_transportCorrectionType, double a_temperature,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
@@ -4928,7 +5066,7 @@ class ProtareTNSL : public Protare {
Documentation_1_10::Suite &documentations( );
Styles::Base &style( std::string const a_label );
Styles::Base &style( std::string const &a_label );
Styles::Suite &styles( );
Styles::Suite const &styles( ) const ;
@@ -4947,7 +5085,7 @@ class ProtareTNSL : public Protare {
std::size_t numberOfOrphanProducts( ) const ;
Reaction *orphanProduct( std::size_t a_index );
Reaction const *orphanProduct( std::size_t a_index ) const ;
void updateReactionIndices( int a_offset ) const;
void updateReactionIndices( std::size_t a_offset ) const;
bool hasFission( ) const ;
bool isDelayedFissionNeutronComplete( ) const ;
@@ -4961,7 +5099,8 @@ class ProtareTNSL : public Protare {
Styles::TemperatureInfo const &a_temperatureInfo ) const ;
Vector multiGroupCrossSection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {},
std::string const &a_label = "" ) const ;
Vector multiGroupQ( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, bool a_final, bool a_effectivePhotoAtomic = true,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
@@ -4976,12 +5115,12 @@ class ProtareTNSL : public Protare {
Matrix multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles,
std::string const &a_productID, int a_order, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
std::string const &a_productID, std::size_t a_order, ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
Matrix multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
Vector multiGroupTransportCorrection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
TransportCorrectionType a_transportCorrectionType, double a_temperature,
ExcludeReactionsSet const &a_reactionsToExclude = ExcludeReactionsSet {} ) const ;
@@ -5453,19 +5592,19 @@ GNDS_FileType GNDS_fileType( std::string const &a_fileName, GNDS_FileTypeInfo &a
* The following are in the file GIDI_misc.cpp.
*/
long binarySearchVector( double a_x, std::vector<double> const &a_Xs );
void intsToXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector<int> a_values, std::string const &a_attributes );
void intsToXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector<int> const &a_values, std::string const &a_attributes );
void parseValuesOfDoubles( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, nf_Buffer<double> &a_vector );
void parseValuesOfDoubles( HAPI::Node const &a_node, SetupInfo &a_setupInfo, nf_Buffer<double> &a_vector, int a_useSystem_strtod );
void parseValuesOfInts( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, std::vector<int> &a_vector );
void parseValuesOfInts( HAPI::Node const &a_node, SetupInfo &a_setupInfo, nf_Buffer<int> &a_vector );
void doublesToXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector<double> a_values, std::size_t a_start = 0, bool a_newLine = true,
void doublesToXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector<double> const &a_values, std::size_t a_start = 0, bool a_newLine = true,
std::string const &a_valueType = "" );
Frame parseFrame( HAPI::Node const &a_node, SetupInfo &a_setupInfo, std::string const &a_name );
std::string frameToString( Frame a_frame );
std::string intToString( int a_value );
std::string size_t_ToString( std::size_t a_value );
std::string nodeWithValuesToDoubles( GUPI::WriteInfo &a_writeInfo, std::string const &a_nodeName, std::vector<double> const &a_values );
void excludeReactionsSetAdjust( ExcludeReactionsSet a_excludeReactionsSet, Protare const &a_protare );
void excludeReactionsSetAdjust( ExcludeReactionsSet &a_excludeReactionsSet, Protare const &a_protare );
Functions::Ys1d gridded1d2GIDI_Ys1d( Functions::Function1dForm const &a_function1d );
Functions::Ys1d vector2GIDI_Ys1d( Axes const &a_axes, Vector const &a_vector );
@@ -249,7 +249,7 @@ class Suite : public Ancestry {
private:
std::string m_keyName; /**< The name of the key used to look up items in the suite. */
mutable Entries m_entries; /**< The list of nodes stored within *this*. */
std::map<std::string,int> m_map; /**< A map of *this* node labels to their index in *m_entries*. */
std::map<std::string,std::size_t> m_map; /**< A map of *this* node labels to their index in *m_entries*. */
Suite( Suite const *a_suite ); // FIXME, should we make public or private copy constructor? Making private for now.
@@ -262,7 +262,7 @@ class Suite : public Ancestry {
std::string const &keyName( ) const { return( m_keyName ); } /**< Returns a const reference to the *m_keyName* member. */
std::size_t size( ) const { return( m_entries.size( ) ); } /**< Returns the number of node contained by *this*. */
int operator[]( std::string const &a_label ) const ;
std::size_t operator[]( std::string const &a_label ) const ;
typedef Entries::iterator iterator;
typedef Entries::const_iterator const_iterator;
iterator begin( ) { return m_entries.begin( ); } /**< The C++ begin iterator for *this*. */
@@ -336,7 +336,7 @@ template<typename T> T const *Suite::get( std::size_t a_index ) const {
template<typename T> T *Suite::get( std::string const &a_label ) {
int index = (*this)[a_label];
auto index = (*this)[a_label];
Entry *entry = m_entries[index];
T *object = dynamic_cast<T *>( entry );
@@ -355,7 +355,7 @@ template<typename T> T *Suite::get( std::string const &a_label ) {
template<typename T> T const *Suite::get( std::string const &a_label ) const {
int index = (*this)[a_label];
auto index = (*this)[a_label];
Entry *entry = m_entries[index];
T *object = dynamic_cast<T *>( entry );
@@ -54,7 +54,7 @@ class Attribute {
public:
inline Attribute() : m_node(nullptr), m_name() {}
inline Attribute(Node_internal *a_node, std::string const a_name) :
inline Attribute(Node_internal *a_node, std::string const &a_name) :
m_node(a_node),
m_name(a_name)
{
@@ -79,7 +79,7 @@ class Text {
public:
Text();
Text(std::string const a_text);
Text(std::string const &a_text);
~Text();
std::string const &get() const { return( m_text ); }
};
@@ -98,7 +98,7 @@ class Data_internal {
//virtual template <typename T> T read() = 0;
virtual void getDoubles(nf_Buffer<double> &buffer) = 0;
virtual void getInts(nf_Buffer<int> &buffer) = 0;
virtual int length() const = 0;
virtual size_t length() const = 0;
};
/*
@@ -155,7 +155,7 @@ class Data {
~Data();
void getDoubles(nf_Buffer<double> &buffer);
void getInts(nf_Buffer<int> &buffer);
int length() const;
size_t length() const;
};
/*
@@ -283,7 +283,8 @@ class PugiXMLData : public Data_internal {
private:
pugi::xml_node m_node;
int m_length;
size_t m_length;
bool m_dataRead;
public:
PugiXMLData();
@@ -291,7 +292,7 @@ class PugiXMLData : public Data_internal {
virtual ~PugiXMLData();
void getDoubles(nf_Buffer<double> &buffer);
void getInts(nf_Buffer<int> &buffer);
int length() const;
size_t length() const;
};
class PugiXMLFile : public File {
@@ -363,7 +364,7 @@ class HDFData : public Data_internal {
private:
hid_t m_node_id;
hid_t m_dataspace_id;
int m_length;
size_t m_length;
public:
HDFData();
@@ -371,7 +372,7 @@ class HDFData : public Data_internal {
virtual ~HDFData();
void getDoubles(nf_Buffer<double> &buffer);
void getInts(nf_Buffer<int> &buffer);
int length() const;
size_t length() const;
};
class HDFFile : public File {
@@ -48,6 +48,7 @@ namespace LUPI {
#define GNDS_formatVersion_1_10Chars "1.10"
#define GNDS_formatVersion_2_0Chars "2.0"
#define GNDS_formatVersion_2_0_LLNL_4Chars "2.0.LLNL_4"
#define GNDS_formatVersion_2_1Chars "2.1"
void deprecatedFunction( std::string const &a_functionName, std::string const &a_replacementName, std::string const &a_asOf );
@@ -115,7 +116,7 @@ class StatusMessageReporting {
bool isError( ) { return( smr_isError( &m_smr ) ); }
void clear( ) { smr_release( &m_smr ); }
std::string constructMessage( std::string a_prefix, int a_reports = 1, bool a_clear = false );
std::string constructFullMessage( std::string a_prefix, int a_reports = 1, bool a_clear = false );
std::string constructFullMessage( std::string const &a_prefix, int a_reports = 1, bool a_clear = false );
};
/*
@@ -190,7 +191,7 @@ class ArgumentBase {
std::string m_descriptor; /**< The desciption printed help. */
int m_minimumNeeded; /**< Minimum number of times *this* argument is required on the command line. */
int m_maximumNeeded; /**< Maximum number of times *this* argument is required on the command line. */
int m_counts; /**< The number of time this argument was entered on the command line. */
std::size_t m_counts; /**< The number of time this argument was entered on the command line. */
std::vector<std::string> m_values; /**< list of values entered for this argument. Only used for types Store, Append and Positional. */
void addAlias( std::string const &a_name ); /**< Adds the alias *a_name* to *this*. */
@@ -210,7 +211,7 @@ class ArgumentBase {
std::string const &descriptor( ) const { return( m_descriptor ); }
int minimumNeeded( ) const { return( m_minimumNeeded ); }
int maximumNeeded( ) const { return( m_maximumNeeded ); }
int counts( ) const { return( m_counts ); }
std::size_t counts( ) const { return( m_counts ); }
virtual std::string const &value( std::size_t a_index = 0 ) const ;
std::vector<std::string> const &values( ) const { return( m_values ); }
@@ -430,8 +431,11 @@ namespace Misc {
std::string stripString( std::string const &a_string, bool a_left = true, bool a_right = true );
std::vector<std::string> splitString( std::string const &a_string, char a_delimiter, bool a_strip = false );
std::vector<std::string> splitString( std::string const &a_string, std::string const &a_delimiter, bool a_strip = false );
std::string joinStrings( std::string const &a_sep, std::vector<std::string> a_strings );
std::string replaceString( std::string const &a_string, std::string const &a_old, std::string const &a_new, bool a_all );
std::vector<std::string> splitXLinkString( std::string const &a_string );
bool stringToInt( std::string const &a_string, int &a_value );
bool stringToSize_t( std::string const &a_string, std::size_t &a_value );
std::string argumentsToString( char const *a_format, ... );
std::string doubleToString3( char const *a_format, double a_value, bool a_reduceBits = false );
@@ -30,12 +30,14 @@ class DataBuffer {
std::size_t m_doubleIndex;
std::size_t m_charIndex;
std::size_t m_longIndex;
std::size_t m_size_tIndex;
int *m_intData;
float *m_floatData;
double *m_doubleData;
char *m_charData;
std::uint64_t *m_longData;
std::size_t *m_size_tData;
// For unpacking into pre-allocated memory
char *m_placementStart;
@@ -56,11 +58,15 @@ class DataBuffer {
m_doubleIndex( 0 ),
m_charIndex( 0 ),
m_longIndex( 0 ),
m_size_tIndex( 0 ),
m_intData( nullptr ),
m_floatData( nullptr ),
m_doubleData( nullptr ),
m_charData( nullptr ),
m_longData( nullptr ),
m_size_tData( nullptr ),
m_placementStart( nullptr ),
m_placement( nullptr ),
m_maxPlacementSize( 0 ),
@@ -75,11 +81,15 @@ class DataBuffer {
m_doubleIndex( 0 ),
m_charIndex( 0 ),
m_longIndex( 0 ),
m_size_tIndex( 0 ),
m_intData( nullptr ),
m_floatData( nullptr ),
m_doubleData( nullptr ),
m_charData( nullptr ),
m_longData( nullptr ),
m_size_tData( nullptr ),
m_placementStart( nullptr ),
m_placement( nullptr ),
m_maxPlacementSize( 0 ),
@@ -98,11 +108,12 @@ class DataBuffer {
delete [] m_doubleData;
delete [] m_charData;
delete [] m_longData;
delete [] m_size_tData;
}
LUPI_HOST_DEVICE void zeroIndexes( void ) {
m_intIndex = m_floatIndex = m_doubleIndex = m_charIndex = m_longIndex = 0;
m_intIndex = m_floatIndex = m_doubleIndex = m_charIndex = m_longIndex = m_size_tIndex = 0;
}
LUPI_HOST_DEVICE void copyIndexes( DataBuffer const &a_input ) {
@@ -112,6 +123,7 @@ class DataBuffer {
m_doubleIndex = a_input.m_doubleIndex;
m_charIndex = a_input.m_charIndex;
m_longIndex = a_input.m_longIndex;
m_size_tIndex = a_input.m_size_tIndex;
}
LUPI_HOST_DEVICE void simpleCopy( DataBuffer const &a_input ) {
@@ -121,12 +133,14 @@ class DataBuffer {
m_doubleIndex = a_input.m_doubleIndex;
m_charIndex = a_input.m_charIndex;
m_longIndex = a_input.m_longIndex;
m_size_tIndex = a_input.m_size_tIndex;
m_intData = a_input.m_intData;
m_floatData = a_input.m_floatData;
m_doubleData = a_input.m_doubleData;
m_charData = a_input.m_charData;
m_longData = a_input.m_longData;
m_size_tData = a_input.m_size_tData;
m_placementStart = a_input.m_placementStart;
m_placement = a_input.m_placement;
@@ -144,6 +158,7 @@ class DataBuffer {
m_doubleData = nullptr;
m_charData = nullptr;
m_longData = nullptr;
m_size_tData = nullptr;
}
LUPI_HOST_DEVICE void allocateBuffers( void ) {
@@ -153,6 +168,7 @@ class DataBuffer {
m_doubleData = new double[m_doubleIndex];
m_charData = new char[m_charIndex];
m_longData = new std::uint64_t[m_longIndex];
m_size_tData = new std::size_t[m_size_tIndex];
}
LUPI_HOST_DEVICE void freeMemory( void ) {
@@ -162,6 +178,8 @@ class DataBuffer {
delete [] m_doubleData;
delete [] m_charData;
delete [] m_longData;
delete [] m_size_tData;
zeroIndexes( );
nullOutPointers( );
}
@@ -170,7 +188,8 @@ class DataBuffer {
return( ( a_input.m_intIndex == m_intIndex ) && ( a_input.m_floatIndex == m_floatIndex ) &&
( a_input.m_doubleIndex == m_doubleIndex ) &&
( a_input.m_charIndex == m_charIndex ) && ( a_input.m_longIndex == m_longIndex ) );
( a_input.m_charIndex == m_charIndex ) && ( a_input.m_longIndex == m_longIndex ) &&
( a_input.m_size_tIndex == m_size_tIndex ) );
}
LUPI_HOST_DEVICE void incrementPlacement(std::size_t a_delta) {
@@ -225,6 +244,8 @@ class DataBuffer {
gpuErrorCheck( LUPI_GPU_MEMCPY( buf_tmp.m_charData, m_charData, sizeof(char) * m_charIndex, LUPI_GPU_HTOD ) );
gpuErrorCheck( LUPI_GPU_MALLOC( (void **) &buf_tmp.m_longData, sizeof(std::uint64_t) * m_longIndex ) );
gpuErrorCheck( LUPI_GPU_MEMCPY( buf_tmp.m_longData, m_longData, sizeof(std::uint64_t) * m_longIndex, LUPI_GPU_HTOD ) );
gpuErrorCheck( LUPI_GPU_MALLOC( (void **) &buf_tmp.m_size_tData, sizeof(std::size_t) * m_size_tIndex ) );
gpuErrorCheck( LUPI_GPU_MEMCPY( buf_tmp.m_size_tData, m_size_tData, sizeof(std::size_t) * m_size_tIndex, LUPI_GPU_HTOD ) );
gpuErrorCheck( LUPI_GPU_MALLOC( (void **) &buf_tmp.m_placementStart, buf_tmp.m_maxPlacementSize ) );
// Set to 0 for easier byte comparisons. This may be removed after testing is done
@@ -269,14 +290,15 @@ class DataBuffer {
#define DATA_MEMBER_INT( member, buf, mode) DATA_MEMBER_SIMPLE(member, (buf).m_intData, (buf).m_intIndex, mode)
#define DATA_MEMBER_FLOAT(member, buf, mode) DATA_MEMBER_SIMPLE(member, (buf).m_floatData, (buf).m_floatIndex, mode)
#define DATA_MEMBER_DOUBLE(member, buf, mode) DATA_MEMBER_SIMPLE(member, (buf).m_doubleData, (buf).m_doubleIndex, mode)
#define DATA_MEMBER_SIZE_T(member, buf, mode) DATA_MEMBER_SIMPLE(member, (buf).m_size_tData, (buf).m_size_tIndex, mode)
#define DATA_MEMBER_STRING(member, buf, mode) \
{if ( mode == LUPI::DataBuffer::Mode::Count ) {((buf).m_charIndex) += member.size(); ((buf).m_intIndex)++; } \
{if ( mode == LUPI::DataBuffer::Mode::Count ) {((buf).m_charIndex) += member.size(); ((buf).m_size_tIndex)++; } \
else if ( mode == LUPI::DataBuffer::Mode::Pack ) {std::size_t array_size = member.size(); \
(buf).m_intData[((buf).m_intIndex)++] = array_size; \
(buf).m_size_tData[((buf).m_size_tIndex)++] = array_size; \
for (std::size_t size_index = 0; size_index < array_size; size_index++)\
{(buf).m_charData[ ((buf).m_charIndex)++ ] = (member[size_index]); }} \
else if ( mode == LUPI::DataBuffer::Mode::Unpack ) {std::size_t array_size = (buf).m_intData[((buf).m_intIndex)++]; \
else if ( mode == LUPI::DataBuffer::Mode::Unpack ) {std::size_t array_size = (buf).m_size_tData[((buf).m_size_tIndex)++]; \
member.resize(array_size, &(buf).m_placement); \
for (std::size_t size_index = 0; size_index < array_size; size_index++) \
{member[size_index] = (buf).m_charData[ ((buf).m_charIndex)++ ]; }} \
@@ -287,12 +309,12 @@ class DataBuffer {
#define DATA_MEMBER_STD_STRING(member, buf, mode) { \
if ( mode == LUPI::DataBuffer::Mode::Count ) \
{((buf).m_charIndex) += member.size(); ((buf).m_intIndex)++; } \
{((buf).m_charIndex) += member.size(); ((buf).m_size_tIndex)++; } \
else if ( mode == LUPI::DataBuffer::Mode::Pack ) {std::size_t array_size = member.size(); \
(buf).m_intData[((buf).m_intIndex)++] = array_size; \
(buf).m_size_tData[((buf).m_size_tIndex)++] = array_size; \
for (std::size_t size_index = 0; size_index < array_size; size_index++)\
{(buf).m_charData[((buf).m_charIndex)++] = (member[size_index]); }} \
else if ( mode == LUPI::DataBuffer::Mode::Unpack ) {std::size_t array_size = (buf).m_intData[((buf).m_intIndex)++]; \
else if ( mode == LUPI::DataBuffer::Mode::Unpack ) {std::size_t array_size = (std::size_t) (buf).m_size_tData[((buf).m_size_tIndex)++]; \
member.resize(array_size); \
for (std::size_t size_index = 0; size_index < array_size; size_index++) \
{member[size_index] = (buf).m_charData[ ((buf).m_charIndex)++ ]; }} }
@@ -301,7 +323,7 @@ class DataBuffer {
#define DATA_MEMBER_VECTOR_FLOAT(member, buf, mode) \
{ \
std::size_t vector_size = member.size(); \
DATA_MEMBER_INT(vector_size, (buf), mode); \
DATA_MEMBER_SIZE_T(vector_size, (buf), mode); \
if ( mode == LUPI::DataBuffer::Mode::Unpack ) member.resize(vector_size, &(buf).m_placement); \
std::size_t bufferIndex = (buf).m_floatIndex; \
for ( std::size_t member_index = 0; member_index < vector_size; member_index += LUPI_WARP_SIZE, bufferIndex += LUPI_WARP_SIZE ) \
@@ -315,7 +337,7 @@ class DataBuffer {
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode) \
{ \
std::size_t vector_size = member.size(); \
DATA_MEMBER_INT(vector_size, (buf), mode); \
DATA_MEMBER_SIZE_T(vector_size, (buf), mode); \
if ( mode == LUPI::DataBuffer::Mode::Unpack ) member.resize(vector_size, &(buf).m_placement); \
std::size_t bufferIndex = (buf).m_doubleIndex; \
for ( std::size_t member_index = 0; member_index < vector_size; member_index += LUPI_WARP_SIZE, bufferIndex += LUPI_WARP_SIZE ) \
@@ -330,7 +352,7 @@ class DataBuffer {
#define DATA_MEMBER_VECTOR_FLOAT(member, buf, mode) \
{ \
std::size_t vector_size = member.size(); \
DATA_MEMBER_INT(vector_size, (buf), mode); \
DATA_MEMBER_SIZE_T(vector_size, (buf), mode); \
if ( mode == LUPI::DataBuffer::Mode::Unpack ) { \
if ((buf).m_sharedPlacement == nullptr) { \
member.resize(vector_size, &(buf).m_placement); \
@@ -349,7 +371,7 @@ class DataBuffer {
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode) \
{ \
std::size_t vector_size = member.size(); \
DATA_MEMBER_INT(vector_size, (buf), mode); \
DATA_MEMBER_SIZE_T(vector_size, (buf), mode); \
if ( mode == LUPI::DataBuffer::Mode::Unpack ) { \
if ((buf).m_sharedPlacement == nullptr) { \
member.resize(vector_size, &(buf).m_placement); \
@@ -371,7 +393,7 @@ class DataBuffer {
#define DATA_MEMBER_VECTOR_INT(member, buf, mode) \
{ \
std::size_t vector_size = member.size(); \
DATA_MEMBER_INT(vector_size, (buf), mode); \
DATA_MEMBER_SIZE_T(vector_size, (buf), mode); \
if ( mode == LUPI::DataBuffer::Mode::Unpack ) member.resize(vector_size, &(buf).m_placement); \
std::size_t bufferIndex = (buf).m_intIndex; \
for ( std::size_t member_index = 0; member_index < vector_size; member_index += LUPI_WARP_SIZE, bufferIndex += LUPI_WARP_SIZE ) \
@@ -386,7 +408,7 @@ class DataBuffer {
#define DATA_MEMBER_VECTOR_INT(member, buf, mode) \
{ \
std::size_t vector_size = member.size(); \
DATA_MEMBER_INT(vector_size, (buf), mode); \
DATA_MEMBER_SIZE_T(vector_size, (buf), mode); \
if ( mode == LUPI::DataBuffer::Mode::Unpack ) { \
if ((buf).m_sharedPlacement == nullptr) { \
member.resize(vector_size, &(buf).m_placement); \
@@ -408,7 +430,7 @@ class DataBuffer {
#define DATA_MEMBER_VECTOR_BOOL(member, buf, mode) \
{ \
std::size_t vector_size = member.size(); \
DATA_MEMBER_INT(vector_size, (buf), mode); \
DATA_MEMBER_SIZE_T(vector_size, (buf), mode); \
if ( mode == LUPI::DataBuffer::Mode::Unpack ) member.resize(vector_size, &(buf).m_placement); \
std::size_t bufferIndex = (buf).m_intIndex; \
for ( std::size_t member_index = 0; member_index < vector_size; member_index += LUPI_WARP_SIZE, bufferIndex += LUPI_WARP_SIZE ) \
@@ -423,7 +445,7 @@ class DataBuffer {
#define DATA_MEMBER_VECTOR_BOOL(member, buf, mode) \
{ \
std::size_t vector_size = member.size(); \
DATA_MEMBER_INT(vector_size, (buf), mode); \
DATA_MEMBER_SIZE_T(vector_size, (buf), mode); \
if ( mode == LUPI::DataBuffer::Mode::Unpack ) { \
if ((buf).m_sharedPlacement == nullptr) { \
member.resize(vector_size, &(buf).m_placement); \
@@ -459,4 +481,41 @@ class DataBuffer {
}
#endif
#if LUPI_WARP_SIZE > 1 && defined(LUPI_ON_GPU)
#define DATA_MEMBER_VECTOR_SIZE_T(member, buf, mode) \
{ \
std::size_t vector_size = member.size(); \
DATA_MEMBER_SIZE_T(vector_size, (buf), mode); \
if ( mode == LUPI::DataBuffer::Mode::Unpack ) member.resize(vector_size, &(buf).m_placement); \
std::size_t bufferIndex = (buf).m_size_tIndex; \
for ( std::size_t member_index = 0; member_index < vector_size; member_index += LUPI_WARP_SIZE, bufferIndex += LUPI_WARP_SIZE ) \
{ \
std::size_t thrMemberId = member_index + LUPI_THREADID; \
if (thrMemberId >= vector_size) continue; \
member[thrMemberId] = (buf).m_size_tData[bufferIndex + LUPI_THREADID]; \
} \
(buf).m_size_tIndex += vector_size; \
}
#else
#define DATA_MEMBER_VECTOR_SIZE_T(member, buf, mode) \
{ \
std::size_t vector_size = member.size(); \
DATA_MEMBER_SIZE_T(vector_size, (buf), mode); \
if ( mode == LUPI::DataBuffer::Mode::Unpack ) { \
if ((buf).m_sharedPlacement == nullptr) { \
member.resize(vector_size, &(buf).m_placement); \
} else { \
member.resize(vector_size, &(buf).m_sharedPlacement); \
} \
}\
if ( mode == LUPI::DataBuffer::Mode::Memory ) { \
(buf).incrementSharedPlacement(sizeof(std::size_t) * member.capacity()); \
} \
for ( std::size_t member_index = 0; member_index < vector_size; member_index++ ) \
{ \
DATA_MEMBER_SIZE_T(member[member_index], (buf), mode); \
} \
}
#endif
#endif // End of LUPI_data_buffer_hpp_included
@@ -49,17 +49,19 @@ class ProtareTNSL;
class Reaction;
class OutputChannel;
class ACE_URR_probabilityTables;
class GRIN_capture;
class GRIN_inelastic;
} // End of namespace MCGIDI.
#include <LUPI_dataBuffer.hpp>
#include "MCGIDI_sampling.hpp"
#include "MCGIDI_vector.hpp"
#include "MCGIDI_string.hpp"
#include <MCGIDI_sampling.hpp>
#include <MCGIDI_vector.hpp>
#include <MCGIDI_string.hpp>
namespace MCGIDI {
#define MCGIDI_nullReaction -10001
#define MCGIDI_nullReaction 999999999
// FIXME, this should not be used once physicalQuantity can handle changing units.
#define MCGIDI_speedOfLight_cm_sh 299.792458
@@ -111,8 +113,8 @@ class MC : public GIDI::Transporting::Settings {
LookupMode::Data1d m_crossSectionLookupMode; /**< Determines how cross sections are evaluated. */
LookupMode::Data1d m_other1dDataLookupMode; /**< Determines how 1d data other than cross sections are evaluated. */
LookupMode::Distribution m_distributionLookupMode; /**< Determines how distributions are evaluated and sampled. Currently, only pdf_cdf is allowed. */
Sampling::Upscatter::Model m_upscatterModel; /**< FIXME. */
std::string m_upscatterModelALabel; /**< FIXME. */
Sampling::Upscatter::Model m_upscatterModel; /**< This enum specified the upscatter model to use when sampling products. */
std::vector<double> m_upscatterModelAGroupBoundaries; /**< If specified (i.e., non-zero length) then these values are used as the group boundaries for the upscatter model A multi-group cross section. */
URR_mode m_URR_mode; /**< Selects if URR data are to be used, and it so, which type. */
bool m_wantTerrellPromptNeutronDistribution; /**< If true, prompt fission neutron distributions are sampled from the Terrell mode. */
bool m_wantRawTNSL_distributionSampling; /**< If true, the TNSL neutron distributions for coherent and incoherent elastic scattering are sampled from the double differential data. Otherwise, they are sampled from the distribution data. */
@@ -172,13 +174,13 @@ class MC : public GIDI::Transporting::Settings {
setDistributionLookupMode( a_distributionLookupMode ); } /**< See method **setDistributionLookupMode**. This method is deprecated. */
LUPI_HOST Sampling::Upscatter::Model upscatterModel( ) const { return( m_upscatterModel ); } /**< Returns the value of the **m_upscatterModel**. */
LUPI_HOST void set_upscatterModelA( std::string const &a_upscatterModelALabel );
LUPI_HOST void setUpscatterModelA( std::string const &a_upscatterModelALabel ) { set_upscatterModelA( a_upscatterModelALabel ); }
/**< See method **set_upscatterModelA**. */
LUPI_HOST std::string upscatterModelALabel( ) const { return( m_upscatterModelALabel ); } /**< Returns the value of the **m_upscatterModelALabel**. */
LUPI_HOST void setUpscatterModelA( ) { m_upscatterModel = Sampling::Upscatter::Model::A; } /**< See member *m_upscatterModel* to Sampling::Upscatter::Model::A. */
LUPI_HOST void setUpscatterModelB( ) { m_upscatterModel = Sampling::Upscatter::Model::B; } /**< Set member *m_upscatterModel* to Sampling::Upscatter::Model::B. */
LUPI_HOST void setUpscatterModelBSnLimits( ) { m_upscatterModel = Sampling::Upscatter::Model::BSnLimits; } /**< Set member *m_upscatterModel* to Sampling::Upscatter::Model::BSnLimits. */
LUPI_HOST void setUpscatterModelDBRC( ) { m_upscatterModel = Sampling::Upscatter::Model::DBRC; } /**< Set member *m_upscatterModel* to Sampling::Upscatter::Model::DBRC. */
LUPI_HOST std::vector<double> const &upscatterModelAGroupBoundaries( ) { return( m_upscatterModelAGroupBoundaries ); }
/**< Returns a const reference to the *m_upscatterModelAGroupBoundaries* member. */
LUPI_HOST void setUpscatterModelAGroupBoundaries( std::vector<double> const &a_groupBoundaries );
LUPI_HOST bool want_URR_probabilityTables( ) const {
LUPI::deprecatedFunction( "MCGIDI::Transporting::MC::want_URR_probabilityTables", "MCGIDI::Transporting::MC::_URR_mode", "" );
@@ -296,13 +298,14 @@ LUPI_HOST int MCGIDI_popsIndex( PoPI::Database const &a_pops, std::string const
* The values of *a_Xs* must be ascending (i.e., *a_Xs*[i] < *a_Xs*[i+1]).
*
*
* Returns -2 if a_x < a_Xs[0] or 0 if a_boundIndex is true,
* -1 if a_x > last point of a_Xs or a_Xs.size( ) - 1 if a_boundIndex is true, or
* Returns -2 if a_x < a_Xs[0] or return 0 if a_boundIndex is true,
* -1 if a_x > last point of a_Xs or returns a_Xs.size( ) - 1 if a_boundIndex is true, or
* the lower index of a_Xs which bound a_x otherwise.
-3 if a_Xs has not data (i.e, its size is 0).
*
* Note, when *a_boundIndex* is false the returned *index* can be negative and when it is true
* the return value will be a valid index of *a_Xs*, including its last point. The index of the last
* point is only returned when *a_boundIndex* is true and *a_x* is great than the last point of *a_Xs*.
* Note, when *a_boundIndex* is false the returned *index* can be negative and when it is true the return
* value will be a valid index of *a_Xs*, including its last point unless a_Xs has not data *. The index of
* the last point is only returned when *a_boundIndex* is true and *a_x* is great than the last point of *a_Xs*.
*
* @param a_x [in] The values whose bounding index within *a_Xs* is to be determined.
* @param a_Xs [in] The list of ascending values.
@@ -314,15 +317,15 @@ LUPI_HOST int MCGIDI_popsIndex( PoPI::Database const &a_pops, std::string const
LUPI_HOST_DEVICE inline int binarySearchVector( double a_x, Vector<double> const &a_Xs, bool a_boundIndex = false ) {
int lower = 0, middle, upper = (int) a_Xs.size( ) - 1;
std::size_t lower = 0, middle, upper = a_Xs.size( ) - 1;
if( a_x < a_Xs[0] ) {
if( a_Xs.size( ) == 0 ) {
return( -3 ); }
else if( a_x < a_Xs[0] ) {
if( a_boundIndex ) return( 0 );
return( -2 );
}
if( a_x > a_Xs[upper] ) {
if( a_boundIndex ) return( upper );
return( -2 ); }
else if( a_x > a_Xs.back( ) ) {
if( a_boundIndex ) return( static_cast<int>( upper ) );
return( -1 );
}
@@ -335,24 +338,24 @@ LUPI_HOST_DEVICE inline int binarySearchVector( double a_x, Vector<double> const
lower = middle;
}
}
return( lower );
return( static_cast<int>( lower ) );
}
/* *********************************************************************************************************//**
***********************************************************************************************************/
LUPI_HOST_DEVICE inline int binarySearchVectorBounded( double a_x, Vector<double> const &a_Xs, int a_lower,
int a_upper, bool a_boundIndex ) {
LUPI_HOST_DEVICE inline int binarySearchVectorBounded( double a_x, Vector<double> const &a_Xs, std::size_t a_lower,
std::size_t a_upper, bool a_boundIndex ) {
int middle;
std::size_t middle;
if( a_x < a_Xs[a_lower] ) {
if( a_boundIndex ) return( 0 );
return( -2 );
}
if( a_x > a_Xs[a_upper] ) {
if( a_boundIndex ) return( a_upper );
if( a_Xs.size( ) == 0 ) {
return( -3 ); }
else if( a_x < a_Xs[a_lower] ) {
if( a_boundIndex ) return( static_cast<int>( a_lower ) );
return( -2 ); }
else if( a_x > a_Xs[a_upper] ) {
if( a_boundIndex ) return( static_cast<int>( a_upper ) );
return( -1 );
}
@@ -365,7 +368,7 @@ LUPI_HOST_DEVICE inline int binarySearchVectorBounded( double a_x, Vector<double
a_lower = middle;
}
}
return( a_lower );
return( static_cast<int>( a_lower ) );
}
} // End of namespace MCGIDI.
@@ -390,17 +393,21 @@ class MultiGroupHash {
LUPI_HOST void initialize( GIDI::Protare const &a_protare, GIDI::Styles::TemperatureInfo const &a_temperatureInfo, std::string a_particleID );
public:
LUPI_HOST_DEVICE MultiGroupHash( );
LUPI_HOST MultiGroupHash( std::vector<double> a_boundaries );
LUPI_HOST_DEVICE MultiGroupHash( Vector<double> a_boundaries );
LUPI_HOST MultiGroupHash( GIDI::Protare const &a_protare, GIDI::Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_particleID = "" );
LUPI_HOST MultiGroupHash( GIDI::Protare const &a_protare, GIDI::Transporting::Particles const &a_particles );
LUPI_HOST MultiGroupHash( MultiGroupHash const &a_multiGroupHash );
LUPI_HOST MultiGroupHash &operator=( MultiGroupHash const &a_rhs ) = default;
LUPI_HOST_DEVICE Vector<double> const &boundaries( ) const { return( m_boundaries ); } /**< Returns a reference to **m_styles**. */
LUPI_HOST_DEVICE int index( double a_domain ) const {
LUPI_HOST_DEVICE std::size_t index( double a_domain ) const {
int _index = binarySearchVector( a_domain, m_boundaries );
if( _index == -2 ) return( 0 );
if( _index == -1 ) return( m_boundaries.size( ) - 2 );
return( _index );
return( static_cast<std::size_t>( _index ) );
}
LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
};
@@ -458,7 +465,7 @@ template <typename RNG>
inline LUPI_HOST_DEVICE void updateProtare( MCGIDI::Protare const *a_protare, double a_energy, RNG && a_rng );
LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
LUPI_HOST_DEVICE long internalSize( ) const { return m_URR_protareInfos.internalSize( ); }
LUPI_HOST_DEVICE std::size_t internalSize( ) const { return m_URR_protareInfos.internalSize( ); }
};
/*
@@ -522,7 +529,7 @@ class ACE_URR_probabilityTables {
class HeatedReactionCrossSectionContinuousEnergy {
private:
int m_offset; /**< The offset relative to the cross section grid of the first cross section value in *m_crossSections*. */
std::size_t m_offset; /**< The offset relative to the cross section grid of the first cross section value in *m_crossSections*. */
double m_threshold; /**< The threshold for the reaction. */
Vector<MCGIDI_FLOAT> m_crossSections; /**< The reaction's cross section. */
Transporting::URR_mode m_URR_mode; /**< The URR data (i.e., mode) *this* has. */
@@ -531,13 +538,13 @@ class HeatedReactionCrossSectionContinuousEnergy {
public:
LUPI_HOST_DEVICE HeatedReactionCrossSectionContinuousEnergy( );
LUPI_HOST HeatedReactionCrossSectionContinuousEnergy( int a_offset, double a_threshold, Vector<double> &a_crossSection );
LUPI_HOST HeatedReactionCrossSectionContinuousEnergy( std::size_t a_offset, double a_threshold, Vector<double> &a_crossSection );
LUPI_HOST HeatedReactionCrossSectionContinuousEnergy( double a_threshold, GIDI::Functions::Ys1d const &a_crossSection,
Probabilities::ProbabilityBase2d *a_URR_probabilityTables, ACE_URR_probabilityTables *a_ACE_URR_probabilityTables );
LUPI_HOST_DEVICE ~HeatedReactionCrossSectionContinuousEnergy( );
LUPI_HOST_DEVICE double threshold( ) const { return( m_threshold ); } /**< Returns the value of the **m_threshold**. */
LUPI_HOST_DEVICE int offset( ) const { return( m_offset ); } /**< Returns the value of the **m_offset**. */
LUPI_HOST_DEVICE std::size_t offset( ) const { return( m_offset ); } /**< Returns the value of the **m_offset**. */
LUPI_HOST Vector<MCGIDI_FLOAT> const &crossSections( ) const { return( m_crossSections ); } /**< Returns a reference to the member **m_crossSections**. */
LUPI_HOST_DEVICE bool hasURR_probabilityTables( ) const {
return( ( m_URR_probabilityTables != nullptr ) || ( m_ACE_URR_probabilityTables != nullptr ) );
@@ -548,11 +555,11 @@ class HeatedReactionCrossSectionContinuousEnergy {
LUPI_HOST_DEVICE Probabilities::ProbabilityBase2d *URR_probabilityTables( ) const { return( m_URR_probabilityTables ); } /**< Returns the value of the *m_URR_probabilityTables*. */
LUPI_HOST_DEVICE ACE_URR_probabilityTables *_ACE_URR_probabilityTables( ) const { return( m_ACE_URR_probabilityTables ); } /**< Returns the value of the *m_ACE_URR_probabilityTables*. */
LUPI_HOST_DEVICE double crossSection( std::size_t a_index ) const {
int index = static_cast<int>( a_index ) - m_offset;
if( index < 0 ) return( 0.0 );
if( index >= static_cast<int>( m_crossSections.size( ) ) ) return( 0.0 );
if( a_index < m_offset ) return( 0.0 );
a_index -= m_offset;
if( a_index >= m_crossSections.size( ) ) return( 0.0 );
return( m_crossSections[index] );
return( m_crossSections[a_index] );
}
LUPI_HOST GIDI::Functions::XYs1d crossSectionAsGIDI_XYs1d( double a_temperature, Vector<double> const &a_energies ) const ;
@@ -591,8 +598,8 @@ class ContinuousEnergyGain {
if( a_particleIntid == m_particleIntid ) m_userParticleIndex = a_userParticleIndex; }
/**< Sets member *m_userParticleIntid* to *a_userParticleIndex* if particle's intid matchs *m_particleIntid*. */
LUPI_HOST_DEVICE Vector<MCGIDI_FLOAT> const &gain( ) const { return( m_gain ); }
LUPI_HOST void adjustGain( int a_energy_index, double a_gain ) { m_gain[a_energy_index] += a_gain; }
LUPI_HOST_DEVICE double gain( int a_energy_index, double a_energy_fraction ) const ;
LUPI_HOST void adjustGain( std::size_t a_energy_index, double a_gain ) { m_gain[a_energy_index] += a_gain; }
LUPI_HOST_DEVICE double gain( std::size_t a_energy_index, double a_energy_fraction ) const ;
LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
LUPI_HOST void print( ProtareSingle const *a_protareSingle, std::string const &a_indent, std::string const &a_iFormat,
@@ -608,7 +615,7 @@ class HeatedCrossSectionContinuousEnergy {
private:
double m_temperature; /**< The target temperature of the data. */
Vector<int> m_hashIndices; /**< The indicies for the energy hash function. */
Vector<std::size_t> m_hashIndices; /**< The indicies for the energy hash function. */
Vector<double> m_energies; /**< Energy grid for cross sections. */
Vector<MCGIDI_FLOAT> m_totalCrossSection; /**< The total cross section. */
Vector<MCGIDI_FLOAT> m_depositionEnergy; /**< The total continuous energy, deposition-energy cross section (related to the kinetic energy of the untracked outgoing particles). */
@@ -616,7 +623,7 @@ class HeatedCrossSectionContinuousEnergy {
Vector<MCGIDI_FLOAT> m_productionEnergy; /**< The total continuous energy, Q-value cross section. */
Vector<ContinuousEnergyGain *> m_gains; /**< The total continuous energy, gain cross section for each tracked particle. */
Transporting::URR_mode m_URR_mode; /**< The URR data (i.e., mode) *this* has. */
Vector<int> m_reactionsInURR_region; /**< A list of reactions within or below the upper URR regions. This is empty unless URR probability tables present and used. */
Vector<std::size_t> m_reactionsInURR_region; /**< A list of reactions within or below the upper URR regions. This is empty unless URR probability tables present and used. */
Vector<HeatedReactionCrossSectionContinuousEnergy *> m_reactionCrossSections;
/**< Reaction cross section data for each reaction. */
ACE_URR_probabilityTables *m_ACE_URR_probabilityTables; /**< The ACE URR probability tables for the summed URR cross section, if they were loaded. */
@@ -628,40 +635,41 @@ class HeatedCrossSectionContinuousEnergy {
std::vector<GIDI::Reaction const *> const &a_orphanProducts, bool a_fixedGrid, bool a_zeroReactions );
LUPI_HOST_DEVICE ~HeatedCrossSectionContinuousEnergy( );
LUPI_HOST_DEVICE int evaluationInfo( int a_hashIndex, double a_energy, double *a_energyFraction ) const ;
LUPI_HOST_DEVICE std::size_t evaluationInfo( std::size_t a_hashIndex, double a_energy, double *a_energyFraction ) const ;
LUPI_HOST HeatedReactionCrossSectionContinuousEnergy const *reactionCrossSection( int a_index ) const
LUPI_HOST HeatedReactionCrossSectionContinuousEnergy const *reactionCrossSection( std::size_t a_index ) const
{ return( m_reactionCrossSections[a_index] ); } /**< Returns the reaction cross section at index *a_index*. */
LUPI_HOST_DEVICE double temperature( ) const { return( m_temperature ); } /**< Returns the value of the **m_temperature** member. */
LUPI_HOST_DEVICE double minimumEnergy( ) const { return( m_energies[0] ); } /**< Returns the minimum cross section domain. */
LUPI_HOST_DEVICE double maximumEnergy( ) const { return( m_energies.back( ) ); } /**< Returns the maximum cross section domain. */
LUPI_HOST_DEVICE int numberOfReactions( ) const { return( (int) m_reactionCrossSections.size( ) ); }
LUPI_HOST_DEVICE std::size_t numberOfReactions( ) const { return( m_reactionCrossSections.size( ) ); }
/**< Returns the number of reaction cross section. */
LUPI_HOST_DEVICE int thresholdOffset( int a_reactionIndex ) const { return( m_reactionCrossSections[a_reactionIndex]->offset( ) ); }
LUPI_HOST_DEVICE std::size_t thresholdOffset( std::size_t a_reactionIndex ) const { return( m_reactionCrossSections[a_reactionIndex]->offset( ) ); }
/**< Returns the offset for the cross section for the reaction with index *a_reactionIndex*. */
LUPI_HOST_DEVICE double threshold( int a_reactionIndex ) const { return( m_reactionCrossSections[a_reactionIndex]->threshold( ) ); }
LUPI_HOST_DEVICE double threshold( std::size_t a_reactionIndex ) const { return( m_reactionCrossSections[a_reactionIndex]->threshold( ) ); }
/**< Returns the threshold for the reaction with index *a_reactionIndex*. */
LUPI_HOST_DEVICE bool hasURR_probabilityTables( ) const ;
LUPI_HOST_DEVICE double URR_domainMin( ) const ;
LUPI_HOST_DEVICE double URR_domainMax( ) const ;
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( int a_index ) const { return( m_reactionCrossSections[a_index]->hasURR_probabilityTables( ) ); }
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( std::size_t a_index ) const { return( m_reactionCrossSections[a_index]->hasURR_probabilityTables( ) ); }
LUPI_HOST_DEVICE Vector<MCGIDI_FLOAT> &totalCrossSection( ) { return( m_totalCrossSection ); } /**< Returns a reference to member *m_totalCrossSection*. */
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos, int a_URR_index, int a_hashIndex, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos, int a_URR_index, std::size_t a_hashIndex, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST GIDI::Functions::XYs1d crossSectionAsGIDI_XYs1d( ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, int a_hashIndex, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection2( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, double a_energy, int a_energyIndex, double a_energyFraction, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, double a_energy ) const ;
LUPI_HOST GIDI::Functions::XYs1d reactionCrossSectionAsGIDI_XYs1d( int a_reactionIndex ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, std::size_t a_hashIndex, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection2( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, double a_energy,
std::size_t a_energyIndex, double a_energyFraction, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, double a_energy ) const ;
LUPI_HOST GIDI::Functions::XYs1d reactionCrossSectionAsGIDI_XYs1d( std::size_t a_reactionIndex ) const ;
LUPI_HOST_DEVICE double depositionEnergy( int a_hashIndex, double a_energy ) const ;
LUPI_HOST_DEVICE double depositionMomentum( int a_hashIndex, double a_energy ) const ;
LUPI_HOST_DEVICE double productionEnergy( int a_hashIndex, double a_energy ) const ;
LUPI_HOST_DEVICE double gain( int a_hashIndex, double a_energy, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( int a_hashIndex, double a_energy, int a_particleIntid ) const ;
LUPI_HOST_DEVICE double depositionEnergy( std::size_t a_hashIndex, double a_energy ) const ;
LUPI_HOST_DEVICE double depositionMomentum( std::size_t a_hashIndex, double a_energy ) const ;
LUPI_HOST_DEVICE double productionEnergy( std::size_t a_hashIndex, double a_energy ) const ;
LUPI_HOST_DEVICE double gain( std::size_t a_hashIndex, double a_energy, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( std::size_t a_hashIndex, double a_energy, int a_particleIntid ) const ;
LUPI_HOST void setUserParticleIndex( int a_particleIndex, int a_userParticleIndex );
LUPI_HOST void setUserParticleIndexViaIntid( int a_particleIntid, int a_userParticleIndex );
@@ -689,6 +697,8 @@ class HeatedCrossSectionsContinuousEnergy {
LUPI_HOST_DEVICE HeatedCrossSectionsContinuousEnergy( );
LUPI_HOST_DEVICE ~HeatedCrossSectionsContinuousEnergy( );
LUPI_HOST_DEVICE void clear( );
LUPI_HOST void update( LUPI::StatusMessageReporting &a_smr, SetupInfo &a_setupInfo, Transporting::MC const &a_settings, GIDI::Transporting::Particles const &a_particles, DomainHash const &a_domainHash,
GIDI::Styles::TemperatureInfos const &a_temperatureInfos, std::vector<GIDI::Reaction const *> const &a_reactions,
std::vector<GIDI::Reaction const *> const &a_orphanProducts, bool a_fixedGrid, bool a_zeroReactions );
@@ -704,28 +714,28 @@ class HeatedCrossSectionsContinuousEnergy {
LUPI_HOST_DEVICE bool hasURR_probabilityTables( ) const { return( m_heatedCrossSections[0]->hasURR_probabilityTables( ) ); }
LUPI_HOST_DEVICE double URR_domainMin( ) const { return( m_heatedCrossSections[0]->URR_domainMin( ) ); }
LUPI_HOST_DEVICE double URR_domainMax( ) const { return( m_heatedCrossSections[0]->URR_domainMax( ) ); }
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( int a_index ) const { return( m_heatedCrossSections[0]->reactionHasURR_probabilityTables( a_index ) ); }
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( std::size_t a_index ) const { return( m_heatedCrossSections[0]->reactionHasURR_probabilityTables( a_index ) ); }
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos, int a_URR_index, int a_hashIndex,
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos, int a_URR_index, std::size_t a_hashIndex,
double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE void crossSectionVector( double a_temperature, double a_userFactor, std::size_t a_numberAllocated,
double *a_crossSectionVector ) const ;
LUPI_HOST GIDI::Functions::XYs1d crossSectionAsGIDI_XYs1d( double a_temperature ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, int a_hashIndex,
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, std::size_t a_hashIndex,
double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, double a_temperature, double a_energy_in ) const ;
LUPI_HOST GIDI::Functions::XYs1d reactionCrossSectionAsGIDI_XYs1d( int a_reactionIndex, double a_temperature ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, double a_temperature, double a_energy_in ) const ;
LUPI_HOST GIDI::Functions::XYs1d reactionCrossSectionAsGIDI_XYs1d( std::size_t a_reactionIndex, double a_temperature ) const ;
template <typename RNG>
inline LUPI_HOST_DEVICE int sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_URR_index, int a_hashIndex,
double a_temperature, double a_energy, double a_crossSection, RNG && a_rng) const ;
inline LUPI_HOST_DEVICE std::size_t sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_URR_index,
std::size_t a_hashIndex, double a_temperature, double a_energy, double a_crossSection, RNG && a_rng) const ;
LUPI_HOST_DEVICE double depositionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double depositionMomentum( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double productionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double gain( int a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( int a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const ;
LUPI_HOST_DEVICE double depositionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double depositionMomentum( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double productionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double gain( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const ;
LUPI_HOST void setUserParticleIndex( int a_particleIndex, int a_userParticleIndex );
LUPI_HOST void setUserParticleIndexViaIntid( int a_particleIntid, int a_userParticleIndex );
@@ -764,7 +774,7 @@ class MultiGroupGain {
if( a_particleIntid == m_particleIntid ) m_userParticleIndex = a_userParticleIndex; }
/**< Sets member *m_userParticleIntid* to *a_userParticleIndex* if particle's intid matchs *m_particleIntid*. */
LUPI_HOST_DEVICE Vector<double> const &gain( ) const { return( m_gain ); }
LUPI_HOST_DEVICE double gain( int a_hashIndex ) const { return( m_gain[a_hashIndex] ); }
LUPI_HOST_DEVICE double gain( std::size_t a_hashIndex ) const { return( m_gain[a_hashIndex] ); }
LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
LUPI_HOST void write( FILE *a_file ) const ;
@@ -779,23 +789,23 @@ class HeatedReactionCrossSectionMultiGroup {
private:
double m_threshold;
int m_offset;
std::size_t m_offset;
Vector<double> m_crossSections; // Multi-group reaction cross section
double m_augmentedThresholdCrossSection; // Augmented cross section at m_offset for rejecting when projectile energy is below m_threshold.
// This value is added to m_crossSections[m_offset] when sampling an isotope or reaction.
public:
LUPI_HOST_DEVICE HeatedReactionCrossSectionMultiGroup( );
LUPI_HOST HeatedReactionCrossSectionMultiGroup( SetupInfo &a_setupInfo, Transporting::MC const &a_settings, int a_offset,
std::vector<double> const &a_crossSection, double a_threshold );
LUPI_HOST HeatedReactionCrossSectionMultiGroup( SetupInfo &a_setupInfo, Transporting::MC const &a_settings,
std::size_t a_offset, std::vector<double> const &a_crossSection, double a_threshold );
LUPI_HOST_DEVICE double operator[]( std::size_t a_index ) const { return( m_crossSections[a_index] ); } /**< Returns the value of the cross section at multi-group index *a_index*. */
LUPI_HOST_DEVICE double threshold( ) const { return( m_threshold ); } /**< Returns the value of the **m_threshold**. */
LUPI_HOST_DEVICE int offset( ) const { return( m_offset ); } /**< Returns the value of the **m_offset**. */
LUPI_HOST_DEVICE std::size_t offset( ) const { return( m_offset ); } /**< Returns the value of the **m_offset**. */
LUPI_HOST_DEVICE double crossSection( std::size_t a_index, bool a_sampling = false ) const {
int index = (int)a_index - m_offset;
if( index < 0 ) return( 0 );
if( index >= (int)m_crossSections.size( ) ) return( 0 );
if( a_index < m_offset ) return( 0.0 );
std::size_t index = a_index - m_offset;
if( index >= m_crossSections.size( ) ) return( 0.0 );
double _crossSection( m_crossSections[index] );
if( a_sampling && ( index == 0 ) ) {
@@ -805,7 +815,7 @@ class HeatedReactionCrossSectionMultiGroup {
}
LUPI_HOST_DEVICE double augmentedThresholdCrossSection( ) const { return( m_augmentedThresholdCrossSection ); } /**< Returns the value of the **m_augmentedThresholdCrossSection**. */
LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
LUPI_HOST void write( FILE *a_file, int a_reactionIndex ) const ;
LUPI_HOST void write( FILE *a_file, std::size_t a_reactionIndex ) const ;
};
/*
@@ -834,26 +844,27 @@ class HeatedCrossSectionMultiGroup {
LUPI_HOST_DEVICE HeatedReactionCrossSectionMultiGroup *operator[]( std::size_t a_index ) const { return( m_reactionCrossSections[a_index] ); }
/**< Returns the HeatedReactionCrossSectionMultiGroup for the reaction at index *a_index *a_index*. */
LUPI_HOST_DEVICE int numberOfReactions( ) const { return( (int) m_reactionCrossSections.size( ) ); }
LUPI_HOST_DEVICE std::size_t numberOfReactions( ) const { return( m_reactionCrossSections.size( ) ); }
/**< Returns the number of reactions stored in *this*. */
LUPI_HOST_DEVICE int thresholdOffset( int a_index ) const { return( m_reactionCrossSections[a_index]->offset( ) ); }
LUPI_HOST_DEVICE std::size_t thresholdOffset( std::size_t a_index ) const { return( m_reactionCrossSections[a_index]->offset( ) ); }
/**< Returns the offset for the cross section for the reaction with index *a_index*. */
LUPI_HOST_DEVICE double threshold( int a_index ) const { return( m_reactionCrossSections[a_index]->threshold( ) ); }
LUPI_HOST_DEVICE double threshold( std::size_t a_index ) const { return( m_reactionCrossSections[a_index]->threshold( ) ); }
LUPI_HOST_DEVICE Vector<double> &totalCrossSection( ) { return( m_totalCrossSection ); } /**< Returns a reference to member *m_totalCrossSection*. */
LUPI_HOST_DEVICE double crossSection( int a_hashIndex, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double augmentedCrossSection( int a_hashIndex ) const { return( m_augmentedCrossSection[a_hashIndex] ); }
LUPI_HOST_DEVICE double crossSection( std::size_t a_hashIndex, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double augmentedCrossSection( std::size_t a_hashIndex ) const { return( m_augmentedCrossSection[a_hashIndex] ); }
/**< Returns the value of the of the augmented cross section the reaction at index *a_index*. */
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, int a_hashIndex, bool a_sampling = false ) const {
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, std::size_t a_hashIndex,
bool a_sampling = false ) const {
return( m_reactionCrossSections[a_reactionIndex]->crossSection( a_hashIndex, a_sampling ) ); }
/**< Returns the reaction's cross section for the reaction at index *a_reactionIndex* and multi-group index *a_hashIndex*. */
LUPI_HOST_DEVICE double depositionEnergy( int a_hashIndex ) const { return( m_depositionEnergy[a_hashIndex] ); }
LUPI_HOST_DEVICE double depositionMomentum( int a_hashIndex ) const { return( m_depositionMomentum[a_hashIndex] ); }
LUPI_HOST_DEVICE double productionEnergy( int a_hashIndex ) const { return( m_productionEnergy[a_hashIndex] ); }
LUPI_HOST_DEVICE double gain( int a_hashIndex, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( int a_hashIndex, int a_particleIntid ) const ;
LUPI_HOST_DEVICE double depositionEnergy( std::size_t a_hashIndex ) const { return( m_depositionEnergy[a_hashIndex] ); }
LUPI_HOST_DEVICE double depositionMomentum( std::size_t a_hashIndex ) const { return( m_depositionMomentum[a_hashIndex] ); }
LUPI_HOST_DEVICE double productionEnergy( std::size_t a_hashIndex ) const { return( m_productionEnergy[a_hashIndex] ); }
LUPI_HOST_DEVICE double gain( std::size_t a_hashIndex, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( std::size_t a_hashIndex, int a_particleIntid ) const ;
LUPI_HOST void setUserParticleIndex( int a_particleIndex, int a_userParticleIndex );
LUPI_HOST void setUserParticleIndexViaIntid( int a_particleIntid, int a_userParticleIndex );
@@ -872,7 +883,7 @@ class HeatedCrossSectionsMultiGroup {
private:
Vector<double> m_temperatures;
Vector<double> m_thresholds;
Vector<int> m_multiGroupThresholdIndex; /**< This is the group where threshold starts, -1 otherwise. */
Vector<int> m_multiGroupThresholdIndex; /**< This is the group where threshold starts, -1 otherwise. */
Vector<double> m_projectileMultiGroupBoundariesCollapsed;
Vector<HeatedCrossSectionMultiGroup *> m_heatedCrossSections;
@@ -896,19 +907,20 @@ class HeatedCrossSectionsMultiGroup {
LUPI_HOST_DEVICE double threshold( std::size_t a_index ) const { return( m_thresholds[a_index] ); } /**< Returns the threshold for the reaction at index *a_index*. */
LUPI_HOST_DEVICE double crossSection( int a_hashIndex, double a_temperature, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double crossSection( std::size_t a_hashIndex, double a_temperature, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE void crossSectionVector( double a_temperature, double a_userFactor, std::size_t a_numberAllocated,
double *a_crossSectionVector ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, int a_hashIndex, double a_temperature, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, double a_temperature, double a_energy_in ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, std::size_t a_hashIndex, double a_temperature, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, double a_temperature, double a_energy_in ) const ;
template <typename RNG>
inline LUPI_HOST_DEVICE int sampleReaction( int a_hashIndex, double a_temperature, double a_energy_in, double a_crossSection, RNG &&rng) const;
inline LUPI_HOST_DEVICE std::size_t sampleReaction( std::size_t a_hashIndex, double a_temperature, double a_energy_in,
double a_crossSection, RNG &&rng) const;
LUPI_HOST_DEVICE double depositionEnergy( int a_hashIndex, double a_temperature ) const ;
LUPI_HOST_DEVICE double depositionMomentum( int a_hashIndex, double a_temperature ) const ;
LUPI_HOST_DEVICE double productionEnergy( int a_hashIndex, double a_temperature ) const ;
LUPI_HOST_DEVICE double gain( int a_hashIndex, double a_temperature, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( int a_hashIndex, double a_temperature, int a_particleIntid ) const ;
LUPI_HOST_DEVICE double depositionEnergy( std::size_t a_hashIndex, double a_temperature ) const ;
LUPI_HOST_DEVICE double depositionMomentum( std::size_t a_hashIndex, double a_temperature ) const ;
LUPI_HOST_DEVICE double productionEnergy( std::size_t a_hashIndex, double a_temperature ) const ;
LUPI_HOST_DEVICE double gain( std::size_t a_hashIndex, double a_temperature, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( std::size_t a_hashIndex, double a_temperature, int a_particleIntid ) const ;
LUPI_HOST void setUserParticleIndex( int a_particleIndex, int a_userParticleIndex );
LUPI_HOST void setUserParticleIndexViaIntid( int a_particleIntid, int a_userParticleIndex );
@@ -962,7 +974,7 @@ class NuclideGammaBranchStateInfo {
double m_nuclearLevelEnergyWidth; /**< This is 0.0 except for GRIN realized continuum levels where this is the energy width from this level to the next higher level. */
double m_multiplicity; /**< The average multiplicity of photons emitted including the emission from sub-levels. */
double m_averageGammaEnergy; /**< The average energy of photons emitted including the emission from sub-levels. */
Vector<int> m_branchIndices; /**< The list of indices into the ProtareSingle.m_branches member that this level decays to. */
Vector<std::size_t> m_branchIndices; /**< The list of indices into the ProtareSingle.m_branches member that this level decays to. */
public:
LUPI_HOST_DEVICE NuclideGammaBranchStateInfo( );
@@ -978,7 +990,7 @@ class NuclideGammaBranchStateInfo {
/**< Returns the value of the *m_nuclearLevelEnergyWidth* member. */
LUPI_HOST_DEVICE double multiplicity( ) const { return( m_multiplicity ); } /**< Returns the value of the **m_multiplicity** member. */
LUPI_HOST_DEVICE double averageGammaEnergy( ) const { return( m_averageGammaEnergy ); } /**< Returns the value of the **m_averageGammaEnergy** member. */
LUPI_HOST_DEVICE Vector<int> const &branchIndices( ) const { return( m_branchIndices ); } /**< Returns the value of the **m_branchIndices** member. */
LUPI_HOST_DEVICE Vector<std::size_t> const &branchIndices( ) const { return( m_branchIndices ); } /**< Returns the value of the **m_branchIndices** member. */
LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
LUPI_HOST void print( ProtareSingle const *a_protareSingle, std::string const &a_indent, std::string const &a_iFormat,
@@ -1020,7 +1032,7 @@ class GRIN_levelsAndProbabilities {
class GRIN_inelasticForEnergy {
private:
Vector<int> m_indices;
Vector<std::size_t> m_indices;
Vector<double> m_thresholds;
GRIN_levelsAndProbabilities m_levelsAndProbabilities;
@@ -1078,7 +1090,7 @@ class GRIN_inelastic {
class GRIN_captureToCompound {
private:
int m_index; /**< This is the index into ProtareSingle.m_nuclideGammaBranchStateInfos of the compound level forms by the capture. */
std::size_t m_index; /**< This is the index into ProtareSingle.m_nuclideGammaBranchStateInfos of the compound level forms by the capture. */
GRIN_levelsAndProbabilities m_continuumIndices; /**< This is the list of the levels the compound can decay to minus the known levels. */
public:
@@ -1086,7 +1098,7 @@ class GRIN_captureToCompound {
LUPI_HOST GRIN_captureToCompound( SetupInfo &a_setupInfo, PoPI::Database const &a_pops, std::string a_compoundId );
LUPI_HOST_DEVICE ~GRIN_captureToCompound( );
LUPI_HOST_DEVICE int index( ) const { return( m_index ); }
LUPI_HOST_DEVICE std::size_t index( ) const { return( m_index ); }
template <typename RNG>
inline LUPI_HOST_DEVICE int sampleCaptureLevel( ProtareSingle const *a_protare, double a_energy, RNG && a_rng, bool a_checkEnergy ) const ;
LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
@@ -1291,7 +1303,7 @@ class OutputChannel {
LUPI_HOST_DEVICE Vector<Product *> const &products( ) const { return( m_products ); } /**< Returns the value of the **m_products**. */
Vector<DelayedNeutron *> delayedNeutrons( ) const { return( m_delayedNeutrons ); }
LUPI_HOST_DEVICE DelayedNeutron const *delayedNeutron( int a_index ) const { return( m_delayedNeutrons[a_index] ); }
LUPI_HOST_DEVICE DelayedNeutron const *delayedNeutron( std::size_t a_index ) const { return( m_delayedNeutrons[a_index] ); }
LUPI_HOST void moveProductsEtAlToReaction( std::vector<Product *> &a_products, Functions::Function1d **a_totalDelayedNeutronMultiplicity,
std::vector<DelayedNeutron *> &a_delayedNeutrons, std::vector<Functions::Function1d_d1 *> &a_Qs );
@@ -1324,8 +1336,8 @@ class Reaction {
private:
ProtareSingle *m_protareSingle; /**< The ProtareSingle this reaction resides in. */
int m_reactionIndex; /**< The index of the reaction in the ProtareSingle. */
int m_GIDI_reactionIndex; /**< The index of the reaction in the GIDI::ProtareSingle. */
std::size_t m_reactionIndex; /**< The index of the reaction in the ProtareSingle. */
std::size_t m_GIDI_reactionIndex; /**< The index of the reaction in the GIDI::ProtareSingle. */
String m_label; /**< The **GNDS** label for the reaction. */
int m_ENDF_MT; /**< The ENDF MT value for the reaction. */
int m_ENDL_C; /**< The ENDL C value for the reaction. */
@@ -1337,14 +1349,12 @@ class Reaction {
double m_targetMass; /**< The mass of the target. */
double m_crossSectionThreshold; /**< The threshold for the reaction. */
double m_twoBodyThreshold; /**< This is the T_1 value needed to do two-body kinematics. */
bool m_upscatterModelASupported;
bool m_hasFinalStatePhotons; /**< If **true**, *this* reaction has a photon with finalState attribute. */
int m_fissionResiduaIntid; /**< The intid of the special ENDL 99120 or 99125 fission residual. */
int m_fissionResiduaIndex; /**< The index of the special ENDL 99120 or 99125 fission residual. */
int m_fissionResiduaUserIndex; /**< The user index of the special ENDL 99120 or 99125 fission residual. */
GIDI::Construction::FissionResiduals m_fissionResiduals; /**< This member specifies what fission redisual products will be added to the list of products produced in a fission reaction. */
double m_fissionResidualMass; /**< The mass of the special ENDL 99120 or 99125 fission residual. */
Vector<double> m_upscatterModelACrossSection; /**< The multi-group cross section to use for upscatter model A. */
Vector<int> m_productIntids; /**< The list of all products *this* reaction can product by their intid. */
Vector<int> m_productIndices; /**< The list of all products *this* reaction can product by their index. */
@@ -1362,7 +1372,7 @@ class Reaction {
#ifdef MCGIDI_USE_OUTPUT_CHANNEL
OutputChannel *m_outputChannel; /**< The output channel for this reaction. Only used if the C macro MCGIDI_USE_OUTPUT is defined. */
#endif
Vector<int> m_associatedOrphanProductIndices; /**< The indices in the Protare's m_orphanProducts member for the orphanProducts associated with this reaction. */
Vector<std::size_t> m_associatedOrphanProductIndices; /**< The indices in the Protare's m_orphanProducts member for the orphanProducts associated with this reaction. */
Vector<Product *> m_associatedOrphanProducts; /**< The list of products from the orphanProduct reaction. */ /* Do not delete entries as owned by orphanProduct reaction. */
// Still need m_availableEnergy and m_availableMomentum.
@@ -1382,13 +1392,13 @@ class Reaction {
GIDI::Styles::TemperatureInfos const &a_temperatureInfos );
LUPI_HOST_DEVICE ~Reaction( );
inline LUPI_HOST_DEVICE void updateProtareSingleInfo( ProtareSingle *a_protareSingle, int a_reactionIndex ) {
inline LUPI_HOST_DEVICE void updateProtareSingleInfo( ProtareSingle *a_protareSingle, std::size_t a_reactionIndex ) {
m_protareSingle = a_protareSingle;
m_reactionIndex = a_reactionIndex;
}
LUPI_HOST_DEVICE ProtareSingle const *protareSingle( ) const { return( m_protareSingle ); } /**< Returns the value of the **m_protareSingle**. */
LUPI_HOST_DEVICE int reactionIndex( ) const { return( m_reactionIndex ); } /**< Returns the value of the **m_reactionIndex**. */
LUPI_HOST_DEVICE int GIDI_reactionIndex( ) const { return( m_GIDI_reactionIndex ); } /**< Returns the value of the **m_GIDI_reactionIndex** member. */
LUPI_HOST_DEVICE ProtareSingle const *protareSingle( ) const { return( m_protareSingle ); } /**< Returns the value of the **m_protareSingle**. */
LUPI_HOST_DEVICE std::size_t reactionIndex( ) const { return( m_reactionIndex ); } /**< Returns the value of the **m_reactionIndex**. */
LUPI_HOST_DEVICE std::size_t GIDI_reactionIndex( ) const { return( m_GIDI_reactionIndex ); } /**< Returns the value of the **m_GIDI_reactionIndex** member. */
LUPI_HOST_DEVICE String const &label( ) const { return( m_label ); } /**< Returns the value of the **m_label**. */
LUPI_HOST_DEVICE int ENDF_MT( ) const { return( m_ENDF_MT ); } /**< Returns the value of the **m_ENDF_MT**. */
LUPI_HOST_DEVICE int ENDL_C( ) const { return( m_ENDL_C ); } /**< Returns the value of the **m_ENDL_C**. */
@@ -1400,15 +1410,16 @@ class Reaction {
LUPI_HOST_DEVICE double targetMass( ) const { return( m_targetMass ); } /**< Returns the value of the **m_targetMass**. */
LUPI_HOST_DEVICE double crossSectionThreshold( ) const { return( m_crossSectionThreshold ); } /**< Returns the value of the **m_crossSectionThreshold**. */
LUPI_HOST_DEVICE double twoBodyThreshold( ) const { return( m_twoBodyThreshold ); } /**< Returns the value of the *m_twoBodyThreshold* member. */
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex,
double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const ;
LUPI_HOST GIDI::Functions::XYs1d crossSectionAsGIDI_XYs1d( double a_temperature ) const ;
LUPI_HOST_DEVICE Vector<int> const &productIntids( ) const { return( m_productIntids ); }
LUPI_HOST_DEVICE Vector<int> const &productIndices( ) const { return( m_productIndices ); } /**< Returns a const reference to the *m_productIntids* member. */
LUPI_HOST_DEVICE Vector<int> const &userProductIndices( ) const { return( m_userProductIndices ); } /**< Returns a const reference to the *m_productIndices* member. */
LUPI_HOST_DEVICE MCGIDI_VectorSizeType numberOfProducts( ) const { return( m_products.size( ) ); } /**< Returns the number of products in the **m_products** member. */
LUPI_HOST_DEVICE Product const *product( int a_index ) const { return( m_products[a_index] ); }
LUPI_HOST_DEVICE std::size_t numberOfProducts( ) const { return( m_products.size( ) ); } /**< Returns the number of products in the **m_products** member. */
LUPI_HOST_DEVICE Product const *product( std::size_t a_index ) const { return( m_products[a_index] ); }
LUPI_HOST_DEVICE int productMultiplicity( int a_index ) const ;
LUPI_HOST_DEVICE int productMultiplicityViaIntid( int a_intid ) const ;
LUPI_HOST_DEVICE int productMultiplicities( int a_index ) const {
@@ -1425,22 +1436,19 @@ class Reaction {
#ifdef MCGIDI_USE_OUTPUT_CHANNEL
LUPI_HOST_DEVICE OutputChannel const *outputChannel( ) const { return( m_outputChannel ); } /**< Returns the value of the **m_outputChannel**. */
#endif
LUPI_HOST_DEVICE Vector<int> associatedOrphanProductIndices( ) const { return( m_associatedOrphanProductIndices ); } /**< Returns the value of the **m_associatedOrphanProductIndicex** member. */
LUPI_HOST_DEVICE Vector<std::size_t> associatedOrphanProductIndices( ) const { return( m_associatedOrphanProductIndices ); } /**< Returns the value of the **m_associatedOrphanProductIndicex** member. */
LUPI_HOST void addOrphanProductToProductList( std::vector<Product *> &a_associatedOrphanProducts ) const ;
LUPI_HOST_DEVICE void addOrphanProductToProductList( Vector<Product *> &a_associatedOrphanProducts ) const ;
LUPI_HOST_DEVICE void addOrphanProductToProductList( Vector<Reaction *> &a_orphanProducts ) ;
LUPI_HOST void setOrphanProductData( std::vector<int> const &a_associatedOrphanProductIndcies,
LUPI_HOST void setOrphanProductData( std::vector<std::size_t> const &a_associatedOrphanProductIndcies,
std::vector<Product *> const &a_associatedOrphanProducts );
LUPI_HOST_DEVICE bool upscatterModelASupported( ) const { return( m_upscatterModelASupported ); }
LUPI_HOST_DEVICE Vector<double> const &upscatterModelACrossSection( ) const { return( m_upscatterModelACrossSection ); }
/**< Returns the value of the **m_upscatterModelACrossSection**. */
LUPI_HOST void setUserParticleIndex( int a_particleIndex, int a_userParticleIndex );
LUPI_HOST void setUserParticleIndexViaIntid( int a_particleIntid, int a_userParticleIndex );
LUPI_HOST void setModelDBRC_data( Sampling::Upscatter::ModelDBRC_data *a_modelDBRC_data );
template <typename RNG, typename PUSHBACK>
inline LUPI_HOST_DEVICE void sampleProducts( Protare const *a_protare, double a_projectileEnergy, Sampling::Input &a_input,
inline LUPI_HOST_DEVICE void sampleProducts( Protare const *a_protare, Sampling::Input &a_input,
RNG && a_rng, PUSHBACK && a_push_back, Sampling::ProductHandler &a_products, bool a_checkOrphanProducts = true ) const ;
template <typename RNG, typename PUSHBACK>
inline LUPI_HOST_DEVICE static void sampleNullProducts( Protare const &a_protare, double a_projectileEnergy, Sampling::Input &a_input,
@@ -1534,7 +1542,7 @@ class Protare {
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE std::size_t numberOfProtares( ) const MCGIDI_TRUE_VIRTUAL; /**< Returns the number of protares contained in *this*. */
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE ProtareSingle const *protare( std::size_t a_index ) const MCGIDI_TRUE_VIRTUAL; /**< Returns the **a_index** - 1 Protare contained in *this*. */
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE ProtareSingle *protare( std::size_t a_index ) MCGIDI_TRUE_VIRTUAL; /**< Returns the **a_index** - 1 Protare contained in *this*. */
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE ProtareSingle const *protareWithReaction( int a_index ) const MCGIDI_TRUE_VIRTUAL; /**< Returns the *ProtareSingle* that contains the (*a_index* - 1) reaction. */
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE ProtareSingle const *protareWithReaction( std::size_t a_index ) const MCGIDI_TRUE_VIRTUAL; /**< Returns the *ProtareSingle* that contains the (*a_index* - 1) reaction. */
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double minimumEnergy( ) const MCGIDI_TRUE_VIRTUAL; /**< Returns the minimum cross section domain. */
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double maximumEnergy( ) const MCGIDI_TRUE_VIRTUAL ; /**< Returns the maximum cross section domain. */
@@ -1544,9 +1552,9 @@ class Protare {
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST Vector<double> const &projectileMultiGroupBoundariesCollapsed( ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE std::size_t numberOfReactions( ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE Reaction const *reaction( int a_index ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE Reaction const *reaction( std::size_t a_index ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE std::size_t numberOfOrphanProducts( ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE Reaction const *orphanProduct( int a_index ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE Reaction const *orphanProduct( std::size_t a_index ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE bool hasFission( ) const MCGIDI_TRUE_VIRTUAL;
@@ -1556,27 +1564,28 @@ class Protare {
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE bool hasURR_probabilityTables( ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double URR_domainMin( ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double URR_domainMax( ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( int a_index ) const MCGIDI_TRUE_VIRTUAL ;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( std::size_t a_index ) const MCGIDI_TRUE_VIRTUAL ;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double threshold( std::size_t a_index ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos,
int a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE void crossSectionVector( double a_temperature, double a_userFactor, int a_numberAllocated,
double *a_crossSectionVector ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_hashIndex,
std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE void crossSectionVector( double a_temperature, double a_userFactor,
std::size_t a_numberAllocated, double *a_crossSectionVector ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex,
URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex,
double a_temperature, double a_energy, bool a_sampling = false ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos,
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos,
double a_temperature, double a_energy ) const MCGIDI_TRUE_VIRTUAL;
template <typename RNG>
inline MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE int sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex,
double a_temperature, double a_energy, double a_crossSection, RNG && a_rng) const MCGIDI_TRUE_VIRTUAL;
inline MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE std::size_t sampleReaction( Sampling::Input &a_input,
URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex, double a_crossSection, RNG && a_rng) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double depositionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double depositionMomentum( int a_hashIndex, double a_temperature, double a_energy ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double productionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double gain( int a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double gainViaIntid( int a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double depositionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double depositionMomentum( std::size_t a_hashIndex, double a_temperature, double a_energy ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double productionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double gain( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE double gainViaIntid( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const MCGIDI_TRUE_VIRTUAL;
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE Vector<double> const &upscatterModelAGroupVelocities( ) const MCGIDI_TRUE_VIRTUAL;
@@ -1599,15 +1608,22 @@ class Protare {
*/
class ProtareSingle : public Protare {
friend ProtareTNSL;
private:
String m_interaction; /**< The protare's interaction string. */
int m_URR_index; /**< The index of the protare in the URR_protareInfos list. If negative, not in list. */
bool m_hasURR_probabilityTables; /**< *true* if URR probability tables present and *false* otherwise. */
double m_URR_domainMin; /**< If URR probability tables present this is the minimum of the projectile energy domain for the tables. */
double m_URR_domainMax; /**< If URR probability tables present this is the maximum of the projectile energy domain for the tables. */
DomainHash m_domainHash; /**< A copy of the domain hash supplied by the user. */
bool m_upscatterModelASupported; /**< If **true**, upscatter model A plus can be used for this protare. */
Vector<double> m_projectileMultiGroupBoundaries; /**< The multi-group boundaries for the projectile. Only used if m_crossSectionLookupMode and/or m_other1dDataLookupMode is multiGroup. */
Vector<double> m_projectileMultiGroupBoundariesCollapsed; /**< The collased, multi-group boundaries for the projectile. Only used if m_crossSectionLookupMode and/or m_other1dDataLookupMode is multiGroup. */
Vector<double> m_upscatterModelAGroupEnergies; /**< The speed of the projectile at each multi-group boundary. Need by upscatter model A. */
Vector<double> m_upscatterModelAGroupVelocities; /**< The speed of the projectile at each multi-group boundary. Need by upscatter model A. */
Vector<double> m_upscatterModelACrossSection; /**< The multi-group cross section to use for upscatter model A plus. */
MultiGroupHash m_multiGroupHash; /**< For upscatter model A with multi-group cross section data, this is the multi-group hash needed to lookup to cross section for the adjusted projectile energy. */
Vector<Reaction *> m_reactions; /**< The list of reactions. */
Vector<Reaction *> m_orphanProducts; /**< The list of orphan products. */
@@ -1622,12 +1638,13 @@ class ProtareSingle : public Protare {
LUPI_HOST void setupNuclideGammaBranchStateInfos( SetupInfo &a_setupInfo, GIDI::ProtareSingle const &a_protare,
bool a_makePhotonEmissionProbabilitiesOne, bool a_zeroNuclearLevelEnergyWidth );
LUPI_HOST_DEVICE void setUpscatterModelASupported( bool a_upscatterModelASupported ) { m_upscatterModelASupported = a_upscatterModelASupported; } /**< Sets the value of *m_upscatterModelASupported* to *a_upscatterModelASupported*. */
public:
LUPI_HOST_DEVICE ProtareSingle( );
LUPI_HOST ProtareSingle( LUPI::StatusMessageReporting &a_smr, GIDI::ProtareSingle const &a_protare, PoPI::Database const &a_pops, Transporting::MC &a_settings,
GIDI::Transporting::Particles const &a_particles, DomainHash const &a_domainHash, GIDI::Styles::TemperatureInfos const &a_temperatureInfos,
std::set<int> const &a_reactionsToExclude, int a_reactionsToExcludeOffset = 0, bool a_allowFixedGrid = true );
GIDI::ExcludeReactionsSet const &a_reactionsToExclude, std::size_t a_reactionsToExcludeOffset = 0, bool a_allowFixedGrid = true );
LUPI_HOST_DEVICE ~ProtareSingle( );
LUPI_HOST_DEVICE bool isPhotoAtomic( ) const { return( m_isPhotoAtomic ); }
@@ -1659,7 +1676,7 @@ class ProtareSingle : public Protare {
LUPI_HOST_DEVICE std::size_t numberOfProtares( ) const { return( 1 ); } /**< Returns the number of protares contained in *this*. */
LUPI_HOST_DEVICE ProtareSingle const *protare( std::size_t a_index ) const ;
LUPI_HOST_DEVICE ProtareSingle *protare( std::size_t a_index );
LUPI_HOST_DEVICE ProtareSingle const *protareWithReaction( int a_index ) const ;
LUPI_HOST_DEVICE ProtareSingle const *protareWithReaction( std::size_t a_index ) const ;
LUPI_HOST_DEVICE double minimumEnergy( ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.minimumEnergy( ) );
@@ -1675,40 +1692,51 @@ class ProtareSingle : public Protare {
/**< Returns the value of the **m_projectileMultiGroupBoundariesCollapsed** member. */
LUPI_HOST_DEVICE std::size_t numberOfReactions( ) const { return( m_reactions.size( ) ); } /**< Returns the number of reactions of *this*. */
LUPI_HOST_DEVICE Reaction const *reaction( int a_index ) const { return( m_reactions[a_index] ); } /**< Returns the (a_index-1)^th reaction of *this*. */
LUPI_HOST_DEVICE Reaction const *reaction( std::size_t a_index ) const { return( m_reactions[a_index] ); } /**< Returns the (a_index-1)^th reaction of *this*. */
LUPI_HOST_DEVICE std::size_t numberOfOrphanProducts( ) const { return( m_orphanProducts.size( ) ); } /**< Returns the number of orphan products of *this*. */
LUPI_HOST_DEVICE Reaction const *orphanProduct( int a_index ) const { return( m_orphanProducts[a_index] ); } /**< Returns the (a_index-1)^th orphan product of *this*. */
LUPI_HOST_DEVICE Reaction const *orphanProduct( std::size_t a_index ) const { return( m_orphanProducts[a_index] ); } /**< Returns the (a_index-1)^th orphan product of *this*. */
LUPI_HOST_DEVICE bool hasFission( ) const ;
LUPI_HOST_DEVICE String interaction( ) const { return( m_interaction ); }
LUPI_HOST_DEVICE bool hasIncoherentDoppler( ) const ;
LUPI_HOST_DEVICE int URR_index( ) const { return( m_URR_index ); }
LUPI_HOST_DEVICE void URR_index( int a_URR_index ) { m_URR_index = a_URR_index; }
LUPI_HOST_DEVICE void setURR_index( int a_URR_index ) { m_URR_index = a_URR_index; }
LUPI_HOST_DEVICE bool inURR( double a_energy ) const ;
LUPI_HOST_DEVICE bool hasURR_probabilityTables( ) const { return( m_hasURR_probabilityTables ); }
LUPI_HOST_DEVICE double URR_domainMin( ) const { return( m_URR_domainMin ); }
LUPI_HOST_DEVICE double URR_domainMax( ) const { return( m_URR_domainMax ); }
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( int a_index ) const { return( m_heatedCrossSections.reactionHasURR_probabilityTables( a_index ) ); }
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( std::size_t a_index ) const { return( m_heatedCrossSections.reactionHasURR_probabilityTables( a_index ) ); }
LUPI_HOST_DEVICE double threshold( std::size_t a_index ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.threshold( a_index ) );
return( m_heatedMultigroupCrossSections.threshold( a_index ) ); } /**< Returns the threshold for the reaction at index *a_index*. */
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE void crossSectionVector( double a_temperature, double a_userFactor, int a_numberAllocated, double *a_crossSectionVector ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE void crossSectionVector( double a_temperature, double a_userFactor, std::size_t a_numberAllocated,
double *a_crossSectionVector ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const ;
template <typename RNG>
inline LUPI_HOST_DEVICE int sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, double a_crossSection, RNG && a_rng ) const ;
inline LUPI_HOST_DEVICE bool sampleTargetBetaForUpscatterModelA( Sampling::Input &a_input, RNG && a_rng ) const ;
template <typename RNG>
inline LUPI_HOST_DEVICE std::size_t sampleReaction( Sampling::Input &a_input, URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_crossSection, RNG && a_rng ) const ;
LUPI_HOST_DEVICE double depositionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double depositionMomentum( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double productionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double gain( int a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( int a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const ;
LUPI_HOST_DEVICE double depositionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double depositionMomentum( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double productionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double gain( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const ;
LUPI_HOST_DEVICE bool upscatterModelASupported( ) const { return( m_upscatterModelASupported ); } /**< Returns the value of the **m_upscatterModelASupported** member. */
LUPI_HOST_DEVICE Vector<double> const &upscatterModelAGroupEnergies( ) const { return( m_upscatterModelAGroupEnergies ); } /**< Returns a reference to the **m_upscatterModelAGroupEnergies** member. */
LUPI_HOST_DEVICE Vector<double> const &upscatterModelAGroupVelocities( ) const { return( m_upscatterModelAGroupVelocities ); } /**< Returns a reference to the **m_upscatterModelAGroupVelocities** member. */
LUPI_HOST_DEVICE Vector<double> const &upscatterModelACrossSection( ) const { return( m_upscatterModelACrossSection ); }
/**< Returns the value of the **m_upscatterModelACrossSection**. */
LUPI_HOST_DEVICE void serialize2( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
LUPI_HOST_DEVICE long sizeOf2( ) const { return sizeof(*this); }
@@ -1732,7 +1760,7 @@ class ProtareComposite : public Protare {
LUPI_HOST_DEVICE ProtareComposite( );
LUPI_HOST ProtareComposite( LUPI::StatusMessageReporting &a_smr, GIDI::ProtareComposite const &a_protare, PoPI::Database const &a_pops, Transporting::MC &a_settings,
GIDI::Transporting::Particles const &a_particles, DomainHash const &a_domainHash, GIDI::Styles::TemperatureInfos const &a_temperatureInfos,
std::set<int> const &a_reactionsToExclude, int a_reactionsToExcludeOffset = 0, bool a_allowFixedGrid = true );
GIDI::ExcludeReactionsSet const &a_reactionsToExclude, std::size_t a_reactionsToExcludeOffset = 0, bool a_allowFixedGrid = true );
LUPI_HOST_DEVICE ~ProtareComposite( );
Vector<ProtareSingle *> protares( ) const { return( m_protares ); } /**< Returns the value of the **m_protares** member. */
@@ -1744,7 +1772,7 @@ class ProtareComposite : public Protare {
LUPI_HOST_DEVICE std::size_t numberOfProtares( ) const { return( m_protares.size( ) ); } /**< Returns the number of protares contained in *this*. */
LUPI_HOST_DEVICE ProtareSingle const *protare( std::size_t a_index ) const ;
LUPI_HOST_DEVICE ProtareSingle *protare( std::size_t a_index );
LUPI_HOST_DEVICE ProtareSingle const *protareWithReaction( int a_index ) const ;
LUPI_HOST_DEVICE ProtareSingle const *protareWithReaction( std::size_t a_index ) const ;
LUPI_HOST_DEVICE double minimumEnergy( ) const { return( m_minimumEnergy ); } /**< Returns the value of the **m_minimumEnergy** member. */
LUPI_HOST_DEVICE double maximumEnergy( ) const { return( m_maximumEnergy ); } /**< Returns the value of the **m_maximumEnergy** member. */
@@ -1757,10 +1785,10 @@ class ProtareComposite : public Protare {
LUPI_HOST_DEVICE std::size_t numberOfReactions( ) const { return( m_numberOfReactions ); }
/**< Returns the value of the **m_numberOfReactions** member. */
LUPI_HOST_DEVICE Reaction const *reaction( int a_index ) const ;
LUPI_HOST_DEVICE Reaction const *reaction( std::size_t a_index ) const ;
LUPI_HOST_DEVICE std::size_t numberOfOrphanProducts( ) const { return( m_numberOfOrphanProducts ); }
/**< Returns the value of the **m_numberOfOrphanProducts** member. */
LUPI_HOST_DEVICE Reaction const *orphanProduct( int a_index ) const ;
LUPI_HOST_DEVICE Reaction const *orphanProduct( std::size_t a_index ) const ;
LUPI_HOST_DEVICE bool hasFission( ) const ;
LUPI_HOST_DEVICE bool hasIncoherentDoppler( ) const ;
@@ -1769,22 +1797,26 @@ class ProtareComposite : public Protare {
LUPI_HOST_DEVICE bool hasURR_probabilityTables( ) const ;
LUPI_HOST_DEVICE double URR_domainMin( ) const ;
LUPI_HOST_DEVICE double URR_domainMax( ) const ;
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( int a_index ) const ;
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( std::size_t a_index ) const ;
LUPI_HOST_DEVICE double threshold( std::size_t a_index ) const ;
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE void crossSectionVector( double a_temperature, double a_userFactor, int a_numberAllocated, double *a_crossSectionVector ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE void crossSectionVector( double a_temperature, double a_userFactor, std::size_t a_numberAllocated,
double *a_crossSectionVector ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const ;
template <typename RNG>
inline LUPI_HOST_DEVICE int sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, double a_crossSection, RNG && a_rng ) const ;
inline LUPI_HOST_DEVICE std::size_t sampleReaction( Sampling::Input &a_input, URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_crossSection, RNG && a_rng ) const ;
LUPI_HOST_DEVICE double depositionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double depositionMomentum( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double productionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double gain( int a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( int a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const ;
LUPI_HOST_DEVICE double depositionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double depositionMomentum( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double productionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double gain( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const ;
LUPI_HOST_DEVICE Vector<double> const &upscatterModelAGroupVelocities( ) const { return( m_protares[0]->upscatterModelAGroupVelocities( ) ); }
/**< Returns a reference to the **m_upscatterModelAGroupVelocities** member. */
@@ -1812,7 +1844,7 @@ class ProtareTNSL : public Protare {
LUPI_HOST_DEVICE ProtareTNSL( );
LUPI_HOST ProtareTNSL( LUPI::StatusMessageReporting &a_smr, GIDI::ProtareTNSL const &a_protare, PoPI::Database const &a_pops, Transporting::MC &a_settings,
GIDI::Transporting::Particles const &a_particles, DomainHash const &a_domainHash, GIDI::Styles::TemperatureInfos const &a_temperatureInfos,
std::set<int> const &a_reactionsToExclude, int a_reactionsToExcludeOffset = 0, bool a_allowFixedGrid = true );
GIDI::ExcludeReactionsSet const &a_reactionsToExclude, std::size_t a_reactionsToExcludeOffset = 0, bool a_allowFixedGrid = true );
LUPI_HOST_DEVICE ~ProtareTNSL( );
LUPI_HOST_DEVICE ProtareSingle const *protareWithElastic( ) const { return( m_protareWithElastic ); } /**< Returns the **m_protareWithElastic** member. */
@@ -1829,7 +1861,7 @@ class ProtareTNSL : public Protare {
LUPI_HOST_DEVICE std::size_t numberOfProtares( ) const { return( 2 ); } /**< Always Returns 2. */
LUPI_HOST_DEVICE ProtareSingle const *protare( std::size_t a_index ) const ;
LUPI_HOST_DEVICE ProtareSingle *protare( std::size_t a_index );
LUPI_HOST_DEVICE ProtareSingle const *protareWithReaction( int a_index ) const ;
LUPI_HOST_DEVICE ProtareSingle const *protareWithReaction( std::size_t a_index ) const ;
LUPI_HOST_DEVICE double minimumEnergy( ) const { return( m_protareWithElastic->minimumEnergy( ) ); } /**< Returns the minimum cross section domain. */
LUPI_HOST_DEVICE double maximumEnergy( ) const { return( m_protareWithElastic->maximumEnergy( ) ); } /**< Returns the maximum cross section domain. */
@@ -1841,10 +1873,10 @@ class ProtareTNSL : public Protare {
/**< Returns the value of the **m_projectileMultiGroupBoundariesCollapsed** member. */
LUPI_HOST_DEVICE std::size_t numberOfReactions( ) const { return( m_TNSL->numberOfReactions( ) + m_protareWithElastic->numberOfReactions( ) ); }
LUPI_HOST_DEVICE Reaction const *reaction( int a_index ) const ;
LUPI_HOST_DEVICE Reaction const *reaction( std::size_t a_index ) const ;
LUPI_HOST_DEVICE std::size_t numberOfOrphanProducts( ) const { return( m_protareWithElastic->numberOfOrphanProducts( ) ); }
/**< Returns the number of orphan products in the normal ProtareSingle. */
LUPI_HOST_DEVICE Reaction const *orphanProduct( int a_index ) const { return( m_protareWithElastic->orphanProduct( a_index ) ); }
LUPI_HOST_DEVICE Reaction const *orphanProduct( std::size_t a_index ) const { return( m_protareWithElastic->orphanProduct( a_index ) ); }
/**< Returns the (a_index - 1 )^th orphan product in the normal ProtareSingle. */
LUPI_HOST_DEVICE bool hasFission( ) const { return( m_protareWithElastic->hasFission( ) ); } /* Returns the normal ProtareSingle's hasFission value. */
@@ -1854,22 +1886,26 @@ class ProtareTNSL : public Protare {
LUPI_HOST_DEVICE bool hasURR_probabilityTables( ) const { return( m_protareWithElastic->hasURR_probabilityTables( ) ); }
LUPI_HOST_DEVICE double URR_domainMin( ) const { return( m_protareWithElastic->URR_domainMin( ) ); }
LUPI_HOST_DEVICE double URR_domainMax( ) const { return( m_protareWithElastic->URR_domainMax( ) ); }
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( int a_index ) const ;
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables( std::size_t a_index ) const ;
LUPI_HOST_DEVICE double threshold( std::size_t a_index ) const ;
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE void crossSectionVector( double a_temperature, double a_userFactor, int a_numberAllocated, double *a_crossSectionVector ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double crossSection( URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE void crossSectionVector( double a_temperature, double a_userFactor, std::size_t a_numberAllocated,
double *a_crossSectionVector ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling = false ) const ;
LUPI_HOST_DEVICE double reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const ;
template <typename RNG>
inline LUPI_HOST_DEVICE int sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, double a_crossSection, RNG && a_rng ) const ;
inline LUPI_HOST_DEVICE std::size_t sampleReaction( Sampling::Input &a_input, URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_crossSection, RNG && a_rng ) const ;
LUPI_HOST_DEVICE double depositionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double depositionMomentum( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double productionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double gain( int a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( int a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const ;
LUPI_HOST_DEVICE double depositionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double depositionMomentum( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double productionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const ;
LUPI_HOST_DEVICE double gain( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const ;
LUPI_HOST_DEVICE double gainViaIntid( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const ;
LUPI_HOST_DEVICE Vector<double> const &upscatterModelAGroupVelocities( ) const { return( m_protareWithElastic->upscatterModelAGroupVelocities( ) ); }
/**< Returns a reference to the **m_upscatterModelAGroupVelocities** member. */
@@ -1884,8 +1920,8 @@ class ProtareTNSL : public Protare {
============================================================
*/
LUPI_HOST Protare *protareFromGIDIProtare( LUPI::StatusMessageReporting &a_smr, GIDI::Protare const &a_protare, PoPI::Database const &a_pops, Transporting::MC &a_settings, GIDI::Transporting::Particles const &a_particles,
DomainHash const &a_domainHash, GIDI::Styles::TemperatureInfos const &a_temperatureInfos, std::set<int> const &a_reactionsToExclude,
int a_reactionsToExcludeOffset = 0, bool a_allowFixedGrid = true );
DomainHash const &a_domainHash, GIDI::Styles::TemperatureInfos const &a_temperatureInfos, GIDI::ExcludeReactionsSet const &a_reactionsToExclude,
std::size_t a_reactionsToExcludeOffset = 0, bool a_allowFixedGrid = true );
LUPI_HOST Vector<double> GIDI_VectorDoublesToMCGIDI_VectorDoubles( GIDI::Vector a_vector );
LUPI_HOST void addVectorItemsToSet( Vector<int> const &a_from, std::set<int> &a_to );
@@ -55,6 +55,7 @@ class Distribution {
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double angleBiasing( Reaction const *a_reaction, double a_temperature, double a_energy_in, double a_mu_lab,
RNG && a_rng, double &a_energy_out ) const MCGIDI_TRUE_VIRTUAL;
LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
};
/*
@@ -36,7 +36,7 @@ LUPI_HOST_DEVICE void MCGIDI::URR_protareInfos::updateProtare( MCGIDI::Protare c
ProtareSingle *protareSingle = const_cast<ProtareSingle *>( a_protare->protare( i1 ) );
if( protareSingle->URR_index( ) >= 0 ) {
URR_protareInfo &URR_protare_info = m_URR_protareInfos[protareSingle->URR_index( )];
URR_protareInfo &URR_protare_info = m_URR_protareInfos[static_cast<std::size_t>(protareSingle->URR_index())];
URR_protare_info.m_inURR = protareSingle->inURR( a_energy );
if( URR_protare_info.inURR( ) ) URR_protare_info.m_rng_Value = a_rng( );
@@ -370,7 +370,7 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::AngularTwoBody::sample( double a_X,
double _x = targetMass( ) * ( a_X - m_twoBodyThreshold ) / ( finalMass * finalMass );
double Kp; // Kp is the total kinetic energy for m3 and m4 in the COM frame.
a_input.m_sampledType = Sampling::SampledType::firstTwoBody;
a_input.setSampledType( Sampling::SampledType::firstTwoBody );
if( m_Upscatter ) {
if( ( a_input.m_upscatterModel == Sampling::Upscatter::Model::B ) || ( a_input.m_upscatterModel == Sampling::Upscatter::Model::BSnLimits )
@@ -478,7 +478,7 @@ LUPI_HOST_DEVICE bool MCGIDI::Distributions::AngularTwoBody::upscatterModelB( do
const double C0 = 1.0410423479, C1 = 3.9626339162e-4, C2 =-1.8654539193e-3, C3 = 1.0264818153e-4;
double neutronMass = projectileMass( ); // Mass are in incident energy unit / c**2.
double _targetMass = targetMass( );
double temperature = 1e-3 * a_input.m_temperature; // Assumes m_temperature is in keV/K.
double temperature = a_input.temperature( );
double kineticLabMax = 1e4 * temperature;
if( a_input.m_upscatterModel == Sampling::Upscatter::Model::BSnLimits ) {
@@ -550,7 +550,7 @@ LUPI_HOST_DEVICE bool MCGIDI::Distributions::AngularTwoBody::upscatterModelB( do
}
double sinRelative = sqrt( 1.0 - cosRelative * cosRelative ); // Sine of angle between projectile velocity and relative velocity.
a_input.m_relativeMu = cosRelative;
a_input.m_muLab = muProjectileTarget;
a_input.m_targetBeta = targetBeta;
a_input.m_relativeBeta = relativeBeta;
@@ -629,7 +629,7 @@ LUPI_HOST_DEVICE bool MCGIDI::Distributions::AngularTwoBody::upscatterModelB( do
template <typename RNG>
LUPI_HOST_DEVICE void MCGIDI::Distributions::Uncorrelated::sample( double a_X, Sampling::Input &a_input, RNG && a_rng ) const {
a_input.m_sampledType = Sampling::SampledType::uncorrelatedBody;
a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
a_input.m_mu = m_angular->sample( a_X, a_rng( ), a_rng );
a_input.m_energyOut1 = m_energy->sample( a_X, a_rng( ), a_rng );
a_input.m_phi = 2. * M_PI * a_rng( );
@@ -748,7 +748,7 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::EnergyAngularMC::sample( double a_X
double energyOut_1, energyOut_2;
a_input.m_sampledType = Sampling::SampledType::uncorrelatedBody;
a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
a_input.m_energyOut1 = m_energy->sample2dOf3d( a_X, a_rng( ), a_rng, &energyOut_1, &energyOut_2 );
a_input.m_mu = m_angularGivenEnergy->sample( a_X, energyOut_1, energyOut_2, a_rng( ), a_rng );
a_input.m_phi = 2. * M_PI * a_rng( );
@@ -833,7 +833,7 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::AngularEnergyMC::sample( double a_X
double mu_1, mu_2;
a_input.m_sampledType = Sampling::SampledType::uncorrelatedBody;
a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
a_input.m_mu = m_angular->sample2dOf3d( a_X, a_rng( ), a_rng, &mu_1, &mu_2 );
a_input.m_energyOut1 = m_energyGivenAngular->sample( a_X, mu_1, mu_2, a_rng( ), a_rng );
a_input.m_phi = 2. * M_PI * a_rng( );
@@ -876,7 +876,7 @@ LUPI_HOST_DEVICE double MCGIDI::Distributions::AngularEnergyMC::angleBiasing( LU
template <typename RNG>
LUPI_HOST_DEVICE void MCGIDI::Distributions::KalbachMann::sample( double a_X, Sampling::Input &a_input, RNG && a_rng ) const {
a_input.m_sampledType = Sampling::SampledType::uncorrelatedBody;
a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
a_input.m_energyOut1 = m_f->sample( a_X, a_rng( ), a_rng );
double rValue = m_r->evaluate( a_X, a_input.m_energyOut1 );
double aValue = m_a->evaluate( a_X, a_input.m_energyOut1 );
@@ -976,13 +976,14 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::CoherentPhotoAtomicScattering::samp
a_input.m_energyOut1 = a_X;
int lowerIndex = binarySearchVector( a_X, m_energies );
int intLowerIndex = binarySearchVector( a_X, m_energies );
if( lowerIndex < 1 ) {
if( intLowerIndex < 1 ) {
do {
a_input.m_mu = 1.0 - 2.0 * a_rng( );
} while( ( 1.0 + a_input.m_mu * a_input.m_mu ) < 2.0 * a_rng( ) ); }
else {
std::size_t lowerIndex = static_cast<std::size_t>( intLowerIndex );
double _a = m_a[lowerIndex];
double X_i = m_energies[lowerIndex];
double formFactor_i = m_formFactor[lowerIndex];
@@ -1010,7 +1011,8 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::CoherentPhotoAtomicScattering::samp
double partialIntegral = a_rng( ) * normalization;
double X;
if( anomalousFactorSquared == 0.0 ) {
lowerIndex = binarySearchVector( partialIntegral, m_integratedFormFactorSquared );
intLowerIndex = binarySearchVector( partialIntegral, m_integratedFormFactorSquared );
lowerIndex = static_cast<std::size_t>( intLowerIndex );
if( lowerIndex == 0 ) {
X = sqrt( 2.0 * partialIntegral ) / m_formFactor[0]; }
@@ -1102,7 +1104,7 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::IncoherentPhotoAtomicScattering::sa
} while( scatteringFactor < a_rng( ) * scatteringFactorMax );
}
a_input.m_sampledType = Sampling::SampledType::uncorrelatedBody;
a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
a_input.m_energyOut1 = energyOut * PoPI_electronMass_MeV_c2;
a_input.m_mu = mu;
a_input.m_phi = 2.0 * M_PI * a_rng( );
@@ -1143,11 +1145,12 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::IncoherentBoundToFreePhotoAtomicSca
// Sample electron momentum projection, pz
occupation_pz = occupationNumberMax*a_rng();
int lowerIndex = binarySearchVector( occupation_pz, m_occupationNumber );
if( lowerIndex == -1 ){
int intLowerIndex = binarySearchVector( occupation_pz, m_occupationNumber );
if( intLowerIndex == -1 ){
pz = m_pz.back();
}
else{
std::size_t lowerIndex = static_cast<std::size_t>( intLowerIndex );
pz = m_pz[lowerIndex] + (occupation_pz-m_occupationNumber[lowerIndex])*(m_pz[lowerIndex+1]-m_pz[lowerIndex])/(m_occupationNumber[lowerIndex+1]-m_occupationNumber[lowerIndex]);
}
@@ -1184,12 +1187,11 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::IncoherentBoundToFreePhotoAtomicSca
}
}
a_input.m_sampledType = Sampling::SampledType::uncorrelatedBody;
a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
a_input.m_energyOut1 = energyOut * PoPI_electronMass_MeV_c2;
a_input.m_mu = mu;
a_input.m_phi = 2.0 * M_PI * a_rng( );
a_input.m_frame = productFrame( );
}
/* *********************************************************************************************************//**
@@ -1263,12 +1265,13 @@ LUPI_HOST_DEVICE double MCGIDI::Distributions::IncoherentBoundToFreePhotoAtomicS
// Sample electron momentum projection, pz
occupationNumberMax = evaluateOccupationNumber( a_energy_in, -1.0 );
occupation_pz = occupationNumberMax*a_rng();
int lowerIndex = binarySearchVector( occupation_pz, m_occupationNumber );
int intLowerIndex = binarySearchVector( occupation_pz, m_occupationNumber );
pz = 0;
if( lowerIndex == -1 ){
if( intLowerIndex == -1 ){
pz = m_pz.back();
}
else{
std::size_t lowerIndex = static_cast<std::size_t>( intLowerIndex );
pz = m_pz[lowerIndex] + (occupation_pz-m_occupationNumber[lowerIndex])*(m_pz[lowerIndex+1]-m_pz[lowerIndex])/(m_occupationNumber[lowerIndex+1]-m_occupationNumber[lowerIndex]);
}
@@ -1381,7 +1384,7 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::PairProductionGamma::sample( LUPI_m
a_input.m_mu *= -1.0;
a_input.m_phi += M_PI;
}
a_input.m_sampledType = Sampling::SampledType::uncorrelatedBody;
a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
a_input.m_energyOut1 = PoPI_electronMass_MeV_c2;
a_input.m_frame = productFrame( );
}
@@ -1423,7 +1426,7 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::CoherentElasticTNSL::sample( double
if( a_energy <= m_energies[0] ) {
a_input.m_mu = 1.0; }
else {
double temperature = 1e-3 * a_input.m_temperature; // Assumes m_temperature is in keV/K.
double temperature = a_input.temperature( );
if( temperature < m_temperatures[0] ) temperature = m_temperatures[0];
if( temperature > m_temperatures.back( ) ) temperature = m_temperatures.back( );
std::size_t temperatureIndex = (std::size_t) MCGIDI::binarySearchVector( temperature, m_temperatures, true );
@@ -1437,18 +1440,19 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::CoherentElasticTNSL::sample( double
}
double fractionSecondTemperature = 1.0 - fractionFirstTemperature;
int energyIndexMax = MCGIDI::binarySearchVector( a_energy, m_energies, true );
int intEnergyIndexMax = MCGIDI::binarySearchVector( a_energy, m_energies, true );
std::size_t energyIndexMax = static_cast<std::size_t>( intEnergyIndexMax );
if( a_energy == m_energies[energyIndexMax] ) --energyIndexMax;
double randomTotal = a_rng( ) * ( fractionFirstTemperature * pointer1[energyIndexMax] + fractionSecondTemperature * pointer2[energyIndexMax] );
int energyIndex = 0;
std::size_t energyIndex = 0;
for( ; energyIndex < energyIndexMax; ++energyIndex ) {
if( randomTotal <= fractionFirstTemperature * pointer1[energyIndex] + fractionSecondTemperature * pointer2[energyIndex] ) break;
}
a_input.m_mu = 1.0 - 2.0 * m_energies[energyIndex] / a_energy;
}
a_input.m_sampledType = Sampling::SampledType::uncorrelatedBody;
a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
a_input.m_energyOut1 = a_energy;
a_input.m_phi = 2.0 * M_PI * a_rng( );
}
@@ -1471,7 +1475,6 @@ template <typename RNG>
LUPI_HOST_DEVICE double MCGIDI::Distributions::CoherentElasticTNSL::angleBiasing( LUPI_maybeUnused Reaction const *a_reaction, LUPI_maybeUnused double a_temperature,
double a_energy_in, LUPI_maybeUnused double a_mu_lab, LUPI_maybeUnused RNG && a_rng, double &a_energy_out ) const {
// double temperature = 1e-3 * a_temperature; // Assumes a_temperature is in keV/K.
double probability = 0.0;
a_energy_out = a_energy_in;
@@ -1491,7 +1494,7 @@ template <typename RNG>
LUPI_HOST_DEVICE void MCGIDI::Distributions::IncoherentElasticTNSL::sample( double a_energy, Sampling::Input &a_input,
RNG && a_rng ) const {
double temperature = 1e-3 * a_input.m_temperature / m_temperatureToMeV_K; // Assumes m_temperature is in keV/K.
double temperature = a_input.temperature( ) / m_temperatureToMeV_K;
double W_prime = m_DebyeWallerIntegral->evaluate( temperature );
double twoEW = 2 * a_energy * W_prime;
double expOfTwice_twoEW = exp( -2 * twoEW );
@@ -1506,7 +1509,7 @@ LUPI_HOST_DEVICE void MCGIDI::Distributions::IncoherentElasticTNSL::sample( doub
a_input.m_mu = 1.0 + log( expOfTwice_twoEW + sampled_cdf * ( 1.0 - expOfTwice_twoEW ) ) / twoEW;
}
a_input.m_sampledType = Sampling::SampledType::uncorrelatedBody;
a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
a_input.m_energyOut1 = a_energy;
a_input.m_phi = 2.0 * M_PI * a_rng( );
}
@@ -1529,7 +1532,7 @@ template <typename RNG>
LUPI_HOST_DEVICE double MCGIDI::Distributions::IncoherentElasticTNSL::angleBiasing( LUPI_maybeUnused Reaction const *a_reaction, double a_temperature,
double a_energy_in, double a_mu_lab, LUPI_maybeUnused RNG && a_rng, double &a_energy_out ) const {
double temperature = 1e-3 * a_temperature / m_temperatureToMeV_K; // Assumes a_temperature is in keV/K.
double temperature = a_temperature / m_temperatureToMeV_K;
double W_prime = m_DebyeWallerIntegral->evaluate( temperature );
double twoEW = 2 * a_energy_in * W_prime;
double probability = exp( -twoEW * ( 1.0 - a_mu_lab ) ) * twoEW / ( 1.0 - exp( -2 * twoEW ) );
@@ -1550,7 +1553,7 @@ LUPI_HOST_DEVICE double MCGIDI::Distributions::IncoherentElasticTNSL::angleBiasi
template <typename RNG>
LUPI_HOST_DEVICE void MCGIDI::Distributions::Unspecified::sample( LUPI_maybeUnused double a_X, Sampling::Input &a_input, LUPI_maybeUnused RNG && a_rng ) const {
a_input.m_sampledType = Sampling::SampledType::unspecified;
a_input.setSampledType( Sampling::SampledType::unspecified );
a_input.m_energyOut1 = 0.;
a_input.m_mu = 0.;
a_input.m_phi = 0.;
@@ -1649,14 +1652,15 @@ LUPI_HOST_DEVICE double MCGIDI::Probabilities::ProbabilityBase1d::sample( double
template <typename RNG>
LUPI_HOST_DEVICE double MCGIDI::Probabilities::Xs_pdf_cdf1d::sample( double a_rngValue, LUPI_maybeUnused RNG && a_rng ) const {
int lower = binarySearchVector( a_rngValue, m_cdf );
int intLower = binarySearchVector( a_rngValue, m_cdf );
double domainValue = 0;
if( lower < 0 ) { // This should never happen.
LUPI_THROW( "Xs_pdf_cdf1d::sample: lower < 0." );
if( intLower < 0 ) { // This should never happen.
LUPI_THROW( "Xs_pdf_cdf1d::sample: intLower < 0." );
}
std::size_t lower = static_cast<std::size_t>( intLower );
if( interpolation( ) == Interpolation::FLAT ) {
double fraction = ( m_cdf[lower+1] - a_rngValue ) / ( m_cdf[lower+1] - m_cdf[lower] );
domainValue = fraction * m_Xs[lower] + ( 1 - fraction ) * m_Xs[lower+1]; }
@@ -1870,13 +1874,14 @@ C Then use rngValue to sample from pdf1(x1) and maybe pdf2(x1) and interpolat
C determine x1.
*/
double sampledValue = 0;
int lower = binarySearchVector( a_x2, m_Xs );
int intLower = binarySearchVector( a_x2, m_Xs );
if( lower == -2 ) {
if( intLower == -2 ) {
sampledValue = m_probabilities[0]->sample( a_rngValue, a_rng ); }
else if( lower == -1 ) {
else if( intLower == -1 ) {
sampledValue = m_probabilities.back( )->sample( a_rngValue, a_rng ); }
else {
auto lower = static_cast<std::size_t>( intLower );
double sampled1 = m_probabilities[lower]->sample( a_rngValue, a_rng );
if( interpolation( ) == Interpolation::FLAT ) {
@@ -1922,15 +1927,16 @@ C Samples from a pdf(x1|x2). First determine which pdf(s) to sample from given
C and maybe pdf2(x1) and interpolate to determine x1.
*/
double sampledValue = 0;
int lower = binarySearchVector( a_x2, m_Xs );
int intLower = binarySearchVector( a_x2, m_Xs );
if( lower == -2 ) {
if( intLower == -2 ) {
sampledValue = m_probabilities[0]->sample( a_rngValue, a_rng );
*a_x1_2 = *a_x1_1 = sampledValue; }
else if( lower == -1 ) {
else if( intLower == -1 ) {
sampledValue = m_probabilities.back( )->sample( a_rngValue, a_rng );
*a_x1_2 = *a_x1_1 = sampledValue; }
else {
std::size_t lower = static_cast<std::size_t>( intLower );
*a_x1_1 = m_probabilities[lower]->sample( a_rngValue, a_rng );
if( interpolation( ) == Interpolation::FLAT ) {
@@ -1961,15 +1967,17 @@ C and maybe pdf2(x1) and interpolate to determine x1.
template <typename RNG>
LUPI_HOST_DEVICE double MCGIDI::Probabilities::Regions2d::sample( double a_x2, double a_rngValue, RNG && a_rng ) const {
int lower = binarySearchVector( a_x2, m_Xs );
int intLower = binarySearchVector( a_x2, m_Xs );
if( lower < 0 ) {
if( lower == -1 ) { // a_x2 > last value of m_Xs.
if( intLower < 0 ) {
if( intLower == -1 ) { // a_x2 > last value of m_Xs.
return( m_probabilities.back( )->sample( a_x2, a_rngValue, a_rng ) );
}
lower = 0; // a_x2 < first value of m_Xs.
intLower = 0; // a_x2 < first value of m_Xs.
}
std::size_t lower = static_cast<std::size_t>( intLower );
return( m_probabilities[lower]->sample( a_x2, a_rngValue, a_rng ) );
}
@@ -1983,10 +1991,22 @@ LUPI_HOST_DEVICE double MCGIDI::Probabilities::Recoil2d::sample( LUPI_maybeUnuse
return( 0.0 );
}
/* *********************************************************************************************************
* Sampling for NBody phase space.
*
* @param a_x2 [in] Incident energy of the projectile.
* @param a_rngValue [in] The GIDI::Protare whose data is to be used to construct *this*.
* @param a_rng [in] This argument is not used by this method but needed to match ProbabilityBase1d::sample's definition.
***********************************************************************************************************/
template <typename RNG>
LUPI_HOST_DEVICE double MCGIDI::Probabilities::NBodyPhaseSpace2d::sample( double a_x2, double a_rngValue, RNG && a_rng ) const {
return( ( m_energy_in_COMFactor * a_x2 + m_Q ) * m_massFactor * m_dist->sample( a_rngValue, a_rng ) );
double energyMax = m_energy_in_COMFactor * a_x2 + m_Q;
if( energyMax < 0.0 ) return( 0.0 ); // Kludge for now until for upscatter model A until sampling below threshold is fixed.
return( energyMax * m_massFactor * m_dist->sample( a_rngValue, a_rng ) );
}
inline LUPI_HOST_DEVICE static double MCGIDI_sampleEvaporation( double a_xMax, double a_rngValue ) {
@@ -2056,7 +2076,7 @@ LUPI_HOST_DEVICE double MCGIDI::Probabilities::Watt2d::sample( double a_x2, LUPI
* From MCAPM via Sample Watt Spectrum as in TART ( Kalos algorithm ).
*/
double WattMin = 0., WattMax = a_x2 - m_U, x, y, z, energyOut, rand1, rand2;
double Watt_a = 1./m_a->evaluate( a_x2 ); // Kalos algorithm uses the inverse of the a parameter stored in GNDS
double Watt_a = 1./m_a->evaluate( a_x2 ); // Kalos algorithm uses the inverse of the 'a' parameter stored in GNDS
double Watt_b = m_b->evaluate( a_x2 );
x = 1. + ( Watt_b / ( 8. * Watt_a ) );
@@ -2112,13 +2132,14 @@ C Then use rngValue to sample from pdf2_1(x2) and maybe pdf2_2(x2) and interp
C determine x1.
*/
double sampledValue = 0;
int lower = binarySearchVector( a_x3, m_Xs );
int intLower = binarySearchVector( a_x3, m_Xs );
if( lower == -2 ) { // x3 < first value of Xs.
if( intLower == -2 ) { // x3 < first value of Xs.
sampledValue = m_probabilities[0]->sample( a_x2_1, a_rngValue, a_rng ); }
else if( lower == -1 ) { // x3 > last value of Xs.
else if( intLower == -1 ) { // x3 > last value of Xs.
sampledValue = m_probabilities.back( )->sample( a_x2_1, a_rngValue, a_rng ); }
else {
std::size_t lower = static_cast<std::size_t>( intLower );
double sampled1 = m_probabilities[lower]->sample( a_x2_1, a_rngValue, a_rng );
if( interpolation( ) == Interpolation::FLAT ) {
@@ -2150,31 +2171,43 @@ C determine x1.
// From file: MCGIDI_heatedCrossSections.cpp
/* *********************************************************************************************************//**
* Returns the requested reaction's multi-group cross section for target temperature *a_temperature* and projectile multi-group *a_hashIndex*.
*
* @param a_URR_protareInfos [in] URR information.
* @param a_URR_index [in] If not negative, specifies the index in *a_URR_protareInfos*.
* @param a_hashIndex [in] Specifies projectile energy hash index.
* @param a_temperature [in] The temperature of the target.
* @param a_energy [in] The energy of the projectile.
* @param a_crossSection [in] The total cross section for the protare at *a_temperature* and *a_energy*.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
***********************************************************************************************************/
template <typename RNG>
LUPI_HOST_DEVICE int MCGIDI::HeatedCrossSectionsContinuousEnergy::sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_URR_index,
int a_hashIndex, double a_temperature, double a_energy, double a_crossSection, RNG && a_rng ) const {
LUPI_HOST_DEVICE std::size_t MCGIDI::HeatedCrossSectionsContinuousEnergy::sampleReaction( URR_protareInfos const &a_URR_protareInfos,
int a_URR_index, std::size_t a_hashIndex, double a_temperature, double a_energy, double a_crossSection, RNG && a_rng ) const {
int i1, sampled_reaction_index, temperatureIndex1, temperatureIndex2, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
std::size_t sampled_reaction_index, temperatureIndex1, temperatureIndex2, number_of_temperatures = m_temperatures.size( );
double sampleCrossSection = a_crossSection * a_rng( );
if( a_temperature <= m_temperatures[0] ) {
temperatureIndex1 = 0;
temperatureIndex2 = temperatureIndex1; }
else if( a_temperature >= m_temperatures.back( ) ) {
temperatureIndex1 = static_cast<int>( m_temperatures.size( ) ) - 1;
temperatureIndex1 = m_temperatures.size( ) - 1;
temperatureIndex2 = temperatureIndex1; }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1 = 0;
for( ; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
temperatureIndex1 = i1 - 1;
temperatureIndex2 = i1;
}
int numberOfReactions = m_heatedCrossSections[0]->numberOfReactions( );
std::size_t numberOfReactions = m_heatedCrossSections[0]->numberOfReactions( );
double energyFraction1, energyFraction2, crossSectionSum = 0.0;
HeatedCrossSectionContinuousEnergy &heatedCrossSection1 = *m_heatedCrossSections[temperatureIndex1];
int energyIndex1 = heatedCrossSection1.evaluationInfo( a_hashIndex, a_energy, &energyFraction1 );
std::size_t energyIndex1 = heatedCrossSection1.evaluationInfo( a_hashIndex, a_energy, &energyFraction1 );
if( temperatureIndex1 == temperatureIndex2 ) {
for( sampled_reaction_index = 0; sampled_reaction_index < numberOfReactions; ++sampled_reaction_index ) {
@@ -2187,7 +2220,7 @@ LUPI_HOST_DEVICE int MCGIDI::HeatedCrossSectionsContinuousEnergy::sampleReaction
/ ( m_temperatures[temperatureIndex2] - m_temperatures[temperatureIndex1] );
double temperatureFraction1 = 1.0 - temperatureFraction2;
HeatedCrossSectionContinuousEnergy &heatedCrossSection2 = *m_heatedCrossSections[temperatureIndex2];
int energyIndex2 = heatedCrossSection2.evaluationInfo( a_hashIndex, a_energy, &energyFraction2 );
std::size_t energyIndex2 = heatedCrossSection2.evaluationInfo( a_hashIndex, a_energy, &energyFraction2 );
for( sampled_reaction_index = 0; sampled_reaction_index < numberOfReactions; ++sampled_reaction_index ) {
if( m_thresholds[sampled_reaction_index] >= a_energy ) continue;
@@ -2226,22 +2259,22 @@ LUPI_HOST_DEVICE int MCGIDI::HeatedCrossSectionsContinuousEnergy::sampleReaction
* @param a_hashIndex [in] The multi-group index.
* @param a_temperature [in] The temperature of the target.
* @param a_energy [in] The energy of the projectile.
* @param a_crossSection [in] The index of the reaction.
* @param a_crossSection [in] The total cross section for the protare at *a_temperature* and *a_energy*.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
***********************************************************************************************************/
template <typename RNG>
LUPI_HOST_DEVICE int MCGIDI::HeatedCrossSectionsMultiGroup::sampleReaction( int a_hashIndex, double a_temperature, double a_energy, double a_crossSection,
LUPI_HOST_DEVICE std::size_t MCGIDI::HeatedCrossSectionsMultiGroup::sampleReaction( std::size_t a_hashIndex, double a_temperature, double a_energy, double a_crossSection,
RNG && a_rng ) const {
int i1, sampled_reaction_index, temperatureIndex1, temperatureIndex2, numberOfTemperatures = static_cast<int>( m_temperatures.size( ) );
std::size_t i1, sampled_reaction_index, temperatureIndex1, temperatureIndex2, numberOfTemperatures = m_temperatures.size( );
double sampleCrossSection = a_crossSection * a_rng( );
if( a_temperature <= m_temperatures[0] ) {
temperatureIndex1 = 0;
temperatureIndex2 = temperatureIndex1; }
else if( a_temperature >= m_temperatures.back( ) ) {
temperatureIndex1 = static_cast<int>( m_temperatures.size( ) ) - 1;
temperatureIndex1 = m_temperatures.size( ) - 1;
temperatureIndex2 = temperatureIndex1; }
else {
for( i1 = 0; i1 < numberOfTemperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
@@ -2249,7 +2282,7 @@ LUPI_HOST_DEVICE int MCGIDI::HeatedCrossSectionsMultiGroup::sampleReaction( int
temperatureIndex2 = i1;
}
int numberOfReactions = m_heatedCrossSections[0]->numberOfReactions( );
std::size_t numberOfReactions = m_heatedCrossSections[0]->numberOfReactions( );
double crossSectionSum = 0;
HeatedCrossSectionMultiGroup &heatedCrossSection1 = *m_heatedCrossSections[temperatureIndex1];
@@ -2273,7 +2306,7 @@ LUPI_HOST_DEVICE int MCGIDI::HeatedCrossSectionsMultiGroup::sampleReaction( int
if( sampled_reaction_index == numberOfReactions ) return( MCGIDI_nullReaction );
if( m_multiGroupThresholdIndex[sampled_reaction_index] == a_hashIndex ) {
if( m_multiGroupThresholdIndex[sampled_reaction_index] == static_cast<int>( a_hashIndex ) ) {
double energyAboveThreshold = a_energy - m_thresholds[sampled_reaction_index];
if( energyAboveThreshold <= ( a_rng( ) * ( m_projectileMultiGroupBoundariesCollapsed[a_hashIndex+1] - m_thresholds[sampled_reaction_index] ) ) )
@@ -2286,7 +2319,8 @@ LUPI_HOST_DEVICE int MCGIDI::HeatedCrossSectionsMultiGroup::sampleReaction( int
// From file: MCGIDI_misc.cpp
/* *********************************************************************************************************//**
* The function returns a normalized Maxwellian speed (i.e., v = |velocity|) in 3d (i.e., v^2 Exp( -v^2 )).
* This function returns a normalized Maxwellian speed (i.e., v = |velocity|) in 3d (i.e., x^2 Exp( -x^2 ))
* where v = sqrt(2 * T / m) * x.
* Using formula in https://link.springer.com/content/pdf/10.1007%2Fs10955-011-0364-y.pdf.
* Author Nader M.A. Mohamed, title "Efficient Algorithm for Generating Maxwell Random Variables".
*
@@ -2309,74 +2343,7 @@ inline LUPI_HOST_DEVICE double sampleBetaFromMaxwellian( RNG && a_rng ) {
return( beta );
}
/* *********************************************************************************************************//**
* This function is used internally to sample a target's velocity (speed and cosine of angle relative to projectile)
* for a heated target using zero temperature, multi-grouped cross sections.
*
* @param a_protare [in] The Protare instance for the projectile and target.
* @param a_projectileEnergy [in] The energy of the projectile in the lab frame of the target.
* @param a_input [in] Contains needed input like the targets temperature. Also will have the target sampled velocity on return if return value is *true*.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
*
* @return Returns *true* if target velocity is sampled and false otherwise.
***********************************************************************************************************/
namespace MCGIDI {
template <typename RNG>
inline LUPI_HOST_DEVICE bool sampleTargetBetaForUpscatterModelA( Protare const *a_protare, double a_projectileEnergy, Sampling::Input &a_input,
RNG && a_rng ) {
double projectileBeta = MCGIDI_particleBeta( a_protare->projectileMass( ), a_projectileEnergy );
double temperature = a_input.m_temperature * 1e-3; // FIXME Assumes m_temperature is in keV/k for now.
double targetThermalBeta = MCGIDI_particleBeta( a_protare->targetMass( ), temperature );
if( targetThermalBeta < 1e-4 * projectileBeta ) return( false );
double relativeBetaMin = projectileBeta - 2.0 * targetThermalBeta;
double relativeBetaMax = projectileBeta + 2.0 * targetThermalBeta;
Vector<double> const &upscatterModelAGroupVelocities = a_protare->upscatterModelAGroupVelocities( );
int maxIndex = (int) upscatterModelAGroupVelocities.size( ) - 2;
int relativeBetaMinIndex = binarySearchVector( relativeBetaMin, upscatterModelAGroupVelocities, true );
int relativeBetaMaxIndex = binarySearchVector( relativeBetaMax, upscatterModelAGroupVelocities, true );
double targetBeta, relativeBeta, mu;
if( relativeBetaMinIndex >= maxIndex ) relativeBetaMinIndex = maxIndex;
if( relativeBetaMaxIndex >= maxIndex ) relativeBetaMaxIndex = maxIndex;
if( relativeBetaMinIndex == relativeBetaMaxIndex ) {
targetBeta = targetThermalBeta * sampleBetaFromMaxwellian( a_rng );
mu = 1.0 - 2.0 * a_rng( );
relativeBeta = sqrt( targetBeta * targetBeta + projectileBeta * projectileBeta - 2.0 * mu * targetBeta * projectileBeta ); }
else {
Vector<double> const &upscatterModelACrossSection = a_input.m_reaction->upscatterModelACrossSection( );
double reactionRate;
double reactionRateMax = 0;
for( int i1 = relativeBetaMinIndex; i1 <= relativeBetaMaxIndex; ++i1 ) {
reactionRate = upscatterModelACrossSection[i1] * upscatterModelAGroupVelocities[i1+1];
if( reactionRate > reactionRateMax ) reactionRateMax = reactionRate;
}
do {
targetBeta = targetThermalBeta * sampleBetaFromMaxwellian( a_rng );
mu = 1.0 - 2.0 * a_rng( );
relativeBeta = sqrt( targetBeta * targetBeta + projectileBeta * projectileBeta - 2.0 * mu * targetBeta * projectileBeta );
int index = binarySearchVector( relativeBeta, upscatterModelAGroupVelocities, true );
if( index > maxIndex ) index = maxIndex;
reactionRate = upscatterModelACrossSection[index] * relativeBeta;
} while( reactionRate < a_rng( ) * reactionRateMax );
}
a_input.m_projectileBeta = projectileBeta;
a_input.m_relativeMu = mu;
a_input.m_targetBeta = targetBeta;
a_input.m_relativeBeta = relativeBeta;
a_input.m_projectileEnergy = particleKineticEnergy( a_protare->projectileMass( ), relativeBeta );
return( true );
}
/* *********************************************************************************************************//**
* This function boost a particle from one frame to another frame. The frames have a relative speed *a_boostSpeed*
@@ -2392,8 +2359,9 @@ inline LUPI_HOST_DEVICE void upScatterModelABoostParticle( Sampling::Input &a_in
double C_rel = 1.0;
if( a_input.m_relativeBeta != 0.0 ) {
C_rel = ( a_input.m_projectileBeta - a_input.m_relativeMu * a_input.m_targetBeta ) / a_input.m_relativeBeta;
if( C_rel > 1.0 ) C_rel = 1.0; // Handle round-off issue. Probably should check who big the issue is.
C_rel = ( a_input.m_projectileBeta - a_input.m_muLab * a_input.m_targetBeta ) / a_input.m_relativeBeta;
if( C_rel > 1.0 ) C_rel = 1.0; // Handle round-off issue. Probably should check how big the issue is.
if( C_rel < -1.0 ) C_rel = -1.0; // Handle round-off issue. Probably should check how big the issue is.
}
double S_rel = sqrt( 1.0 - C_rel * C_rel );
@@ -2402,8 +2370,8 @@ inline LUPI_HOST_DEVICE void upScatterModelABoostParticle( Sampling::Input &a_in
a_product.m_px_vx = -S_rel * pz_vz + C_rel * a_product.m_px_vx;
double targetSpeed = MCGIDI_speedOfLight_cm_sec * a_input.m_targetBeta;
a_product.m_pz_vz += a_input.m_relativeMu * targetSpeed;
a_product.m_px_vx += sqrt( 1.0 - a_input.m_relativeMu * a_input.m_relativeMu ) * targetSpeed;
a_product.m_pz_vz += a_input.m_muLab * targetSpeed;
a_product.m_px_vx += sqrt( 1.0 - a_input.m_muLab * a_input.m_muLab ) * targetSpeed;
double phi = 2.0 * M_PI * a_rng( );
double sine = sin( phi );
@@ -2417,6 +2385,7 @@ inline LUPI_HOST_DEVICE void upScatterModelABoostParticle( Sampling::Input &a_in
a_product.m_kineticEnergy = particleKineticEnergyFromBeta2( a_product.m_productMass, speed2 );
}
}
@@ -2703,33 +2672,32 @@ LUPI_HOST_DEVICE void MCGIDI::Product::angleBiasingViaIntid( Reaction const *a_r
/* *********************************************************************************************************//**
* Samples a reaction of *this* and returns its index.
*
* @param a_URR_protareInfos [in] URR information.
* @param a_hashIndex [in] The cross section hash index.
* @param a_temperature [in] The target temperature.
* @param a_energy [in] The projectile energy.
* @param a_crossSection [in] The total cross section at *a_temperature* and *a_energy*.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
* @param a_input [in/out] Sample options requested by user.
* @param a_URR_protareInfos [in] URR information.
* @param a_hashIndex [in] Specifies the continuous energy hash index or multi-group index.
* @param a_crossSection [in] The total cross section for the protare at *a_input.temperature()* and *a_input.energy()*.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
*
* @return The index of the sampled reaction.
***********************************************************************************************************/
template <typename RNG>
LUPI_HOST_DEVICE int MCGIDI::Protare::sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature,
double a_energy, double a_crossSection, RNG && a_rng ) const {
LUPI_HOST_DEVICE std::size_t MCGIDI::Protare::sampleReaction( Sampling::Input &a_input, URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_crossSection, RNG && a_rng ) const {
int reactionIndex = -1;
std::size_t reactionIndex = MCGIDI_nullReaction;
switch( protareType( ) ) {
case ProtareType::single:
reactionIndex = static_cast<ProtareSingle const *>( this )->sampleReaction( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy,
reactionIndex = static_cast<ProtareSingle const *>( this )->sampleReaction( a_input, a_URR_protareInfos, a_hashIndex,
a_crossSection, a_rng );
break;
case ProtareType::composite:
reactionIndex = static_cast<ProtareComposite const *>( this )->sampleReaction( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy,
reactionIndex = static_cast<ProtareComposite const *>( this )->sampleReaction( a_input, a_URR_protareInfos, a_hashIndex,
a_crossSection, a_rng );
break;
case ProtareType::TNSL:
reactionIndex = static_cast<ProtareTNSL const *>( this )->sampleReaction( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy,
reactionIndex = static_cast<ProtareTNSL const *>( this )->sampleReaction( a_input, a_URR_protareInfos, a_hashIndex,
a_crossSection, a_rng );
break;
}
@@ -2754,10 +2722,9 @@ LUPI_HOST_DEVICE void MCGIDI::ProtareSingle::sampleBranchingGammas( Sampling::In
double energyLevelSampleWidthUpper = 0.0; // Used for GRIN continuum levels to add variaction to outgoing photons.
NuclideGammaBranchStateInfo *nuclideGammaBranchStateInfo = nullptr;
if( initialStateIndex >= 0 ) nuclideGammaBranchStateInfo = m_nuclideGammaBranchStateInfos[initialStateIndex];
// std::cout << initialStateIndex << " " << nuclideGammaBranchStateInfo->nuclearLevelEnergy( ) << std::endl;
if( initialStateIndex >= 0 ) nuclideGammaBranchStateInfo = m_nuclideGammaBranchStateInfos[static_cast<std::size_t>(initialStateIndex)];
while( initialStateIndex >= 0 ) {
Vector<int> const &branchIndices = nuclideGammaBranchStateInfo->branchIndices( );
auto const &branchIndices = nuclideGammaBranchStateInfo->branchIndices( );
double random = a_rng( );
double sum = 0.0;
@@ -2770,16 +2737,15 @@ LUPI_HOST_DEVICE void MCGIDI::ProtareSingle::sampleBranchingGammas( Sampling::In
double energyLevelSampleWidthLower = 0.0;
initialStateIndex = nuclideGammaBranchInfo->residualStateIndex( );
if( initialStateIndex >= 0 ) {
nuclideGammaBranchStateInfo = m_nuclideGammaBranchStateInfos[initialStateIndex];
nuclideGammaBranchStateInfo = m_nuclideGammaBranchStateInfos[static_cast<std::size_t>(initialStateIndex)];
energyLevelSampleWidthLower = a_rng( ) * nuclideGammaBranchStateInfo->nuclearLevelEnergyWidth( );
}
if( nuclideGammaBranchInfo->photonEmissionProbability( ) > a_rng( ) ) {
a_input.m_sampledType = Sampling::SampledType::photon;
a_input.setSampledType( Sampling::SampledType::photon );
a_input.m_dataInTargetFrame = false;
a_input.m_frame = GIDI::Frame::lab;
a_input.m_energyOut1 = nuclideGammaBranchInfo->gammaEnergy( ) + energyLevelSampleWidthUpper - energyLevelSampleWidthLower;
// std::cout << a_input.m_energyOut1 << " " << nuclideGammaBranchInfo->gammaEnergy( ) << " " << energyLevelSampleWidthUpper << " " << energyLevelSampleWidthLower << std::endl;
a_input.m_mu = 1.0 - 2.0 * a_rng( );
a_input.m_phi = 2.0 * M_PI * a_rng( );
@@ -2793,25 +2759,114 @@ LUPI_HOST_DEVICE void MCGIDI::ProtareSingle::sampleBranchingGammas( Sampling::In
}
/* *********************************************************************************************************//**
* Returns the index of a sampled reaction for a target with termpature *a_temperature*, a projectile with energy *a_energy* and total cross section
* *a_crossSection*. Random numbers are obtained via *a_rng*.
* This function is used internally to sample a target's velocity (speed and cosine of angle relative to projectile)
* for a heated target using zero temperature, multi-grouped cross sections.
*
* @param a_URR_protareInfos [in] URR information.
* @param a_hashIndex [in] Specifies the continuous energy or multi-group index.
* @param a_temperature [in] The temperature of the target.
* @param a_energy [in] The energy of the projectile.
* @param a_crossSection [in] The total cross section.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
* @param a_input [in/out] Contains needed input like the targets temperature. Also will have the target sampled velocity on return if return value is *true*.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
*
* @return Returns *true* if target velocity is sampled and false otherwise.
***********************************************************************************************************/
template <typename RNG>
LUPI_HOST_DEVICE int MCGIDI::ProtareSingle::sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy,
double a_crossSection, RNG && a_rng ) const {
inline LUPI_HOST_DEVICE bool MCGIDI::ProtareSingle::sampleTargetBetaForUpscatterModelA( Sampling::Input &a_input, RNG && a_rng ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.sampleReaction( a_URR_protareInfos, m_URR_index, a_hashIndex, a_temperature, a_energy,
a_crossSection, a_rng ) );
double projectileBeta = MCGIDI_particleBeta( m_projectileMass, a_input.energy( ) );
double targetThermalBeta = MCGIDI_particleBeta( m_targetMass, a_input.temperature( ) );
return( m_heatedMultigroupCrossSections.sampleReaction( a_hashIndex, a_temperature, a_energy, a_crossSection, a_rng ) );
a_input.m_projectileBeta = projectileBeta;
a_input.m_relativeBeta = projectileBeta;
a_input.m_muLab = 0.0;
a_input.m_targetBeta = 0.0;
if( targetThermalBeta < 1e-4 * projectileBeta ) return( false );
a_input.m_modelTemperature = 0.0;
double relativeBetaMin = projectileBeta - 2.0 * targetThermalBeta;
double relativeBetaMax = projectileBeta + 2.0 * targetThermalBeta;
std::size_t maxIndex = m_upscatterModelAGroupVelocities.size( ) - 2;
int intRelativeBetaMinIndex = binarySearchVector( relativeBetaMin, m_upscatterModelAGroupVelocities, true );
std::size_t relativeBetaMinIndex = static_cast<std::size_t>( intRelativeBetaMinIndex );
int intRelativeBetaMaxIndex = binarySearchVector( relativeBetaMax, m_upscatterModelAGroupVelocities, true );
std::size_t relativeBetaMaxIndex = static_cast<std::size_t>( intRelativeBetaMaxIndex );
double targetBeta, relativeBeta, mu;
if( relativeBetaMinIndex >= maxIndex ) relativeBetaMinIndex = maxIndex;
if( relativeBetaMaxIndex >= maxIndex ) relativeBetaMaxIndex = maxIndex;
if( relativeBetaMinIndex == relativeBetaMaxIndex ) {
targetBeta = targetThermalBeta * sampleBetaFromMaxwellian( a_rng );
mu = 1.0 - 2.0 * a_rng( );
relativeBeta = sqrt( targetBeta * targetBeta + projectileBeta * projectileBeta - 2.0 * mu * targetBeta * projectileBeta ); }
else {
double reactionRate;
double reactionRateMax = 0;
for( std::size_t i1 = relativeBetaMinIndex; i1 <= relativeBetaMaxIndex; ++i1 ) {
reactionRate = m_upscatterModelACrossSection[i1] * m_upscatterModelAGroupVelocities[i1+1];
if( reactionRate > reactionRateMax ) reactionRateMax = reactionRate;
}
do {
targetBeta = targetThermalBeta * sampleBetaFromMaxwellian( a_rng );
mu = 1.0 - 2.0 * a_rng( );
relativeBeta = sqrt( targetBeta * targetBeta + projectileBeta * projectileBeta - 2.0 * mu * targetBeta * projectileBeta );
std::size_t index = static_cast<std::size_t>( binarySearchVector( relativeBeta, m_upscatterModelAGroupVelocities, true ) );
if( index > maxIndex ) index = maxIndex;
reactionRate = m_upscatterModelACrossSection[index] * relativeBeta;
} while( reactionRate < a_rng( ) * reactionRateMax );
}
a_input.m_modelEnergy = particleKineticEnergy( m_projectileMass, relativeBeta );
a_input.m_relativeBeta = relativeBeta;
a_input.m_muLab = mu;
a_input.m_targetBeta = targetBeta;
return( true );
}
/* *********************************************************************************************************//**
* Returns the index of a sampled reaction for target temperature, projectile energy and total cross section
* as specified via argument *a_input*. Random numbers are obtained via *a_rng*.
*
* @param a_input [in/out] Sample options requested by user. The values m_modelTemperature and m_modelEnergy are set by this method.
* @param a_URR_protareInfos [in] URR information.
* @param a_hashIndex [in] Specifies the continuous energy hash index or multi-group index.
* @param a_crossSection [in] The total cross section for the protare at *a_input.temperature()* and *a_input.energy()*.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
***********************************************************************************************************/
template <typename RNG>
LUPI_HOST_DEVICE std::size_t MCGIDI::ProtareSingle::sampleReaction( Sampling::Input &a_input, URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_crossSection, RNG && a_rng ) const {
std::size_t hashIndex = a_hashIndex;
double crossSection1 = a_crossSection;
a_input.m_dataInTargetFrame = false;
a_input.m_modelTemperature = a_input.m_temperature;
a_input.m_modelEnergy = a_input.m_energy;
if( upscatterModelASupported( ) && ( a_input.m_upscatterModel == Sampling::Upscatter::Model::A ) ) {
a_input.m_dataInTargetFrame = sampleTargetBetaForUpscatterModelA( a_input, a_rng );
if( a_input.m_dataInTargetFrame ) {
if( m_continuousEnergy ) {
hashIndex = m_domainHash.index( a_input.m_modelEnergy ); }
else {
hashIndex = m_multiGroupHash.index( a_input.m_modelEnergy );
}
crossSection1 = crossSection( a_URR_protareInfos, hashIndex, a_input.m_modelTemperature, a_input.m_modelEnergy, true );
}
}
if( m_continuousEnergy ) return( m_heatedCrossSections.sampleReaction( a_URR_protareInfos, m_URR_index, hashIndex,
a_input.m_modelTemperature, a_input.m_modelEnergy, crossSection1, a_rng ) );
return( m_heatedMultigroupCrossSections.sampleReaction( hashIndex, a_input.m_modelTemperature, a_input.m_modelEnergy,
crossSection1, a_rng ) );
}
@@ -2820,30 +2875,30 @@ LUPI_HOST_DEVICE int MCGIDI::ProtareSingle::sampleReaction( URR_protareInfos con
/* *********************************************************************************************************//**
* Samples a reaction of *this* and returns its index.
*
* @param a_URR_protareInfos [in] URR information.
* @param a_hashIndex [in] The cross section hash index.
* @param a_temperature [in] The target temperature.
* @param a_energy [in] The projectile energy.
* @param a_crossSection [in] The total cross section at *a_temperature* and *a_energy*.
* @param a_input [in] Sample options requested by user.
* @param a_URR_protareInfos [in] URR information.
* @param a_hashIndex [in] Specifies the continuous energy hash index or multi-group index.
* @param a_crossSection [in] The total cross section for the protare at *a_input.temperature()* and *a_input.energy()*.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
*
* @return The index of the sampled reaction.
* @return The index of the sampled reaction.
***********************************************************************************************************/
template <typename RNG>
LUPI_HOST_DEVICE int MCGIDI::ProtareComposite::sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, double a_crossSection, RNG && a_rng ) const {
LUPI_HOST_DEVICE std::size_t MCGIDI::ProtareComposite::sampleReaction( Sampling::Input &a_input, URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_crossSection, RNG && a_rng ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
int reaction_index = 0;
std::size_t reaction_index = 0;
double cross_section_sum = 0.0;
double cross_section_rng = a_rng( ) * a_crossSection;
for( std::size_t i1 = 0; i1 < length; ++i1 ) {
double cross_section = m_protares[i1]->crossSection( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, true );
double cross_section = m_protares[i1]->crossSection( a_URR_protareInfos, a_hashIndex, a_input.temperature( ), a_input.energy( ), true );
cross_section_sum += cross_section;
if( cross_section_sum > cross_section_rng ) {
int reaction_index2 = m_protares[i1]->sampleReaction( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, cross_section, a_rng );
std::size_t reaction_index2 = m_protares[i1]->sampleReaction( a_input, a_URR_protareInfos, a_hashIndex, cross_section, a_rng );
reaction_index += reaction_index2;
if( reaction_index2 == MCGIDI_nullReaction ) reaction_index = MCGIDI_nullReaction;
@@ -2861,32 +2916,33 @@ LUPI_HOST_DEVICE int MCGIDI::ProtareComposite::sampleReaction( URR_protareInfos
/* *********************************************************************************************************//**
* Returns the total cross section.
*
* @param a_input [in] Sample options requested by user.
* @param a_URR_protareInfos [in] URR information.
* @param a_hashIndex [in] The cross section hash index.
* @param a_temperature [in] The target temperature.
* @param a_energy [in] The projectile energy.
* @param a_crossSection [in] The total cross section at *a_temperature* and *a_energy*.
* @param a_hashIndex [in] Specifies the continuous energy hash index or multi-group index.
* @param a_crossSection [in] The total cross section for the protare at *a_input.temperature()* and *a_input.energy()*.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
*
* @return The index of the sampled reaction.
***********************************************************************************************************/
template <typename RNG>
LUPI_HOST_DEVICE int MCGIDI::ProtareTNSL::sampleReaction( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, double a_crossSection, RNG && a_rng ) const {
LUPI_HOST_DEVICE std::size_t MCGIDI::ProtareTNSL::sampleReaction( Sampling::Input &a_input, URR_protareInfos const &a_URR_protareInfos,
std::size_t a_hashIndex, double a_crossSection, RNG && a_rng ) const {
int reactionIndex = 0;
std::size_t reactionIndex = 0;
if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
double TNSL_crossSection = m_TNSL->crossSection( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, true );
if( ( a_input.energy( ) < m_TNSL_maximumEnergy ) && ( a_input.temperature( ) <= m_TNSL_maximumTemperature ) ) {
double TNSL_crossSection = m_TNSL->crossSection( a_URR_protareInfos, a_hashIndex, a_input.temperature( ), a_input.energy( ), true );
if( TNSL_crossSection > a_rng( ) * a_crossSection ) {
reactionIndex = m_TNSL->sampleReaction( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, TNSL_crossSection, a_rng ); }
reactionIndex = m_TNSL->sampleReaction( a_input, a_URR_protareInfos, a_hashIndex, TNSL_crossSection, a_rng ); }
else {
reactionIndex = m_protareWithoutElastic->sampleReaction( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_crossSection - TNSL_crossSection, a_rng );
reactionIndex = m_protareWithoutElastic->sampleReaction( a_input, a_URR_protareInfos, a_hashIndex,
a_crossSection - TNSL_crossSection, a_rng );
if( reactionIndex != MCGIDI_nullReaction ) reactionIndex += m_numberOfTNSLReactions + 1;
} }
else {
reactionIndex = m_protareWithElastic->sampleReaction( a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_crossSection, a_rng );
reactionIndex = m_protareWithElastic->sampleReaction( a_input, a_URR_protareInfos, a_hashIndex, a_crossSection, a_rng );
if( reactionIndex != MCGIDI_nullReaction ) reactionIndex += m_numberOfTNSLReactions;
}
@@ -2900,7 +2956,6 @@ LUPI_HOST_DEVICE int MCGIDI::ProtareTNSL::sampleReaction( URR_protareInfos const
* This method adds sampled products to *a_products*.
*
* @param a_protare [in] The Protare this Reaction belongs to.
* @param a_projectileEnergy [in] The energy of the projectile.
* @param a_input [in] Sample options requested by user.
* @param a_rng [in] The random number generator function that returns a double in the range [0, 1.0).
* @param a_products [in] The object to add all sampled products to.
@@ -2908,25 +2963,16 @@ LUPI_HOST_DEVICE int MCGIDI::ProtareTNSL::sampleReaction( URR_protareInfos const
***********************************************************************************************************/
template <typename RNG, typename PUSHBACK>
LUPI_HOST_DEVICE void MCGIDI::Reaction::sampleProducts( Protare const *a_protare, double a_projectileEnergy, Sampling::Input &a_input,
LUPI_HOST_DEVICE void MCGIDI::Reaction::sampleProducts( Protare const *a_protare, Sampling::Input &a_input,
RNG && a_rng, PUSHBACK && a_push_back, Sampling::ProductHandler &a_products, bool a_checkOrphanProducts ) const {
double projectileEnergy = a_projectileEnergy;
double projectileEnergy = a_input.modelEnergy( );
a_input.m_GRIN_intermediateResidual = -1;
a_input.m_reaction = this;
a_input.m_projectileMass = m_projectileMass;
a_input.m_targetMass = m_targetMass;
a_input.m_relativeMu = 0.0;
a_input.m_targetBeta = 0.0;
a_input.m_relativeBeta = MCGIDI_particleBeta( m_projectileMass, a_projectileEnergy );
a_input.m_dataInTargetFrame = false;
if( upscatterModelASupported( ) && ( a_input.m_upscatterModel == Sampling::Upscatter::Model::A ) ) {
a_input.m_dataInTargetFrame = sampleTargetBetaForUpscatterModelA( m_protareSingle, a_projectileEnergy, a_input, a_rng );
if( a_input.m_dataInTargetFrame ) projectileEnergy = a_input.m_projectileEnergy;
}
a_input.m_relativeBeta = MCGIDI_particleBeta( m_projectileMass, projectileEnergy );
if( m_GRIN_specialSampleProducts ) {
if( m_GRIN_capture != nullptr ) {
@@ -2966,7 +3012,7 @@ LUPI_HOST_DEVICE void MCGIDI::Reaction::sampleProducts( Protare const *a_protare
}
if( m_totalDelayedNeutronMultiplicity != nullptr ) {
double totalDelayedNeutronMultiplicity = m_totalDelayedNeutronMultiplicity->evaluate( a_projectileEnergy );
double totalDelayedNeutronMultiplicity = m_totalDelayedNeutronMultiplicity->evaluate( projectileEnergy );
if( a_rng( ) < totalDelayedNeutronMultiplicity ) { // Assumes that totalDelayedNeutronMultiplicity < 1.0, which it is.
double sum = 0.0;
@@ -2976,12 +3022,12 @@ LUPI_HOST_DEVICE void MCGIDI::Reaction::sampleProducts( Protare const *a_protare
DelayedNeutron const *delayedNeutron1 = m_delayedNeutrons[i1];
Product const &product = delayedNeutron1->product( );
sum += product.multiplicity( )->evaluate( a_projectileEnergy );
sum += product.multiplicity( )->evaluate( projectileEnergy );
if( sum >= totalDelayedNeutronMultiplicity ) {
product.distribution( )->sample( a_projectileEnergy, a_input, a_rng );
product.distribution( )->sample( projectileEnergy, a_input, a_rng );
a_input.m_delayedNeutronIndex = delayedNeutron1->delayedNeutronIndex( );
a_input.m_delayedNeutronDecayRate = delayedNeutron1->rate( );
a_products.add( a_projectileEnergy, product.intid( ), product.index( ), product.userParticleIndex( ), product.mass( ), a_input, a_rng, a_push_back, false );
a_products.add( a_input.energy( ), product.intid( ), product.index( ), product.userParticleIndex( ), product.mass( ), a_input, a_rng, a_push_back, false );
break;
}
}
@@ -2989,7 +3035,7 @@ LUPI_HOST_DEVICE void MCGIDI::Reaction::sampleProducts( Protare const *a_protare
}
if( m_fissionResiduaIntid != -1 ) { // Special treatment to add 2 ENDL 99120 or 99125 products.
a_input.m_sampledType = MCGIDI::Sampling::SampledType::unspecified;
a_input.setSampledType( MCGIDI::Sampling::SampledType::unspecified );
a_input.m_frame = GIDI::Frame::lab;
a_input.m_energyOut1 = 0.0;
a_input.m_mu = 0.0;
@@ -3032,11 +3078,11 @@ LUPI_HOST_DEVICE bool MCGIDI::GRIN_capture::sampleProducts( ProtareSingle const
double availableEnergy = m_captureNeutronSeparationEnergy + a_projectileEnergy;
int primaryCaptureLevelIndex = GRIN_captureLevelProbability1->sampleCaptureLevel( a_protare, availableEnergy, a_rng );
NuclideGammaBranchStateInfo const *nuclideGammaBranchStateInfo = a_protare->nuclideGammaBranchStateInfos( )[primaryCaptureLevelIndex];
NuclideGammaBranchStateInfo const *nuclideGammaBranchStateInfo = a_protare->nuclideGammaBranchStateInfos( )[static_cast<std::size_t>(primaryCaptureLevelIndex)];
a_input.m_GRIN_intermediateResidual = nuclideGammaBranchStateInfo->intid( );
a_input.m_sampledType = Sampling::SampledType::photon;
a_input.setSampledType( Sampling::SampledType::photon );
a_input.m_dataInTargetFrame = false;
a_input.m_frame = GIDI::Frame::lab;
@@ -3083,7 +3129,7 @@ LUPI_HOST_DEVICE bool MCGIDI::GRIN_inelastic::sampleProducts( ProtareSingle cons
int levelIndex = inelasticForEnergy->sampleLevelIndex( a_projectileEnergy, a_rng( ) );
if( levelIndex < 0 ) return( false );
NuclideGammaBranchStateInfo const *nuclideGammaBranchStateInfo = a_protare->nuclideGammaBranchStateInfos( )[levelIndex];
NuclideGammaBranchStateInfo const *nuclideGammaBranchStateInfo = a_protare->nuclideGammaBranchStateInfos( )[static_cast<std::size_t>(levelIndex)];
a_input.m_GRIN_intermediateResidual = nuclideGammaBranchStateInfo->intid( );
@@ -3103,7 +3149,7 @@ LUPI_HOST_DEVICE bool MCGIDI::GRIN_inelastic::sampleProducts( ProtareSingle cons
}
if( Kp < 0 ) Kp = 0.; // FIXME There needs to be a better test here.
a_input.m_sampledType = Sampling::SampledType::firstTwoBody;
a_input.setSampledType( Sampling::SampledType::firstTwoBody );
a_input.m_mu = 1.0 - 2.0 * a_rng( );
a_input.m_phi = 2. * M_PI * a_rng( );
kinetics_COMKineticEnergy2LabEnergyAndMomentum( betaBoast, Kp, m_neutronMass, residualMass, a_input );
@@ -3195,7 +3241,7 @@ LUPI_HOST_DEVICE void MCGIDI::Reaction::sampleNullProducts( Protare const &a_pro
RNG && a_rng, PUSHBACK && a_push_back, Sampling::ProductHandler &a_products ) {
a_input.m_GRIN_intermediateResidual = -1;
a_input.m_sampledType = Sampling::SampledType::uncorrelatedBody;
a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
a_input.m_dataInTargetFrame = false;
a_input.m_frame = GIDI::Frame::lab;
a_input.m_delayedNeutronIndex = -1;
@@ -24,7 +24,7 @@ namespace MCGIDI {
class DomainHash {
private:
int m_bins; /**< The number of bins for the hash. */
std::size_t m_bins; /**< The number of bins for the hash. */
double m_domainMin; /**< The minimum domain value for the hash. */
double m_domainMax; /**< The maximum domain value for the hash. */
double m_u_domainMin; /**< The log of m_domainMin ). */
@@ -33,18 +33,18 @@ class DomainHash {
public:
LUPI_HOST_DEVICE DomainHash( );
LUPI_HOST_DEVICE DomainHash( int a_bins, double a_domainMin, double a_domainMax );
LUPI_HOST_DEVICE DomainHash( std::size_t a_bins, double a_domainMin, double a_domainMax );
LUPI_HOST_DEVICE DomainHash( DomainHash const &a_domainHash );
LUPI_HOST_DEVICE int bins( ) const { return( m_bins ); } /**< Returns the value of the **m_bins**. */
LUPI_HOST_DEVICE std::size_t bins( ) const { return( m_bins ); } /**< Returns the value of the **m_bins**. */
LUPI_HOST_DEVICE double domainMin( ) const { return( m_domainMin ); } /**< Returns the value of the **m_domainMax**. */
LUPI_HOST_DEVICE double domainMax( ) const { return( m_domainMax ); } /**< Returns the value of the **m_domainMax**. */
LUPI_HOST_DEVICE double u_domainMin( ) const { return( m_u_domainMin ); } /**< Returns the value of the **m_u_domainMin**. */
LUPI_HOST_DEVICE double u_domainMax( ) const { return( m_u_domainMax ); } /**< Returns the value of the **m_u_domainMax**. */
LUPI_HOST_DEVICE double inverse_du( ) const { return( m_inverse_du ); } /**< Returns the value of the **m_inverse_du**. */
LUPI_HOST_DEVICE int index( double a_domain ) const ;
LUPI_HOST_DEVICE Vector<int> map( Vector<double> const &a_domainValues ) const ;
LUPI_HOST_DEVICE std::size_t index( double a_domain ) const ;
LUPI_HOST_DEVICE Vector<std::size_t > map( Vector<double> const &a_domainValues ) const ;
LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
@@ -54,8 +54,9 @@ class DomainHash {
namespace Sampling {
enum class SampledType { firstTwoBody, secondTwoBody, uncorrelatedBody, unspecified, photon };
class ProductHandler;
LUPI_HOST_DEVICE int evaluationForHashIndex( int a_hashIndex, Vector<int> const &a_hashIndices, double a_energy,
LUPI_HOST_DEVICE std::size_t evaluationForHashIndex( std::size_t a_hashIndex, Vector<std::size_t> const &a_hashIndices, double a_energy,
Vector<double> const &a_energies, double *a_energyFraction );
namespace Upscatter {
@@ -75,7 +76,7 @@ class ModelDBRC_data {
double m_targetMass; /**< The mass of the target. */
Vector<double> m_energies; /**< The energy grid for the cross section. */
Vector<double> m_crossSections; /**< The cross sections corresponding to the energy grid. */
Vector<int> m_hashIndices; /**< The indicies for the energy hash function. */
Vector<std::size_t> m_hashIndices; /**< The indicies for the energy hash function. */
MCGIDI::DomainHash m_domainHash; /**< The hash "function". */
public:
@@ -134,26 +135,40 @@ class ClientCodeRNGData : public ClientRandomNumberGenerator {
=========================== Input ==========================
============================================================
*/
class Input {
friend ProtareSingle;
friend Reaction;
friend MCGIDI::Sampling::ProductHandler;
friend GRIN_capture;
friend GRIN_inelastic;
private:
bool m_wantVelocity = true ; /**< See member m_isVelocity in class Product for meaning. This is user input. */
bool m_dataInTargetFrame = false; /**< **True** if the data are in the target's frame and **false** otherwise. */
double m_modelTemperature = 0.0; /**< The temperature used when sampling product data. For example, in upscatter model A the projectile is boosted into a sampled target's frame and the modelled temperature is 0.0. */
double m_modelEnergy = 0.0; /**< The projectile energy used when sampling product data (see comment for member **m_modelTemperature**. */
SampledType m_sampledType = SampledType::uncorrelatedBody; /**< For internal use only. Set by distributions and used in the method **MCGIDI::Sampling::ProductHandler::add**. */
// The next 2 members are set by the user via the setTemperatureAndEnergy method.
double m_temperature = 0.0; /**< The temperature of the material. This member is set by the user. */
double m_energy = 0.0; /**< The energy of the projectile. This member is set by the user. */
public:
double m_temperature = 0.0; /**< Set by user. */
Upscatter::Model m_upscatterModel = Upscatter::Model::none; /**< The upscatter model to use when sampling a target's velocity. */
// The rest of the members are set by MCGIDI methods.
// These five are used for upscatter model A.
bool m_dataInTargetFrame = false; /**< **true if the data are in the target's frame and **false** otherwise. */
// These five are used for upscatter model A and the last 4 also used by model B.
double m_projectileBeta = 0.0; /**< The beta = speed / c of the projectile. */
double m_relativeMu = 0.0; /**< BRB */
double m_muLab = 0.0; /**< The cosine of the angle between the projectile's and the sampled target's velocities. */
double m_targetBeta = 0.0; /**< The beta = speed / c of the target. */
double m_relativeBeta = 0.0; /**< The beta = speed / c of the relative speed between the projectile and the target.*/
double m_relativeBeta = 0.0; /**< The beta = speed / c of the relative speed between the projectile and the target. */
double m_projectileEnergy = 0.0; /**< The energy of the projectile. */
SampledType m_sampledType = SampledType::uncorrelatedBody; /**< BRB */
Reaction const *m_reaction = nullptr; /**< The current reaction whose products are being sampled. */
double m_projectileMass = 0.0; /**< The mass of the projectile. */
@@ -182,7 +197,17 @@ class Input {
LUPI_HOST_DEVICE Input( bool a_wantVelocity, Upscatter::Model a_upscatterModel );
LUPI_HOST_DEVICE bool wantVelocity( ) const { return( m_wantVelocity ); } /**< BRB */
LUPI_HOST_DEVICE bool wantVelocity( ) const { return( m_wantVelocity ); } /**< Returns the value of the *m_wantVelocity* member. */
LUPI_HOST_DEVICE double temperature( ) const { return( m_temperature ); } /**< Returns the value of the *m_temperature* member. */
LUPI_HOST_DEVICE double energy( ) const { return( m_energy ); } /**< Returns the value of the *m_energy* member. */
LUPI_HOST_DEVICE void setTemperatureAndEnergy( double a_temperature, double a_energy );
LUPI_HOST_DEVICE bool dataInTargetFrame( ) const { return( m_dataInTargetFrame ); } /**< Returns the value of the *m_dataInTargetFrame*. */
LUPI_HOST_DEVICE double modelTemperature( ) const { return( m_modelTemperature ); } /**< Returns the value of the *m_dataInTargetFrame* member. */
LUPI_HOST_DEVICE double modelEnergy( ) const { return( m_modelEnergy ); } /**< Returns the value of the *m_modelEnergy* member. */
SampledType sampledType( ) const { return( m_sampledType ); } /**< Returns the value of the *m_sampledType* member. */
LUPI_HOST_DEVICE void setSampledType( SampledType a_sampledType ) { m_sampledType = a_sampledType; } /**< Sets the member *m_sampledType* to *a_sampledType*. */
};
/*
@@ -266,7 +291,7 @@ class StdVectorProductHandler : public ProductHandler {
LUPI_HOST_DEVICE ~StdVectorProductHandler( ) { }
LUPI_HOST_DEVICE std::size_t size( ) { return( m_products.size( ) ); }
LUPI_HOST_DEVICE Product &operator[]( long a_index ) { return( m_products[a_index] ); }
LUPI_HOST_DEVICE Product &operator[]( std::size_t a_index ) { return( m_products[a_index] ); }
LUPI_HOST_DEVICE std::vector<Product> &products( ) { return( m_products ); }
LUPI_HOST_DEVICE void push_back( Product &a_product ) { m_products.push_back( a_product ); }
LUPI_HOST_DEVICE void clear( ) { m_products.clear( ); }
@@ -109,9 +109,9 @@ class String
LUPI_HOST_DEVICE size_type capacity() const { return allocated_-1; }
// 8 byte alligned size
LUPI_HOST_DEVICE long internalSize() const {
long delta = allocated_;
long sub = delta % 8;
LUPI_HOST_DEVICE size_t internalSize() const {
size_t delta = allocated_;
size_t sub = delta % 8;
if (sub != 0) delta += (8-sub);
return delta * sizeof(char);
}
@@ -19,6 +19,8 @@
#include <typeinfo>
#include <fstream>
#include <exception>
#include <utility>
#include <stddef.h>
#include <LUPI.hpp>
#include <HAPI.hpp>
@@ -34,6 +36,12 @@ namespace PoPI {
#define PoPI_PoPsChars "PoPs"
#define PoPI_idChars "id"
#define PoPI_symbolChars "symbol"
#define PoPI_chemicalElementsChars "chemicalElements"
#define PoPI_chemicalElementChars "chemicalElement"
#define PoPI_isotopesChars "isotopes"
#define PoPI_isotopeChars "isotope"
#define PoPI_gaugeBosonChars "gaugeBoson"
#define PoPI_leptonChars "lepton"
#define PoPI_baryonChars "baryon"
@@ -132,19 +140,19 @@ class Database;
void appendXMLEnd( std::vector<std::string> &a_XMLList, std::string const &a_label );
int particleZ( Base const &a_particle, bool a_isNeutronProtonANucleon = false );
int particleZ( Database const &a_pops, int a_index, bool a_isNeutronProtonANucleon = false );
int particleZ( Database const &a_pops, std::size_t a_index, bool a_isNeutronProtonANucleon = false );
int particleZ( Database const &a_pops, std::string const &a_id, bool a_isNeutronProtonANucleon = false );
int particleA( Base const &a_particle, bool a_isNeutronProtonANucleon = false );
int particleA( Database const &a_pops, int a_index, bool a_isNeutronProtonANucleon = false );
int particleA( Database const &a_pops, std::size_t a_index, bool a_isNeutronProtonANucleon = false );
int particleA( Database const &a_pops, std::string const &a_id, bool a_isNeutronProtonANucleon = false );
int particleZA( Base const &a_particle, bool a_isNeutronProtonANucleon = false );
int particleZA( Database const &a_pops, int a_index, bool a_isNeutronProtonANucleon = false );
int particleZA( Database const &a_pops, std::size_t a_index, bool a_isNeutronProtonANucleon = false );
int particleZA( Database const &a_pops, std::string const &a_id, bool a_isNeutronProtonANucleon = false );
int particleMetaStableIndex( Base const &a_particle );
int particleMetaStableIndex( Database const &a_pops, int a_index );
int particleMetaStableIndex( Database const &a_pops, std::size_t a_index );
int particleMetaStableIndex( Database const &a_pops, std::string const &a_id );
std::string specialParticleID( SpecialParticleID_mode a_mode, std::string const &a_id );
@@ -311,7 +319,7 @@ class Suite {
void appendFromParentNode2( HAPI::Node const &a_node, T2 *a_parent );
std::string::size_type size( void ) const { return( m_items.size( ) ); } /**< Returns the number of items in the suite. */
T &operator[]( int a_index ) const { return( *m_items[a_index] ); } /**< Returns the item at index *a_index*. */
T &operator[]( std::size_t a_index ) const { return( *m_items[a_index] ); } /**< Returns the item at index *a_index*. */
std::string const &moniker( void ) { return( m_moniker ); } /**< Returns the value of the *m_moniker* member. */
void toXMLList( std::vector<std::string> &a_XMLList, std::string const &a_indent1 ) const ;
@@ -358,7 +366,7 @@ void Suite<T, T2>::appendFromParentNode( HAPI::Node const &a_node, Database *a_D
template <class T, class T2>
void Suite<T, T2>::appendFromParentNode2( HAPI::Node const &a_node, T2 *a_parent ) {
for( HAPI::Node child = a_node.first_child( ); !child.empty( ); child = child.next_sibling( ) ) {
for( HAPI::Node child = a_node.first_child( ); !child.empty( ); child.to_next_sibling( ) ) {
T *item = new T( child, a_parent );
m_items.push_back( item );
}
@@ -380,7 +388,7 @@ void Suite<T, T2>::toXMLList( std::vector<std::string> &a_XMLList, std::string c
if( _size == 0 ) return;
std::string header = a_indent1 + "<" + m_moniker + ">";
a_XMLList.push_back( header );
a_XMLList.push_back( std::move( header ) );
for( std::string::size_type i1 = 0; i1 < _size; ++i1 ) m_items[i1]->toXMLList( a_XMLList, indent2 );
appendXMLEnd( a_XMLList, m_moniker );
@@ -576,7 +584,7 @@ class NuclideGammaBranchStateInfo {
std::vector<NuclideGammaBranchInfo> m_branches;
public:
NuclideGammaBranchStateInfo( std::string a_state, int a_intid, std::string const &a_kind, double a_nuclearLevelEnergy );
NuclideGammaBranchStateInfo( std::string const &a_state, int a_intid, std::string const &a_kind, double a_nuclearLevelEnergy );
std::string const &state( ) const { return( m_state ); } /**< Returns the value of the *m_state* member. */
int intid( ) const { return( m_intid ); } /**< Returns the value of the *m_intid* member. */
@@ -631,7 +639,7 @@ class Base {
private:
std::string m_id; /**< The **PoPs** id for the particle or **PoPs** symbol for a chemicalElement or isotope. */
Particle_class m_class; /**< The **Particle_class** for the particle, chemicalElement or isotope. */
int m_index; /**< The for the particle, chemicalElement or isotope. */
std::size_t m_index; /**< The for the particle, chemicalElement or isotope. */
int m_intid; /**< The unique integer id for a particle or a meta-stable alias. For a non meta-stable alias, an isotope or chemical element, this is -1. */
void setIntid( int a_intid ) { m_intid = a_intid; } /**< Sets the value of the *m_intid* member to *a_intid*. */
@@ -642,8 +650,8 @@ class Base {
virtual ~Base( );
std::string const &ID( void ) const { return( m_id ); } /**< Returns a *const* reference to the *m_id* member of *this*. */
int index( void ) const { return( m_index ); } /**< Returns the value of the *m_index* member of *this*. */
void setIndex( int a_index ) { m_index = a_index; } /**< Sets the value of the *m_index* member of *this* to *a_index*. */
std::size_t index( void ) const { return( m_index ); } /**< Returns the value of the *m_index* member of *this*. */
void setIndex( std::size_t a_index ) { m_index = a_index; } /**< Sets the value of the *m_index* member of *this* to *a_index*. */
int intid( ) const { return( m_intid ); } /**< Returns the value of the *m_intid* member. */
Particle_class Class( void ) const { return( m_class ); } /**< Returns the value of the *m_class* member of *this*. */
virtual bool isParticle( ) const { return( true ); } /**< Returns **true** if *this* is a **Particle** and **false** it *this* is a **ChemicalElement** or **Isotope** instance. */
@@ -685,7 +693,7 @@ class IDBase : public Base {
IDBase( HAPI::Node const &a_node, Particle_class a_class );
virtual ~IDBase( ); // BRB This should be virtual but I cannot get it to work without crashing.
int addToDatabase( Database *a_DB );
std::size_t addToDatabase( Database *a_DB );
double massValue2( Database const &a_DB, std::string const &a_unit ) const ;
};
@@ -703,7 +711,7 @@ class SymbolBase : public Base {
std::string const &symbol( ) const { return( ID( ) ); } /**< Returns the value of the symbol. */
int addToSymbols( Database *a_DB );
std::size_t addToSymbols( Database *a_DB );
bool isParticle( ) const { return( false ); }
};
@@ -1079,15 +1087,15 @@ class Alias : public IDBase {
private:
std::string m_pid; /**< The id of the particle *this* is an alias for. */
int m_pidIndex; /**< The index of the particle with id *m_pid*. */
std::size_t m_pidIndex; /**< The index of the particle with id *m_pid*. */
public:
Alias( HAPI::Node const &a_node, Database *a_DB, Particle_class a_class = Particle_class::alias );
virtual ~Alias( );
std::string const &pid( void ) const { return( m_pid ); } /**< Returns a *const* reference to the *m_pid* member of *this*. */
int pidIndex( void ) const { return( m_pidIndex ); } /**< Returns a *const* reference to the *m_pidIndex* member of *this*. */
void setPidIndex( int a_index ) { m_pidIndex = a_index; } /**< Set the member *m_pidIndex* to *a_index*. */
std::size_t pidIndex( void ) const { return( m_pidIndex ); } /**< Returns a *const* reference to the *m_pidIndex* member of *this*. */
void setPidIndex( std::size_t a_index ) { m_pidIndex = a_index; } /**< Set the member *m_pidIndex* to *a_index*. */
void toXMLList( std::vector<std::string> &a_XMLList, std::string const &a_indent1 ) const ;
};
@@ -1124,11 +1132,11 @@ class Database {
std::string m_name; /**< The **GNDS** **name** of the first file read in. */
std::string m_version; /**< The **GNDS** **version** of the first file read in. */
ParticleList m_list; /**< The internal list of the particles. */
std::map<std::string, int> m_idsMap; // Be careful with this as a map[key] will add key if it is not in the map.
std::map<int, int> m_intidsMap; // Be careful with this as a map[key] will add key if it is not in the map.
std::map<std::string, std::size_t> m_idsMap; // Be careful with this as a map[key] will add key if it is not in the map.
std::map<int, std::size_t> m_intidsMap; // Be careful with this as a map[key] will add key if it is not in the map.
/**< This maps each particle id to a unique index. */
SymbolList m_symbolList; /**< The internal list of the symbols. */
std::map<std::string, int> m_symbolMap; // Be careful with this as a map[key] will add key if it is not in the map.
std::map<std::string, std::size_t> m_symbolMap; // Be careful with this as a map[key] will add key if it is not in the map.
/**< This maps each symbol to a unique index. */
std::vector<Alias *> m_unresolvedAliases; /**< This is used internally to store aliases when a **PoPs** node is being parsed as the aliases onde is parsed before the particles are parsed. */
@@ -1164,47 +1172,47 @@ class Database {
std::string::size_type size( void ) const { return( m_list.size( ) ); } /**< Returns the number of particle in *this*. */
ParticleList const &list( ) { return( m_list ); } /**< Returns a *const* *reference* to the *m_list* member. */
SymbolList const &symbolList( ) { return( m_symbolList ); } /**< Returns a *const* *reference* to the *m_symbolList* member. */
int operator[]( std::string const &a_id ) const ;
std::size_t operator[]( std::string const &a_id ) const ;
template<typename T> T const &get( std::string const &a_id ) const ;
template<typename T> T const &get( int a_index ) const ;
template<typename T> T const &get( std::size_t a_index ) const ;
Particle const &particle( std::string const &a_id ) const { return( get<Particle>( a_id ) ); } /**< Returns a *const* *reference* to the particle with id *a_id*. */
Particle const &particle( int a_index ) const { return( get<Particle>( a_index ) ); } /**< Returns a *const* *reference* to the particle with index *a_index*. */
Particle const &particle( std::size_t a_index ) const { return( get<Particle>( a_index ) ); } /**< Returns a *const* *reference* to the particle with index *a_index*. */
IDBase const &idBase( std::string const &a_id ) const { return( get<IDBase>( a_id ) ); } /**< Returns a *const* *reference* to a **IDBase** instance with id *a_id*. */
IDBase const &idBase( int &a_index ) const { return( get<IDBase>( a_index ) ); } /**< Returns a *const* *reference* to a **IDBase** instance with id *a_index*. */
IDBase const &idBase( std::size_t &a_index ) const { return( get<IDBase>( a_index ) ); } /**< Returns a *const* *reference* to a **IDBase** instance with id *a_index*. */
ParticleList const &particleList( ) const { return( m_list ); } /**< Returns a *const* *reference* to the *m_list* variable of *this*. */
SymbolList symbolList( ) const { return( m_symbolList ); } /**< Returns a *const* *reference* to the *m_symbolList* variable of *this*. */
bool exists( std::string const &a_id ) const ;
bool exists( int a_index ) const ;
bool exists( std::size_t a_index ) const ;
bool existsIntid( int a_intid ) const ;
Suite<ChemicalElement, Database> const &chemicalElements( ) const { return( m_chemicalElements ); }
/**< Returns a *const* *reference* to the *m_chemicalElements* variable of *this*. */
bool isParticle( std::string const &a_id ) const { return( get<Base>( a_id ).isParticle( ) ); } /**< Returns **true** if *a_id* is a particle and **false** otherwise. */
bool isParticle( int a_index ) const { return( m_list[a_index]->isParticle( ) ); } /**< Returns **true** if *a_index* is a particle and **false** otherwise. */
bool isParticle( std::size_t a_index ) const { return( m_list[a_index]->isParticle( ) ); } /**< Returns **true** if *a_index* is a particle and **false** otherwise. */
bool isAlias( std::string const &a_id ) const { return( get<Base>( a_id ).isAlias( ) ); } /**< Returns **true** if *a_id* is an alias and **false** otherwise. */
bool isAlias( int a_index ) const { return( m_list[a_index]->isAlias( ) ); } /**< Returns **true** if *a_index* is an alias and **false** otherwise. */
bool isAlias( std::size_t a_index ) const { return( m_list[a_index]->isAlias( ) ); } /**< Returns **true** if *a_index* is an alias and **false** otherwise. */
bool isMetaStableAlias( std::string const &a_id ) const { return( get<Base>( a_id ).isMetaStableAlias( ) ); }
/**< Returns **true** if *a_id* is a meta-stable and **false** otherwise. */
bool isMetaStableAlias( int a_index ) const { return( m_list[a_index]->isMetaStableAlias( ) ); }
bool isMetaStableAlias( std::size_t a_index ) const { return( m_list[a_index]->isMetaStableAlias( ) ); }
/**< Returns **true** if *a_index* is a meta-stable and **false** otherwise. */
std::vector<std::string> aliasReferences( std::string const &a_id );
std::string final( std::string const &a_id, bool a_returnAtMetaStableAlias = false ) const ;
int final( int a_index, bool a_returnAtMetaStableAlias = false ) const ;
std::size_t final( std::size_t a_index, bool a_returnAtMetaStableAlias = false ) const ;
std::string chemicalElementSymbol( std::string const &a_id ) const ;
std::string isotopeSymbol( std::string const &a_id ) const ;
int intid( std::string const &a_id ) const ;
int intid( int a_index ) const ;
int indexFromIntid( int a_intid ) const ;
int intid( std::size_t a_index ) const ;
std::size_t indexFromIntid( int a_intid ) const ;
int add( Base *a_item );
int addSymbol( SymbolBase *a_item );
std::size_t add( Base *a_item );
std::size_t addSymbol( SymbolBase *a_item );
void calculateNuclideGammaBranchStateInfos( NuclideGammaBranchStateInfos &a_nuclideGammaBranchStateInfos, Database const *a_pops2,
std::vector<std::string> a_extraGammaBranchStates ) const ;
std::vector<std::string> &a_extraGammaBranchStates ) const ;
void calculateNuclideGammaBranchStateInfos2( NuclideGammaBranchStateInfos &a_nuclideGammaBranchStateInfos ) const ;
double massValue( std::string const &a_id, std::string const &a_unit ) const ;
@@ -1222,7 +1230,7 @@ class Database {
* @return A *const* reference to the particle at index *a_index*.
***********************************************************************************************************/
template<typename T> T const &Database::get( int a_index ) const {
template<typename T> T const &Database::get( std::size_t a_index ) const {
Base *particle = m_list[a_index];
if( particle == nullptr ) throw std::range_error( std::string( "particle not in database" ) );
@@ -1242,7 +1250,7 @@ template<typename T> T const &Database::get( int a_index ) const {
template<typename T> T const &Database::get( std::string const &a_id ) const {
int index = (*this)[a_id];
auto index = (*this)[a_id];
Base *particle = m_list[index];
T const *object = dynamic_cast<T const *>( particle );
if( object == nullptr ) throw std::bad_cast( );
@@ -37,7 +37,10 @@ class Reaction {
std::vector<std::string> const &a_intermediates, std::string const &a_process, std::string const &reactionLabel,
std::string const &convarianceFlag );
bool isFission( ) const;
int multiplicity( std::string const &a_productId ) const;
void products( double a_energyMax, std::set<std::string> &a_products ) const ;
void printAsRIS_file( int a_labelWidth ) const ;
};
class Protare {
@@ -47,9 +50,10 @@ class Protare {
std::string m_projectile; /**< The PoPs id for the projectile. */
std::string m_target; /**< The PoPs id for the target. */
std::string m_evaluation; /**< The evaluation for the protare. */
std::string m_energyUnit; /**< The energy unit in the file for the protare. */
double m_energyConversionFactor; /**< Factor to convert from file energy units to user energy units. */
std::map<std::string, std::string> m_aliases; /**< The list of meta-stable aliases in the protare. */
std::vector<std::pair<std::string, std::string> > m_aliases; /**< The list of meta-stable aliases in the protare and the nuclide they alias. */
std::vector<Reaction *> m_reactions; /**< The list of **Reaction** instances for the protare. */
public:
@@ -60,15 +64,18 @@ class Protare {
std::string const &projectile( ) { return( m_projectile ); }
std::string const &target( ) { return( m_target ); }
std::string const &evaluation( ) { return( m_evaluation ); }
std::vector<Reaction *> const &reactions( ) const { return( m_reactions ); }
void Oops( std::vector<std::string> const &a_elements );
void addAlias( std::vector<std::string> const &a_elements );
bool fissionPresent( ) const;
void setAddingAliases( ) { m_addMode = 1; } /**< Tells **add** method to call the **addAlias** method. */
void addReaction( std::vector<std::string> const &a_elements );
void setAddingReactions( ) { m_addMode = 2; } /**< Tells **add** method to call the **addReaction** method. */
void add( std::vector<std::string> const &a_elements );
void products( Projectile const *a_projectile, int a_level, int a_maxLevel, double a_energyMax, std::map<std::string, int> &a_products ) const ;
void printAsRIS_file( ) const ;
};
class Target {
@@ -84,8 +91,11 @@ class Target {
~Target( );
void add( Protare *a_protare );
bool fissionPresent( ) const;
std::vector<Reaction *> const &reactions( ) const { return( m_protares[0]->reactions( ) ); }
void products( Projectile const *a_projectile, int a_level, int a_maxLevel, double a_energyMax, std::map<std::string, int> &a_products ) const ;
void print( std::string const &a_indent = "" ) const ;
void printAsRIS_file( ) const ;
};
class Projectile {
@@ -101,8 +111,13 @@ class Projectile {
~Projectile( );
void add( Protare *a_protare );
bool fissionPresent( std::vector<std::string> targetIds ) const;
std::vector<std::string> targetIds( ) const ;
void products( std::string const &a_target, int a_level, int a_maxLevel, double a_energyMax, std::map<std::string, int> &a_products ) const ;
std::vector<std::string> filterProducts( std::vector<std::string> const &a_productIds ) const ;
Target const *target( std::string const &a_targetName ) const;
void print( std::string const &a_indent = "" ) const ;
void printAsRIS_file( ) const ;
};
class Projectiles {
@@ -116,9 +131,12 @@ class Projectiles {
void add( Protare *a_protare );
void clear( );
std::vector<std::string> projectileIds( ) const ;
Projectile const *projectile( std::string const &a_projectile ) const ;
std::vector<std::string> products( std::string const &a_projectile, std::vector<std::string> const &a_seedTargets, int a_maxLevel,
double a_energyMax ) const ;
double a_energyMax, bool a_onlyIncludeTargets = true ) const ;
void print( std::string const &a_indent = "" ) const ;
void printAsRIS_file( ) const ;
};
void readRIS( std::string const &a_fileName, std::string const &a_energyUnit, Projectiles &a_projectiles );
@@ -1,5 +1,5 @@
#define G4GIDI_MAJOR 1
#define G4GIDI_MINOR 1
#define G4GIDI_PATCHLEVEL 13
#define G4GIDI_VERSION "1.1.13"
#define G4GIDI_GIT "62db2f9b95bcd850c8821e70db50c4c94874cc4d"
#define G4GIDI_PATCHLEVEL 22
#define G4GIDI_VERSION "1.1.22"
#define G4GIDI_GIT "67ec00868c75fdae76066418afc6c418eca69081"
@@ -3,25 +3,25 @@
# Define the Geant4 Module.
geant4_add_module(G4had_lend
PUBLIC_HEADERS
G4LENDCaptureCrossSection.hh
G4LENDCapture.hh
G4LENDCaptureCrossSection.hh
G4LENDCombinedCrossSection.hh
G4LENDCombinedModel.hh
G4LENDCrossSection.hh
G4LENDElasticCrossSection.hh
G4LENDElastic.hh
G4LENDFissionCrossSection.hh
G4LENDElasticCrossSection.hh
G4LENDFission.hh
G4LENDFissionCrossSection.hh
G4LENDGammaCrossSection.hh
G4LENDGammaModel.hh
G4LENDHeader.hh
G4LENDInelasticCrossSection.hh
G4LENDInelastic.hh
G4LENDInelasticCrossSection.hh
G4LENDManager.hh
G4LENDModel.hh
G4LENDUsedTarget.hh
g4gidi_version.hh
G4GIDI.hh
g4gidi_version.hh
nf_Legendre.h
nf_integration.h
nf_buffer.h
@@ -36,16 +36,16 @@ geant4_add_module(G4had_lend
GUPI.hpp
HAPI.hpp
LUPI.hpp
LUPI_dataBuffer.hpp
LUPI_declareMacro.hpp
LUPI_defines.hpp
LUPI_dataBuffer.hpp
MCGIDI_distributions.hpp
MCGIDI_string.hpp
MCGIDI_functions.hpp
MCGIDI_sampling.hpp
MCGIDI_vector.hpp
MCGIDI_headerSource.hpp
MCGIDI.hpp
MCGIDI_distributions.hpp
MCGIDI_functions.hpp
MCGIDI_headerSource.hpp
MCGIDI_sampling.hpp
MCGIDI_string.hpp
MCGIDI_vector.hpp
PoPI.hpp
RISI.hpp
SOURCES
@@ -53,6 +53,7 @@ geant4_add_module(G4had_lend
G4LENDCaptureCrossSection.cc
G4LENDCombinedCrossSection.cc
G4LENDCombinedModel.cc
G4LENDCrossSection.cc
G4LENDElastic.cc
G4LENDElasticCrossSection.cc
G4LENDFission.cc
@@ -61,16 +62,15 @@ geant4_add_module(G4had_lend
G4LENDGammaModel.cc
G4LENDInelastic.cc
G4LENDInelasticCrossSection.cc
G4LENDUsedTarget.cc
G4LENDCrossSection.cc
G4LENDManager.cc
G4LENDModel.cc
G4LENDUsedTarget.cc
nf_Legendre.c
nf_Legendre_GaussianQuadrature.c
nf_GnG_adaptiveQuadrature.c
nf_stringToDoubles.c
nf_stringToInt32s.c
nf_utilities.c
nf_stringToDoubles.c
ptwX_core.c
ptwX_misc.c
ptwXY_binaryOperators.c
@@ -84,88 +84,90 @@ geant4_add_module(G4had_lend
ptwXY_unitaryOperators.c
statusMessageReporting.c
pugixml.cc
G4GIDI.cc
G4GIDI_misc.cc
G4GIDI_target.cc
G4GIDI.cc
GIDI_1dData.cc
GIDI_GNDS_fileType.cc
GIDI_GRIN_continuumGammas.cc
GIDI_Legendre1d.cc
GIDI_URR_probabilityTables.cc
GIDI_URR_probabilityTables1d.cc
GIDI_XYs1d.cc
GIDI_XYs2d.cc
GIDI_XYs3d.cc
GIDI_Ys1d.cc
GIDI_array3d.cc
GIDI_arrays.cc
GIDI_axes.cc
GIDI_axis.cc
GIDI_axisDomain.cc
GIDI_construction.cc
GIDI_delayedNeutron.cc
GIDI_group.cc
GIDI_exceptions.cc
GIDI_flux.cc
GIDI_grid.cc
GIDI_gridded2d.cc
GIDI_axes.cc
GIDI_regions1d.cc
GIDI_regions2d.cc
GIDI_styles.cc
GIDI_settings.cc
GIDI_settings_flux.cc
GIDI_settings_particle.cc
GIDI_suite.cc
GIDI_transportable.cc
GIDI_protare.cc
GIDI_misc.cc
GIDI_gridded3d.cc
GIDI_Legendre1d.cc
GIDI_URR_probabilityTables1d.cc
GIDI_Ys1d.cc
GIDI_arrays.cc
GIDI_branching1d.cc
GIDI_collapse.cc
GIDI_constant1d.cc
GIDI_GRIN_continuumGammas.cc
GIDI_misc1d.cc
GIDI_sums.cc
GIDI_table.cc
GIDI_map.cc
GIDI_form.cc
GIDI_XYs1d.cc
GIDI_GNDS_fileType.cc
GIDI_construction.cc
GIDI_delayedNeutron.cc
GIDI_discreteGamma2d.cc
GIDI_distributions.cc
GIDI_documentation_1_10.cc
GIDI_doubleDifferentialCrossSection.cc
GIDI_energyFunctions2d.cc
GIDI_exceptions.cc
GIDI_externalFile.cc
GIDI_externalFiles.cc
GIDI_fissionEnergyReleased.cc
GIDI_fissionFragmentData.cc
GIDI_flux.cc
GIDI_form.cc
GIDI_grid.cc
GIDI_gridded1d.cc
GIDI_product.cc
GIDI_gridded2d.cc
GIDI_gridded3d.cc
GIDI_group.cc
GIDI_isotropic2d.cc
GIDI_map.cc
GIDI_matrix.cc
GIDI_misc.cc
GIDI_misc1d.cc
GIDI_outputChannel.cc
GIDI_parseSuites.cc
GIDI_polynomial1d.cc
GIDI_primaryGamma2d.cc
GIDI_protareComposite.cc
GIDI_protareTNSL.cc
GIDI_recoil2d.cc
GIDI_reference1d.cc
GIDI_resonancesWithBackground1d.cc
GIDI_unspecified1d.cc
GIDI_xs_pdf_cdf1d.cc
GIDI_particleInfo.cc
GIDI_physicalQuantity.cc
GIDI_polynomial1d.cc
GIDI_primaryGamma2d.cc
GIDI_product.cc
GIDI_protare.cc
GIDI_protareComposite.cc
GIDI_styles.cc
GIDI_protareTNSL.cc
GIDI_reaction.cc
GIDI_matrix.cc
GIDI_vector.cc
GIDI_recoil2d.cc
GIDI_reference1d.cc
GIDI_regions1d.cc
GIDI_regions2d.cc
GIDI_resonancesWithBackground1d.cc
GIDI_settings.cc
GIDI_settings_flux.cc
GIDI_settings_group.cc
GIDI_settings_particle.cc
GIDI_suite.cc
GIDI_sums.cc
GIDI_table.cc
GIDI_targetInfo.cc
GIDI_transportable.cc
GIDI_unspecified1d.cc
GIDI_vector.cc
GIDI_xs_pdf_cdf1d.cc
GUPI_ancestry.cc
GUPI_documentation.cc
GUPI_entry.cc
GUPI_suite.cc
GUPI_text.cc
GUPI_ancestry.cc
HAPI_Data.cc
HAPI_Data_internal.cc
HAPI_File.cc
HAPI_HDFData.cc
HAPI_HDFDataManager.cc
HAPI_HDFFile.cc
HAPI_HDFNode.cc
HAPI_Node.cc
@@ -174,48 +176,47 @@ geant4_add_module(G4had_lend
HAPI_PugiXMLFile.cc
HAPI_PugiXMLNode.cc
HAPI_Text.cc
HAPI_HDFDataManager.cc
LUPI_misc.cc
LUPI_formatVersion.cc
LUPI_argumentParser.cc
LUPI_file.cc
LUPI_formatVersion.cc
LUPI_misc.cc
LUPI_statusMessageReporting.cc
LUPI_times.cc
LUPI_file.cc
MCGIDI_delayedNeutron.cc
MCGIDI_domainHash.cc
MCGIDI_string.cc
MCGIDI_functions.cc
MCGIDI_settings.cc
MCGIDI_heatedCrossSections.cc
MCGIDI_nuclideGammaBranching.cc
MCGIDI_product.cc
MCGIDI_distributions.cc
MCGIDI_URR.cc
MCGIDI_outputChannel.cc
MCGIDI_misc.cc
MCGIDI_protare.cc
MCGIDI_GRIN.cc
MCGIDI_reaction.cc
MCGIDI_protareTNSL.cc
MCGIDI_URR.cc
MCGIDI_delayedNeutron.cc
MCGIDI_distributions.cc
MCGIDI_domainHash.cc
MCGIDI_functions.cc
MCGIDI_heatedCrossSections.cc
MCGIDI_misc.cc
MCGIDI_nuclideGammaBranching.cc
MCGIDI_outputChannel.cc
MCGIDI_product.cc
MCGIDI_protare.cc
MCGIDI_protareComposite.cc
MCGIDI_protareTNSL.cc
MCGIDI_reaction.cc
MCGIDI_sampling.cc
MCGIDI_settings.cc
MCGIDI_string.cc
PoPI_alias.cc
PoPI_baryon.cc
PoPI_base.cc
PoPI_chemicalElement.cc
PoPI_database.cc
PoPI_decayData.cc
PoPI_gaugeBoson.cc
PoPI_intId.cc
PoPI_isotope.cc
PoPI_lepton.cc
PoPI_misc.cc
PoPI_nucleus.cc
PoPI_nuclide.cc
PoPI_nuclideGammaBranching.cc
PoPI_pq_suite.cc
PoPI_decayData.cc
PoPI_baryon.cc
PoPI_chemicalElement.cc
PoPI_database.cc
PoPI_gaugeBoson.cc
PoPI_lepton.cc
PoPI_particle.cc
PoPI_physicalQuantity.cc
PoPI_pq_suite.cc
PoPI_unorthodox.cc
RISI_read.cc)
@@ -362,7 +362,7 @@ G4GIDI_target *G4GIDI::readTarget( std::string const &a_lib_name, std::string co
MC.setThrowOnError( false );
MC.setSampleNonTransportingParticles( true );
MCGIDI::DomainHash domainHash( 4000, 1e-8, 10 );
std::set<int> reactionsToExclude;
std::set<size_t> reactionsToExclude;
GIDI::Transporting::Particles particles;
GIDI::Transporting::Particle neutron( PoPI::IDs::neutron );
@@ -372,7 +372,7 @@ G4GIDI_target *G4GIDI::readTarget( std::string const &a_lib_name, std::string co
temperatures1.push_back( temperatures[0] );
MCGIDI::Protare *MCGIDI_protare = MCGIDI::protareFromGIDIProtare( smr, *GIDI_protare, G4GIDI_pops, MC, particles, domainHash,
temperatures1, reactionsToExclude );
if( !smr.isOk( ) ) throw LUPI::Exception( smr.constructFullMessage( "G4GIDI::readTarget:" ) );
//if( !smr.isOk( ) ) throw LUPI::Exception( smr.constructFullMessage( "G4GIDI::readTarget:" ) );
G4GIDI_target *protare = new G4GIDI_target( G4GIDI_pops, domainHash, *GIDI_protare, MCGIDI_protare );
delete GIDI_protare;
@@ -39,6 +39,7 @@ G4GIDI_target::G4GIDI_target( PoPI::Database const &a_pops, MCGIDI::DomainHash c
m_MCGIDI_protare( a_MCGIDI_protare ),
m_target( a_GIDI_protare.target( ).ID( ) ),
m_fileName( a_GIDI_protare.fileName( ) ),
m_evaluation( a_GIDI_protare.evaluation( ) ),
m_targetZ( 0 ),
m_targetA( 0 ),
m_targetM( 0 ),
@@ -147,7 +148,7 @@ std::vector<channelID> *G4GIDI_target::getProductionChannelIDs( ) const {
double G4GIDI_target::getTotalCrossSectionAtE( double a_energy, double a_temperature ) const {
int hashIndex = m_domainHash.index( a_energy );
std::size_t hashIndex = m_domainHash.index( a_energy );
return( m_MCGIDI_protare->crossSection( m_URR_protareInfos, hashIndex, a_temperature, a_energy ) );
}
@@ -189,7 +190,7 @@ double G4GIDI_target::getOthersCrossSectionAtE( double a_energy, double a_temper
double G4GIDI_target::sumChannelCrossSectionAtE( std::vector<int> const &a_indices, double a_energy, double a_temperature ) const {
int hashIndex = m_domainHash.index( a_energy );
std::size_t hashIndex = m_domainHash.index( a_energy );
double crossSection = 0.0;
for( auto indexIter = a_indices.begin( ); indexIter != a_indices.end( ); ++indexIter ) {
@@ -291,9 +292,10 @@ std::vector<G4GIDI_Product> *G4GIDI_target::getFinalState( std::vector<int> cons
MCGIDI::Sampling::StdVectorProductHandler productHandler;
MCGIDI::Sampling::Input input( false, MCGIDI::Sampling::Upscatter::Model::none );
input.setTemperatureAndEnergy( a_temperature, a_energy );
MCGIDI::Reaction const *reaction = m_MCGIDI_protare->reaction( reactionIndex );
reaction->sampleProducts( m_MCGIDI_protare, a_energy, input, [&]() -> double { return a_rng( a_rngState ); },
reaction->sampleProducts( m_MCGIDI_protare, input, [&]() -> double { return a_rng( a_rngState ); },
[&] (MCGIDI::Sampling::Product &a_product) -> void { productHandler.push_back( a_product ); }, productHandler );
std::vector<G4GIDI_Product> *products = new std::vector<G4GIDI_Product>( productHandler.size( ) );
@@ -91,15 +91,20 @@ G4double G4LENDCrossSection::GetIsoCrossSection( const G4DynamicParticle* dp , G
if ( isotope != NULL ) iM = isotope->Getm();
G4GIDI_target* aTarget = get_target_from_map( lend_manager->GetNucleusEncoding( iZ , iA , iM ) );
if ( aTarget == NULL ) {
if ( aTarget != NULL ) {
xs = getLENDCrossSection ( aTarget , ke , temp );
}
else {
;
/*
G4String message;
message = this->GetName();
message += " is unexpectedly called.";
//G4Exception( "G4LEND::GetIsoCrossSection(,)" , "LENDCrossSection-01" , JustWarning ,
G4Exception( "G4LEND::GetIsoCrossSection(,)" , "LENDCrossSection-01" , FatalException ,
message );
*/
}
xs = getLENDCrossSection ( aTarget , ke , temp );
return xs;
}
@@ -124,7 +129,8 @@ G4LENDCrossSection::G4LENDCrossSection( const G4String nam )
//default_evaluation = "ENDF.B-VII.0";
//default_evaluation = "ENDF/BVII.1";
//default_evaluation = "ENDF/B-8.0";
default_evaluation = "ENDF/B-7.1";
//default_evaluation = "ENDF/B-7.1";
default_evaluation = "";
allow_nat = false;
allow_any = false;
@@ -58,7 +58,8 @@ G4LENDModel::G4LENDModel( G4String name )
//default_evaluation = "ENDF.B-VII.0";
//default_evaluation = "ENDF/BVII.1";
//default_evaluation = "ENDF/B-8.0";
default_evaluation = "ENDF/B-7.1";
//default_evaluation = "ENDF/B-7.1";
default_evaluation = "";
allow_nat = false;
allow_any = false;
@@ -53,7 +53,7 @@ void G4LENDUsedTarget::searchTarget()
actual_Z = wanted_Z;
actual_A = wanted_A;
actual_M = wanted_M;
actual_Evaluation = wanted_Evaluation;
actual_Evaluation = target->getEvaluation( )->c_str( );
return;
}
@@ -66,7 +66,7 @@ void G4LENDUsedTarget::searchTarget()
actual_Z = wanted_Z;
actual_A = 0;
actual_M = wanted_M;
actual_Evaluation = wanted_Evaluation;
actual_Evaluation = target->getEvaluation( )->c_str( );
return;
}
@@ -17,7 +17,7 @@
#else
typedef unsigned char XML_Bool;
typedef char XML_Char;
typedef void * XML_Parser;
typedef void *XML_Parser;
typedef void (*XML_StartElementHandler)( void *a_userData, XML_Char const *a_name, XML_Char const **a_atts );
typedef void (*XML_EndElementHandler)( void *a_userData, XML_Char const *a_name);
@@ -70,8 +70,8 @@ GNDS_FileTypeInfo::GNDS_FileTypeInfo( ) :
* @param a_interaction [in] The protare's interaction.
***********************************************************************************************************/
GNDS_FileTypeInfo::GNDS_FileTypeInfo( GNDS_FileType a_GNDS_fileType, std::string a_projectileID, std::string a_targetID, std::string a_evaluation,
std::string a_interaction ) :
GNDS_FileTypeInfo::GNDS_FileTypeInfo( GNDS_FileType a_GNDS_fileType, std::string const &a_projectileID,
std::string const &a_targetID, std::string const &a_evaluation, std::string const &a_interaction ) :
m_GNDS_fileType( a_GNDS_fileType ),
m_projectileID( a_projectileID ),
m_targetID( a_targetID ),
@@ -156,7 +156,7 @@ GNDS_FileType GNDS_fileType( std::string const &a_fileName, GNDS_FileTypeInfo &a
enum XML_Status status = XML_STATUS_ERROR; // Initialize to silence compiler warning
size_t count = 0;
while( ( count = fread( buffer, bufferSize, 1, fileDescriptor ) ) > 0 ) {
status = XML_Parse( xmlParser, buffer, count, 0 );
status = XML_Parse( xmlParser, buffer, (int) count, 0 );
if( status != XML_STATUS_OK ) break;
}
@@ -53,9 +53,9 @@ GRIN_continuumGammas::GRIN_continuumGammas( Construction::Settings const &a_cons
PoPI::Nuclide const &target = a_pops.get<PoPI::Nuclide>( a_setupInfo.m_protare->target( ).pid( ) );
std::string captureResidualId = target.isotope( )->chemicalElement( )->symbol( ) + std::to_string( target.A( ) + 1 );
PoPI::Nuclide const &captureResidual = a_pops.get<PoPI::Nuclide>( captureResidualId );
m_captureResidualId = captureResidualId;
m_captureResidualId = std::move( captureResidualId );
m_captureResidualIntid = captureResidual.intid( );
m_captureResidualIndex = captureResidual.index( );
m_captureResidualIndex = static_cast<int>( captureResidual.index( ) );
m_captureResidualMass = captureResidual.massValue( "MeV/c**2" );
}
@@ -128,7 +128,7 @@ XYs1d::XYs1d( Construction::Settings const &a_construction, HAPI::Node const &a_
nf_Buffer<double> vals;
parseValuesOfDoubles( a_construction, values, a_setupInfo, vals );
int primarySize = vals.size() / 2, secondarySize = 0;
int primarySize = static_cast<int>( vals.size() / 2 ), secondarySize = 0;
double *dvals = new double[vals.size()]; // Not sure we really need a copy here.
for( size_t idx = 0; idx < vals.size(); idx++ ) dvals[idx] = vals[idx];
m_ptwXY = ptwXY_create( NULL, interpolation( ), interpolationString( ).c_str( ), 12, 1e-3, primarySize, secondarySize, primarySize, dvals, 0 );
@@ -360,11 +360,11 @@ XYs1d &XYs1d::operator*=( XYs1d const &a_rhs ) {
std::vector<double> XYs1d::xs( ) const {
int64_t n1 = size( );
auto n1 = size( );
std::vector<double> _xs( n1, 0. );
for( int64_t i1 = 0; i1 < n1; ++i1 ) {
ptwXYPoint const *point = ptwXY_getPointAtIndex_Unsafely( m_ptwXY, i1 );
for( std::size_t i1 = 0; i1 < n1; ++i1 ) {
ptwXYPoint const *point = ptwXY_getPointAtIndex_Unsafely( m_ptwXY, static_cast<int64_t>( i1 ) );
_xs[i1] = point->x;
}
@@ -379,11 +379,11 @@ std::vector<double> XYs1d::xs( ) const {
std::vector<double> XYs1d::ys( ) const {
int64_t n1 = size( );
auto n1 = size( );
std::vector<double> _ys( n1, 0. );
for( int64_t i1 = 0; i1 < n1; ++i1 ) {
ptwXYPoint const *point = ptwXY_getPointAtIndex_Unsafely( m_ptwXY, i1 );
for( std::size_t i1 = 0; i1 < n1; ++i1 ) {
ptwXYPoint const *point = ptwXY_getPointAtIndex_Unsafely( m_ptwXY, static_cast<int64_t>( i1 ) );
_ys[i1] = point->y;
}
@@ -400,7 +400,7 @@ std::vector<double> XYs1d::ys( ) const {
std::vector<double> XYs1d::ysMappedToXs( std::vector<double> const &a_xs, std::size_t *a_offset ) const {
int64_t n1 = size( ), i2, n2 = a_xs.size( );
std::size_t n1 = size( ), i2, n2 = a_xs.size( );
std::vector<double> _ys;
*a_offset = 0;
@@ -411,8 +411,8 @@ std::vector<double> XYs1d::ysMappedToXs( std::vector<double> const &a_xs, std::s
*a_offset = i2;
if( i2 == n2 ) return( _ys );
for( int64_t i1 = 1; i1 < n1; ++i1 ) {
ptwXYPoint const *point2 = ptwXY_getPointAtIndex_Unsafely( m_ptwXY, i1 );
for( std::size_t i1 = 1; i1 < n1; ++i1 ) {
ptwXYPoint const *point2 = ptwXY_getPointAtIndex_Unsafely( m_ptwXY, static_cast<int64_t>( i1 ) );
while( i2 < n2 ) {
double x = a_xs[i2], y;
@@ -483,13 +483,13 @@ XYs1d XYs1d::domainSliceMax( double a_domainMax ) const {
double XYs1d::evaluate( double a_x1 ) const {
std::size_t length = ptwXY_length( nullptr, m_ptwXY );
std::size_t length = static_cast<std::size_t>( ptwXY_length( nullptr, m_ptwXY ) );
if( length == 0 ) throw Exception( "XYs1d::evaluate: XYs1d has no datum." );
ptwXYPoint *point = ptwXY_getPointAtIndex_Unsafely( m_ptwXY, 0 );
if( point->x >= a_x1 ) return( point->y );
point = ptwXY_getPointAtIndex_Unsafely( m_ptwXY, length - 1 );
point = ptwXY_getPointAtIndex_Unsafely( m_ptwXY, static_cast<int64_t>( length - 1 ) );
if( point->x <= a_x1 ) return( point->y );
double y;
@@ -508,15 +508,15 @@ double XYs1d::evaluate( double a_x1 ) const {
* @param a_scaleFactor [in] A factor applied to each evaluation before it is added to *a_results*.
***********************************************************************************************************/
void XYs1d::mapToXsAndAdd( int a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const {
void XYs1d::mapToXsAndAdd( std::size_t a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const {
if( a_Xs.size( ) != a_results.size( ) ) throw Exception( "XYs1d::mapToXsAndAdd: a_Xs.size( ) != a_results.size( )" );
if( a_offset < 0 ) throw Exception( "XYs1d::mapToXsAndAdd: a_offset < 0." );
LUPI::StatusMessageReporting smr;
int64_t length = static_cast<int64_t>( a_Xs.size( ) );
nfu_status status = ptwXY_mapToXsAndAdd( smr.smr( ), m_ptwXY, a_offset, length, a_Xs.data( ), a_results.data( ), a_scaleFactor );
nfu_status status = ptwXY_mapToXsAndAdd( smr.smr( ), m_ptwXY, static_cast<int64_t>( a_offset ), length,
a_Xs.data( ), a_results.data( ), a_scaleFactor );
if( ( status != nfu_Okay ) && ( status != nfu_tooFewPoints ) )
throw Exception( smr.constructMessage( "XYs1d::mapToXsAndAdd", -1, true ) );
}
@@ -605,8 +605,9 @@ Xs_pdf_cdf1d XYs1d::toXs_pdf_cdf1d( ) {
ptwXPoints *ptwX_cdf = ptwXY_runningIntegral( smr.smr( ), m_ptwXY );
if( ptwX_cdf == nullptr ) throw Exception( smr.constructMessage( "XYs1d::toXs_pdf_cdf1d", -1, true ) );
std::vector<double> cdf1( ptwX_cdf->length );
for( int64_t index = 0; index < ptwX_cdf->length; ++index ) cdf1[index] = ptwX_cdf->points[index];
std::size_t length = static_cast<std::size_t>( ptwX_cdf->length );
std::vector<double> cdf1( length );
for( std::size_t index = 0; index < length; ++index ) cdf1[index] = ptwX_cdf->points[index];
ptwX_free( ptwX_cdf );
return( Xs_pdf_cdf1d( GIDI::Axes( ), ptwXY_interpolationLinLin, xs1, pdf1, cdf1 ) );
@@ -119,7 +119,7 @@ double XYs2d::evaluate( double a_x2, double a_x1 ) const {
}
// Currently does not interpolate;
return( m_function1ds[iX2]->evaluate( a_x1 ) );
return( m_function1ds[static_cast<std::size_t>( iX2 )]->evaluate( a_x1 ) );
}
/* *********************************************************************************************************//**
@@ -121,7 +121,7 @@ double XYs3d::evaluate( double a_x3, double a_x2, double a_x1 ) const {
}
// Currently does not interpolate;
return( m_function2ds[iX3]->evaluate( a_x2, a_x1 ) );
return( m_function2ds[static_cast<std::size_t>(iX3)]->evaluate( a_x2, a_x1 ) );
}
/* *********************************************************************************************************//**
@@ -62,13 +62,13 @@ Ys1d::Ys1d( Axes const &a_axes, ptwXY_interpolation a_interpolation, std::size_t
Ys1d::Ys1d( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, Suite *a_parent ) :
Function1dForm( a_construction, a_node, a_setupInfo, FormType::Ys1d, a_parent ),
m_start( a_node.child( "values" ).attribute( "start" ).as_int( ) ), // as_int returns 0 if "start" not present.
m_start( static_cast<std::size_t>( a_node.child( GIDI_valuesChars ).attribute( GIDI_startChars ).as_int( ) ) ), // as_int returns 0 if "start" not present.
m_Ys( ) {
HAPI::Node values = a_node.child("values");
HAPI::Node values = a_node.child( GIDI_valuesChars );
nf_Buffer<double> data;
parseValuesOfDoubles( a_construction, values, a_setupInfo, data );
m_Ys.resize( (long) data.size() );
m_Ys.resize( data.size() );
for( size_t i1 = 0; i1 < data.size(); ++i1 ) m_Ys[i1] = data[i1];
}
@@ -119,15 +119,15 @@ Ys1d &Ys1d::operator+=( Ys1d const &a_rhs ) {
if( length( ) == 0 ) m_start = a_rhs.length( ); // Allow for empty (uninitialized) this.
if( length( ) != a_rhs.length( ) ) throw Exception( "Ys1d::operator+=: lengths not equal." );
long deltaStart = (long) a_rhs.start( );
deltaStart -= (long) m_start;
if( deltaStart >= 0 ) {
if( a_rhs.start( ) >= m_start ) {
std::size_t deltaStart = a_rhs.start( ) - m_start;
for( std::size_t i1 = 0; i1 < a_rhs.size( ); ++i1 ) m_Ys[i1+deltaStart] += a_rhs[i1]; }
else {
std::size_t deltaStart = m_start - a_rhs.start( );
std::vector<double> _Ys( a_rhs.Ys( ) );
for( std::size_t i1 = 0; i1 < size( ); ++i1 ) _Ys[i1-deltaStart] += m_Ys[i1];
m_Ys = _Ys;
for( std::size_t i1 = 0; i1 < size( ); ++i1 ) _Ys[i1+deltaStart] += m_Ys[i1];
m_Ys = std::move( _Ys );
m_start = a_rhs.start( );
}
return( *this );
@@ -208,8 +208,8 @@ void Ys1d::toXMLList_func( GUPI::WriteInfo &a_writeInfo, std::string const &a_in
void Ys1d::write( FILE *a_file, std::string const &a_format ) const {
long size = static_cast<long>( m_Ys.size( ) );
for( long index = 0; index < size; ++index ) fprintf( a_file, a_format.c_str( ), index + m_start, m_Ys[index] );
std::size_t size = m_Ys.size( );
for( std::size_t index = 0; index < size; ++index ) fprintf( a_file, a_format.c_str( ), index + m_start, m_Ys[index] );
}
} // End namespace Functions.
@@ -46,10 +46,10 @@ Array3d::~Array3d( ) {
* @param a_maxTNSL_index [in] All elements up to "row" *a_maxTNSL_index* exclusive are zero-ed.
***********************************************************************************************************/
void Array3d::modifiedMultiGroupElasticForTNSL( int a_maxTNSL_index ) {
void Array3d::modifiedMultiGroupElasticForTNSL( std::size_t a_maxTNSL_index ) {
std::vector<int> const &m_shape = m_array.shape( );
int maxFlatIndex = a_maxTNSL_index * m_shape[1] * m_shape[2];
auto const &m_shape = m_array.shape( );
std::size_t maxFlatIndex = a_maxTNSL_index * m_shape[1] * m_shape[2];
m_array.setToValueInFlatRange( 0, maxFlatIndex, 0.0 );
}
@@ -70,13 +70,15 @@ Matrix Array3d::matrix( std::size_t a_index ) const {
return( matrix );
}
std::size_t numberOfOrders = m_array.m_shape[2], rows = m_array.m_shape[0], columns = m_array.m_shape[1];
std::size_t numberOfOrders = static_cast<std::size_t>( m_array.m_shape[2] );
std::size_t rows = static_cast<std::size_t>( m_array.m_shape[0] );
std::size_t columns = static_cast<std::size_t>( m_array.m_shape[1] );
Matrix matrix( rows, columns );
std::size_t lengthSum = 0;
for( std::size_t i1 = 0; i1 < m_array.m_numberOfStarts; ++i1 ) {
std::size_t start = m_array.m_starts[i1];
std::size_t length = m_array.m_lengths[i1];
std::size_t start = static_cast<std::size_t>( m_array.m_starts[i1] );
std::size_t length = static_cast<std::size_t>( m_array.m_lengths[i1] );
std::size_t energyInIndex = start / ( numberOfOrders * columns );
std::size_t energyOutIndex = start % ( numberOfOrders * columns );
@@ -25,17 +25,14 @@ namespace Array {
* @return Returns a *std::vector<int>* of the shape.
***********************************************************************************************************/
static std::vector<int> parseArrayShape( HAPI::Node const &a_node ) {
static std::vector<std::size_t> parseArrayShape( HAPI::Node const &a_node ) {
std::string shape = a_node.attribute_as_string( GIDI_shapeChars );
std::vector<int> shapeInts;
std::vector<std::size_t> shapeInts;
long numberOfDimensions = (long) std::count( shape.begin( ), shape.end( ), ',' ) + 1, prior = 0, next;
while( --numberOfDimensions >= 0 ) {
next = shape.find( ",", prior );
std::string value( shape.substr( prior, next - prior ) );
prior = next + 1;
shapeInts.push_back( atoi( value.c_str( ) ) );
auto shapeItems = LUPI::Misc::splitString( shape, ',', true );
for( auto iter = shapeItems.begin( ); iter != shapeItems.end( ); ++iter ) {
shapeInts.push_back( static_cast<std::size_t>( atoi( (*iter).c_str( ) ) ) );
}
return( shapeInts );
@@ -53,7 +50,7 @@ static std::vector<int> parseArrayShape( HAPI::Node const &a_node ) {
* @param a_shape [in] The shape of the full array.
***********************************************************************************************************/
FullArray::FullArray( std::vector<int> a_shape ) :
FullArray::FullArray( std::vector<std::size_t> const &a_shape ) :
m_shape( a_shape ) {
std::size_t size = 1;
@@ -68,7 +65,7 @@ FullArray::FullArray( std::vector<int> a_shape ) :
* @param a_flattenedValues [in] The values of the array. Its size must be the same has that specified by *a_shape*.
***********************************************************************************************************/
FullArray::FullArray( std::vector<int> a_shape, std::vector<double> a_flattenedValues ) :
FullArray::FullArray( std::vector<std::size_t> const &a_shape, std::vector<double> const &a_flattenedValues ) :
m_shape( a_shape ) {
std::size_t size = 1;
@@ -169,12 +166,12 @@ FullArray Array::constructArray( ) const {
else if( m_compression == GIDI_diagonalChars ) {
throw Exception( "Array::constructArray: compression '" + m_compression + "' not supported." ); }
else if( m_compression == GIDI_flattenedChars ) {
int index = 0;
std::size_t index = 0;
for( std::size_t index1 = 0; index1 < m_starts.size( ); ++index1 ) {
int length = m_length[index1];
int start = m_starts[index1];
std::size_t length = static_cast<std::size_t>( m_length[index1] );
std::size_t start = static_cast<std::size_t>( m_starts[index1] );
for( int index2 = 0; index2 < length; ++index2, ++index ) values[start+index2] = m_values[index];
for( std::size_t index2 = 0; index2 < length; ++index2, ++index ) values[start+index2] = m_values[index];
} }
else {
throw Exception( "Array::constructArray: compression '" + m_compression + "' not supported." );
@@ -247,15 +244,10 @@ FlattenedArrayData::FlattenedArrayData( HAPI::Node const &a_node, SetupInfo &a_s
bool m_dValuesPresent( false );
std::string shape( a_node.attribute_as_string( GIDI_shapeChars ) );
long numberOfDimensions = (long) std::count( shape.begin( ), shape.end( ), ',' ), prior = 0, next;
while( --numberOfDimensions >= 0 ) {
next = shape.find( ",", prior );
std::string value( shape.substr( prior, next - prior ) );
prior = next + 1;
m_shape.push_back( atoi( value.c_str( ) ) );
auto shapeItems = LUPI::Misc::splitString( shape, ',', true );
for( auto iter = shapeItems.begin( ); iter != shapeItems.end( ); ++iter ) {
m_shape.push_back( static_cast<std::size_t>( atoi( (*iter).c_str( ) ) ) );
}
std::string value( shape.substr( prior ) );
m_shape.push_back( atoi( value.c_str( ) ) );
if( a_dimensions != (int) m_shape.size( ) ) throw Exception( "a_dimensions != m_shape.size( )" );
@@ -303,19 +295,21 @@ FlattenedArrayData::~FlattenedArrayData( ) {
* @param a_value [in] The value to set each double in the range to.
***********************************************************************************************************/
void FlattenedArrayData::setToValueInFlatRange( LUPI_maybeUnused int a_start, int a_end, LUPI_maybeUnused double a_value ) {
void FlattenedArrayData::setToValueInFlatRange( LUPI_maybeUnused std::size_t a_start, std::size_t a_end, LUPI_maybeUnused double a_value ) {
int size = 1;
std::size_t size = 1;
for( auto iter = m_shape.begin( ); iter != m_shape.end( ); ++iter ) size *= *iter;
a_end = std::min( a_end, size );
long numberOfValuesToSet = 0;
for( std::size_t startIndex = 0; startIndex < m_numberOfStarts; ++startIndex ) {
long start = m_starts[startIndex];
long length = m_lengths[startIndex];
std::size_t start = static_cast<std::size_t>( m_starts[startIndex] );
std::size_t length = static_cast<std::size_t>( m_lengths[startIndex] );
if( ( start + length ) > a_end ) length = a_end - start;
if( length < 0 ) break;
if( ( start + length ) > a_end ) {
if( a_end < start ) break;
length = a_end - start;
}
numberOfValuesToSet += length;
}
@@ -337,7 +331,7 @@ void FlattenedArrayData::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string co
std::string shapeString;
std::string sep = "";
for( std::size_t i1 = 0; i1 < m_shape.size( ); ++i1 ) {
shapeString += sep + intToString( m_shape[i1] );
shapeString += sep + intToString( static_cast<int>( m_shape[i1] ) );
sep = ",";
}
@@ -25,7 +25,7 @@ namespace GIDI {
* @param a_type [in] The **type** is either *"axis"* or *"grid"*.
***********************************************************************************************************/
Axis::Axis( int a_index, std::string a_label, std::string a_unit, FormType a_type ) :
Axis::Axis( int a_index, std::string const &a_label, std::string const &a_unit, FormType a_type ) :
Form( GIDI_axisChars, a_type, a_label ),
m_index( a_index ),
m_unit( a_unit ) {
@@ -11,7 +11,7 @@
namespace GIDI {
static Vector collapseVector( Vector const &a_vector, std::vector<int> const &a_collapseIndices,
static Vector collapseVector( Vector const &a_vector, std::vector<std::size_t> const &a_collapseIndices,
std::vector<double> const &a_weight, bool a_normalize );
static void multiGroupSetup( Transporting::MultiGroup const &a_boundaries, ptwXPoints **a_boundaries_xs,
Transporting::Flux const &a_flux, ptwXYPoints **a_fluxes_xys, ptwXPoints **a_multiGroupFlux );
@@ -32,7 +32,7 @@ Vector collapse( Vector const &a_vector, Transporting::Settings const &a_setting
Transporting::Particle const *projectile( a_particles.particle( a_settings.projectileID( ) ) );
Transporting::ProcessedFlux const *flux( projectile->nearestProcessedFluxToTemperature( a_temperature ) );
std::vector<double> const &multiGroupFlux( flux->multiGroupFlux( ) );
std::vector<int> const &collapseIndices( projectile->collapseIndices( ) );
std::vector<std::size_t> const &collapseIndices( projectile->collapseIndices( ) );
return( collapseVector( a_vector, collapseIndices, multiGroupFlux, true ) );
}
@@ -47,7 +47,7 @@ Vector collapse( Vector const &a_vector, Transporting::Settings const &a_setting
* @return Returns the collapsed Vector.
***********************************************************************************************************/
static Vector collapseVector( Vector const &a_vector, std::vector<int> const &a_collapseIndices,
static Vector collapseVector( Vector const &a_vector, std::vector<std::size_t> const &a_collapseIndices,
std::vector<double> const &a_weight, bool a_normalize ) {
std::size_t n1( a_collapseIndices.size( ) - 1 );
@@ -91,12 +91,12 @@ Matrix collapse( Matrix const &a_matrix, Transporting::Settings const &a_setting
Transporting::Particle const *projectile( a_particles.particle( a_settings.projectileID( ) ) );
Transporting::ProcessedFlux const *flux( projectile->nearestProcessedFluxToTemperature( a_temperature ) );
std::vector<double> const &multiGroupFlux( flux->multiGroupFlux( ) );
std::vector<int> const &projectileCollapseIndices( projectile->collapseIndices( ) );
std::vector<std::size_t> const &projectileCollapseIndices( projectile->collapseIndices( ) );
Transporting::Particle const *product( a_particles.particle( a_productID ) );
std::size_t n2 = product->numberOfGroups( );
std::vector<int> productCollapseIndices( product->collapseIndices( ) );
std::vector<std::size_t> productCollapseIndices( product->collapseIndices( ) );
productCollapseIndices[0] = 0;
productCollapseIndices[n2] = a_matrix[0].size( );
@@ -214,14 +214,15 @@ MultiGroupCalulationInformation::~MultiGroupCalulationInformation( ) {
Vector multiGroupXYs1d( Transporting::MultiGroup const &a_boundaries, Functions::XYs1d const &a_function, Transporting::Flux const &a_flux ) {
std::vector<double> const &boundaries = a_boundaries.boundaries( );
ptwXPoints *boundaries_xs = ptwX_create( nullptr, boundaries.size( ), boundaries.size( ), &(boundaries[0]) );
int64_t boundariesSize = static_cast<int64_t>( boundaries.size( ) );
ptwXPoints *boundaries_xs = ptwX_create( nullptr, boundariesSize, boundariesSize, &(boundaries[0]) );
if( boundaries_xs == nullptr ) throw Exception( "GIDI::multiGroup: ptwX_create failed." );
Transporting::Flux_order const &flux_order_0 = a_flux[0];
double const *energies = flux_order_0.energies( );
double const *fluxes = flux_order_0.fluxes( );
ptwXYPoints *fluxes_xys = ptwXY_createFrom_Xs_Ys( nullptr, ptwXY_interpolationLinLin, ptwXY_interpolationToString( ptwXY_interpolationLinLin ),
12, 1e-3, flux_order_0.size( ), 10, flux_order_0.size( ), energies, fluxes, 0 );
12, 1e-3, static_cast<int64_t>( flux_order_0.size( ) ), 10, static_cast<int64_t>( flux_order_0.size( ) ), energies, fluxes, 0 );
if( fluxes_xys == nullptr ) {
ptwX_free( boundaries_xs );
throw Exception( "GIDI::multiGroup: ptwXY_createFrom_Xs_Ys failed." );
@@ -246,7 +247,7 @@ Vector multiGroupXYs1d( Transporting::MultiGroup const &a_boundaries, Functions:
ptwXY_free( ptwXY );
if( groups == nullptr ) throw Exception( "GIDI::multiGroup: ptwXY_groupTwoFunctions failed." );
Vector vector( ptwX_length( nullptr, groups ), ptwX_getPointAtIndex( nullptr, groups, 0 ) );
Vector vector( static_cast<std::size_t>( ptwX_length( nullptr, groups ) ), ptwX_getPointAtIndex( nullptr, groups, 0 ) );
ptwX_free( groups );
return( vector );
@@ -306,7 +307,7 @@ Vector *multiGroupTwoXYs1ds( MultiGroupCalulationInformation const &a_multiGroup
throw Exception( errorMessage );
}
Vector *vector = new Vector( ptwX_length( smr, groups ), ptwX_getPointAtIndex( smr, groups, 0 ) );
Vector *vector = new Vector( static_cast<std::size_t>( ptwX_length( smr, groups ) ), ptwX_getPointAtIndex( smr, groups, 0 ) );
ptwX_free( groups );
return( vector );
@@ -327,14 +328,15 @@ static void multiGroupSetup( Transporting::MultiGroup const &a_boundaries, ptwXP
Transporting::Flux const &a_flux, ptwXYPoints **a_fluxes_xys, ptwXPoints **a_multiGroupFlux ) {
std::vector<double> const &boundaries = a_boundaries.boundaries( );
*a_boundaries_xs = ptwX_create( nullptr, boundaries.size( ), boundaries.size( ), &(boundaries[0]) );
int64_t boundariesSize = static_cast<int64_t>( boundaries.size( ) );
*a_boundaries_xs = ptwX_create( nullptr, boundariesSize, boundariesSize, &(boundaries[0]) );
if( *a_boundaries_xs == nullptr ) throw Exception( "GIDI::multiGroup: ptwX_create failed." );
Transporting::Flux_order const &flux_order_0 = a_flux[0];
double const *energies = flux_order_0.energies( );
double const *fluxes = flux_order_0.fluxes( );
*a_fluxes_xys = ptwXY_createFrom_Xs_Ys( nullptr, ptwXY_interpolationLinLin, ptwXY_interpolationToString( ptwXY_interpolationLinLin ),
12, 1e-3, flux_order_0.size( ), 10, flux_order_0.size( ), energies, fluxes, 0 );
12, 1e-3, static_cast<int64_t>( flux_order_0.size( ) ), 10, static_cast<int64_t>( flux_order_0.size( ) ), energies, fluxes, 0 );
if( *a_fluxes_xys == nullptr ) {
*a_boundaries_xs = ptwX_free( *a_boundaries_xs );
throw Exception( "GIDI::multiGroup: ptwXY_createFrom_Xs_Ys failed." );
@@ -82,10 +82,9 @@ double Constant1d::evaluate( LUPI_maybeUnused double a_x1 ) const {
* @param a_scaleFactor [in] A factor applied to each evaluation before it is added to *a_results*.
***********************************************************************************************************/
void Constant1d::mapToXsAndAdd( int a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const {
void Constant1d::mapToXsAndAdd( std::size_t a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const {
if( a_Xs.size( ) != a_results.size( ) ) throw Exception( "Constant1d::mapToXsAndAdd: a_Xs.size( ) != a_results.size( )." );
if( a_offset < 0 ) throw Exception( "Constant1d::mapToXsAndAdd: a_offset < 0." );
for( std::size_t index = a_offset; index < a_Xs.size( ); ++index ) {
a_results[index] += a_scaleFactor * m_value;
@@ -153,7 +153,8 @@ Vector DelayedNeutron::multiGroupMultiplicity( LUPI::StatusMessageReporting &a_s
***********************************************************************************************************/
Matrix DelayedNeutron::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID, int a_order ) const {
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID,
std::size_t a_order ) const {
return( m_product.multiGroupProductMatrix( a_smr, a_settings, a_temperatureInfo, a_particles, a_productID, a_order ) );
}
@@ -237,7 +238,7 @@ void DelayedNeutron::continuousEnergyProductData( Transporting::Settings const &
***********************************************************************************************************/
void DelayedNeutron::mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
std::vector<double> const &a_energies, int a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const {
m_product.mapContinuousEnergyProductData( a_settings, a_particleID, a_energies, a_offset, a_productEnergies, a_productMomenta,
@@ -16,7 +16,7 @@ namespace ExternalFiles {
/*!
* loop over external files, if any represent binary store then open up HAPI::DataManager for that file
*/
void Suite::registerBinaryFiles( LUPI_maybeUnused std::string a_parentDir, LUPI_maybeUnused SetupInfo &a_setupInfo ) {
void Suite::registerBinaryFiles( LUPI_maybeUnused std::string const &a_parentDir, LUPI_maybeUnused SetupInfo &a_setupInfo ) {
#ifdef HAPI_USE_HDF5
if (this->has( "HDF" )) {
@@ -72,11 +72,13 @@ Vector FissionEnergyRelease::multiGroupQ( LUPI_maybeUnused LUPI::StatusMessageRe
if( a_settings.delayedNeutrons( ) == Transporting::DelayedNeutrons::on ) {
Gridded1d const *gridded1d = dynamic_cast<Gridded1d const *>( m_delayedNeutronKE );
vector += gridded1d->data( );
if( gridded1d != nullptr ) vector += gridded1d->data( );
gridded1d = dynamic_cast<Gridded1d const *>( m_delayedGammaEnergy );
vector += gridded1d->data( );
if( gridded1d != nullptr ) vector += gridded1d->data( );
gridded1d = dynamic_cast<Gridded1d const *>( m_delayedBetaEnergy );
vector += gridded1d->data( );
if( gridded1d != nullptr ) vector += gridded1d->data( );
}
return( vector );
@@ -52,7 +52,7 @@ FissionFragmentData::FissionFragmentData( Construction::Settings const &a_constr
for( std::size_t i1 = 0; i1 < m_delayedNeutrons.size( ); ++i1 ) {
DelayedNeutron *delayedNeutron = m_delayedNeutrons.get<DelayedNeutron>( i1 );
delayedNeutron->setDelayedNeutronIndex( i1 );
delayedNeutron->setDelayedNeutronIndex( static_cast<int>( i1 ) );
}
}
@@ -253,7 +253,8 @@ Vector FissionFragmentData::multiGroupQ( LUPI::StatusMessageReporting &a_smr, Tr
***********************************************************************************************************/
Matrix FissionFragmentData::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID, int a_order ) const {
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID,
std::size_t a_order ) const {
Matrix matrix( 0, 0 );
@@ -395,8 +396,7 @@ void FissionFragmentData::continuousEnergyProductData( Transporting::Settings co
***********************************************************************************************************/
void FissionFragmentData::mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
std::vector<double> const &a_energies, int a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const {
if( a_settings.delayedNeutrons( ) != Transporting::DelayedNeutrons::on ) return;
@@ -421,7 +421,7 @@ Function1dForm &Function1dForm::operator=( Function1dForm const &a_rhs ) {
* @param a_scaleFactor [in] A factor applied to each evaluation before it is added to *a_results*.
***********************************************************************************************************/
void Function1dForm::mapToXsAndAdd( LUPI_maybeUnused int a_offset, LUPI_maybeUnused std::vector<double> const &a_Xs, LUPI_maybeUnused std::vector<double> &a_results, LUPI_maybeUnused double a_scaleFactor ) const {
void Function1dForm::mapToXsAndAdd( LUPI_maybeUnused std::size_t a_offset, LUPI_maybeUnused std::vector<double> const &a_Xs, LUPI_maybeUnused std::vector<double> &a_results, LUPI_maybeUnused double a_scaleFactor ) const {
throw Exception( "Function1dForm::mapToXsAndAdd: function " + moniker( ) + " not implemented." );
}
@@ -49,7 +49,7 @@ Gridded1d::~Gridded1d( ) {
* @param a_maxTNSL_index [in] All elements up to *a_maxTNSL_index* exclusive are zero-ed.
***********************************************************************************************************/
void Gridded1d::modifiedMultiGroupElasticForTNSL( int a_maxTNSL_index ) {
void Gridded1d::modifiedMultiGroupElasticForTNSL( std::size_t a_maxTNSL_index ) {
m_data.setToValueInFlatRange( 0, a_maxTNSL_index, 0.0 );
}
@@ -46,7 +46,7 @@ Gridded3d::~Gridded3d( ) {
* @param a_maxTNSL_index [in] All elements up to *a_maxTNSL_index* exclusive are zero-ed.
***********************************************************************************************************/
void Gridded3d::modifiedMultiGroupElasticForTNSL( LUPI_maybeUnused int a_maxTNSL_index ) {
void Gridded3d::modifiedMultiGroupElasticForTNSL( LUPI_maybeUnused std::size_t a_maxTNSL_index ) {
}
@@ -756,13 +756,13 @@ std::vector<std::string> Map::availableEvaluations( std::string const &a_project
for( std::vector<BaseEntry *>::const_iterator iter1 = m_entries.begin( ); iter1 != m_entries.end( ); ++iter1 ) {
if( (*iter1)->name( ) == GIDI_importChars ) {
Import *_mapEntry = dynamic_cast<Import *> (*iter1);
Import *_mapEntry = static_cast<Import *> (*iter1);
std::vector<std::string> sub_list = _mapEntry->availableEvaluations( a_projectileID, a_targetID );
for( std::vector<std::string>::const_iterator iter2 = sub_list.begin( ); iter2 != sub_list.end( ); ++iter2 )
list.push_back( *iter2 ); }
else {
ProtareBase *protareEntry = dynamic_cast<ProtareBase *> (*iter1);
ProtareBase *protareEntry = static_cast<ProtareBase *> (*iter1);
if( protareEntry->isMatch( a_projectileID, a_targetID ) ) list.push_back( protareEntry->evaluation( ) );
}
@@ -34,8 +34,8 @@ long binarySearchVector( double a_x, std::vector<double> const &a_Xs ) {
/*
* Returns -2 is a_x < first point of a_Xs, -1 if > last point of a_Xs, and the lower index of a_Xs otherwise.
*/
long size = a_Xs.size( );
long imin = 0, imid, imax = size - 1;
std::size_t size = a_Xs.size( );
std::size_t imin = 0, imid, imax = size - 1;
if( a_x < a_Xs[0] ) return( -2 );
if( a_x > a_Xs[size-1] ) return( -1 );
@@ -48,7 +48,7 @@ long binarySearchVector( double a_x, std::vector<double> const &a_Xs ) {
imin = imid;
}
}
return( imin );
return( static_cast<long>( imin ) );
}
/* *********************************************************************************************************//**
@@ -60,7 +60,7 @@ long binarySearchVector( double a_x, std::vector<double> const &a_Xs ) {
* @param a_attributes [in] String representation of the attributes for the GNDS **values** node.
***********************************************************************************************************/
void intsToXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector<int> a_values, std::string const &a_attributes ) {
void intsToXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector<int> const &a_values, std::string const &a_attributes ) {
a_writeInfo.addNodeStarter( a_indent, GIDI_valuesChars, a_attributes );
@@ -106,7 +106,7 @@ void parseValuesOfDoubles( HAPI::Node const &a_node, SetupInfo &a_setupInfo, nf_
if( href != "" ) {
std::size_t startIndex = startIndexAttribute( a_node );
std::size_t count = a_node.attribute_as_long( GIDI_countChars );
std::size_t count = static_cast<std::size_t>( a_node.attribute_as_long( GIDI_countChars ) );
if( a_setupInfo.m_protare->dataManager( ) == nullptr )
throw Exception( "parseValuesOfDoubles: Cannot read from HDF5 file as GIDI+ was compiled without HDF5 support." );
a_setupInfo.m_protare->dataManager( )->getDoubles( a_values, startIndex, startIndex + count ); }
@@ -149,7 +149,7 @@ void parseValuesOfInts( HAPI::Node const &a_node, SetupInfo &a_setupInfo, nf_Buf
if( href != "" ) {
std::size_t startIndex = startIndexAttribute( a_node );
std::size_t count = a_node.attribute_as_long( GIDI_countChars );
std::size_t count = static_cast<std::size_t>( a_node.attribute_as_long( GIDI_countChars ) );
if( a_setupInfo.m_protare->dataManager( ) == nullptr )
throw Exception( "parseValuesOfInts: Cannot read from HDF5 file as GIDI+ was compiled without HDF5 support." );
a_setupInfo.m_protare->dataManager( )->getInts( a_values, startIndex, startIndex + count ); }
@@ -177,7 +177,7 @@ void parseValuesOfInts( HAPI::Node const &a_node, SetupInfo &a_setupInfo, nf_Buf
* @param a_valueType [in] The value for the *valueType* attribute.
***********************************************************************************************************/
void doublesToXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector<double> a_values, std::size_t a_start, bool a_newLine, std::string const &a_valueType ) {
void doublesToXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent, std::vector<double> const &a_values, std::size_t a_start, bool a_newLine, std::string const &a_valueType ) {
int valuesPerLine( a_writeInfo.m_valuesPerLine );
std::string indent( a_indent );
@@ -458,16 +458,17 @@ void energy2dToXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_monik
* @return returns the startIndex attribute of *a_node*.
***********************************************************************************************************/
void excludeReactionsSetAdjust( ExcludeReactionsSet a_excludeReactionsSet, Protare const &a_protare ) {
void excludeReactionsSetAdjust( ExcludeReactionsSet &a_excludeReactionsSet, Protare const &a_protare ) {
ExcludeReactionsSet excludeReactionsSet;
for( auto iter = a_excludeReactionsSet.begin( ); iter != a_excludeReactionsSet.end( ); ++iter ) {
int index = (*iter) - a_protare.numberOfReactions( );
if( index > -1 ) excludeReactionsSet.insert( index );
if( (*iter) >= a_protare.numberOfReactions( ) ) {
excludeReactionsSet.insert( (*iter) - a_protare.numberOfReactions( ) );
}
}
a_excludeReactionsSet = excludeReactionsSet;
a_excludeReactionsSet = std::move( excludeReactionsSet );
}
/* *********************************************************************************************************//**
@@ -484,10 +485,10 @@ static std::size_t startIndexAttribute( HAPI::Node const &a_node ) {
std::string attribute = a_node.attribute_as_string( GIDI_startIndexChars );
if( attribute != "" ) {
startIndex = a_node.attribute_as_long( GIDI_startIndexChars ); }
startIndex = static_cast<std::size_t>( a_node.attribute_as_long( GIDI_startIndexChars ) ); }
else {
attribute = a_node.attribute_as_string( GIDI_offsetChars );
if( attribute != "" ) startIndex = a_node.attribute_as_long( GIDI_offsetChars );
if( attribute != "" ) startIndex = static_cast<std::size_t>( a_node.attribute_as_long( GIDI_offsetChars ) );
}
return( startIndex );
@@ -16,7 +16,7 @@ namespace GIDI {
* This class represents a **GNDS** outputChannel.
*/
OutputChannel::OutputChannel( bool a_twoBody, bool a_fissions, std::string a_process ) :
OutputChannel::OutputChannel( bool a_twoBody, bool a_fissions, std::string const &a_process ) :
GUPI::Ancestry( GIDI_outputChannelChars ),
m_twoBody( a_twoBody ),
m_fissions( a_fissions ),
@@ -119,7 +119,7 @@ bool OutputChannel::areAllProductsTracked( Transporting::Particles const &a_part
* for the TNSL data for that boundary.
***********************************************************************************************************/
void OutputChannel::modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> a_maximumTNSL_MultiGroupIndex ) {
void OutputChannel::modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> const &a_maximumTNSL_MultiGroupIndex ) {
// No need to fix m_Q as it is all 0.0's for elastic scattering.
for( auto iter = m_products.begin( ); iter != m_products.end( ); ++iter ) {
@@ -373,7 +373,8 @@ Vector OutputChannel::multiGroupQ( LUPI::StatusMessageReporting &a_smr, Transpor
***********************************************************************************************************/
Matrix OutputChannel::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID, int a_order ) const {
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID,
std::size_t a_order ) const {
Matrix matrix( 0, 0 );
@@ -500,7 +501,7 @@ void OutputChannel::continuousEnergyProductData( Transporting::Settings const &a
***********************************************************************************************************/
void OutputChannel::mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
std::vector<double> const &a_energies, int a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const {
for( std::size_t index = 0; index < m_products.size( ); ++index ) {
@@ -216,7 +216,7 @@ Form *parseReactionType( std::string const &a_moniker, Construction::Settings co
Form *form = nullptr;
if( a_name == a_moniker ) {
Protare const &protare( *dynamic_cast<Protare const *>( a_parent->root( ) ) );
Protare const &protare( *static_cast<Protare const *>( a_parent->root( ) ) );
form = new Reaction( a_construction, a_node, a_setupInfo, a_pops, a_internalPoPs, protare, a_styles ); }
else { // This should never happend.
std::cout << "parseReactionType: Ignoring '" << a_moniker << "' unsupported form '" << a_name << "'." << std::endl;
@@ -36,7 +36,7 @@ PhysicalQuantity::PhysicalQuantity( HAPI::Node const &a_node, SetupInfo &a_setup
* @param a_unit [in] The physical quantity's unit.
***********************************************************************************************************/
PhysicalQuantity::PhysicalQuantity( double a_value, std::string a_unit ) :
PhysicalQuantity::PhysicalQuantity( double a_value, std::string const &a_unit ) :
Form( FormType::physicalQuantity ),
m_value( a_value ),
m_unit( a_unit ) {
@@ -123,12 +123,11 @@ double Polynomial1d::evaluate( double a_x1 ) const {
* @param a_scaleFactor [in] A factor applied to each evaluation before it is added to *a_results*.
***********************************************************************************************************/
void Polynomial1d::mapToXsAndAdd( int a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const {
void Polynomial1d::mapToXsAndAdd( std::size_t a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const {
if( a_Xs.size( ) != a_results.size( ) ) throw Exception( "Constant1d::mapToXsAndAdd: a_Xs.size( ) != a_results.size( )." );
if( a_offset < 0 ) throw Exception( "Constant1d::mapToXsAndAdd: a_offset < 0." );
int index = 0;
std::size_t index = 0;
auto XsIter = a_Xs.begin( );
for( ; XsIter != a_Xs.end( ); ++XsIter, ++index ) {
@@ -134,7 +134,7 @@ int Product::depth( ) const {
* for the TNSL data for that boundary.
***********************************************************************************************************/
void Product::modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> a_maximumTNSL_MultiGroupIndex ) {
void Product::modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> const &a_maximumTNSL_MultiGroupIndex ) {
m_multiplicity.modifiedMultiGroupElasticForTNSL( a_maximumTNSL_MultiGroupIndex );
m_distribution.modifiedMultiGroupElasticForTNSL( a_maximumTNSL_MultiGroupIndex );
@@ -283,7 +283,7 @@ int Product::maximumLegendreOrder( LUPI::StatusMessageReporting &a_smr, Transpor
if( form != nullptr ) {
Functions::Gridded3d const &gdata = form->data( );
Array3d const &data = gdata.data( );
_maximumLegendreOrder = data.size( ) - 1;
_maximumLegendreOrder = static_cast<int>( data.size( ) ) - 1;
}
} }
else {
@@ -362,7 +362,8 @@ Vector Product::multiGroupQ( LUPI::StatusMessageReporting &a_smr, Transporting::
***********************************************************************************************************/
Matrix Product::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID, int a_order ) const {
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID,
std::size_t a_order ) const {
Matrix matrix( 0, 0 );
@@ -485,7 +486,7 @@ void Product::continuousEnergyProductData( Transporting::Settings const &a_setti
***********************************************************************************************************/
void Product::mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
std::vector<double> const &a_energies, int a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const {
if( m_outputChannel == nullptr ) {
@@ -217,7 +217,9 @@ ProtareSingle::ProtareSingle( Construction::Settings const &a_construction, std:
throw std::runtime_error( "Only XML/HDF file types supported." );
}
#ifdef GIDIP_TEST_PARSING
if( a_construction.parseMode( ) != Construction::ParseMode::noParsing ) {
#endif
HAPI::Node protare = m_doc->first_child( );
SetupInfo setupInfo( this );
@@ -225,7 +227,9 @@ ProtareSingle::ProtareSingle( Construction::Settings const &a_construction, std:
setupInfo.m_particleSubstitution = &particleSubstitution;
initialize( a_construction, protare, setupInfo, a_pops, a_targetRequiredInGlobalPoPs, a_requiredInPoPs );
#ifdef GIDIP_TEST_PARSING
}
#endif
}
/* *********************************************************************************************************//**
@@ -388,6 +392,7 @@ void ProtareSingle::initialize( Construction::Settings const &a_construction, HA
m_projectileFrame = parseFrame( a_node, a_setupInfo, GIDI_projectileFrameChars );
m_styles.parse( a_construction, a_node.child( GIDI_stylesChars ), a_setupInfo, a_pops, m_internalPoPs, parseStylesSuite, nullptr );
m_styles.updateChainEnds( );
Styles::Evaluated *evaluated = m_styles.get<Styles::Evaluated>( 0 );
@@ -562,7 +567,7 @@ Reaction const *ProtareSingle::reactionToMultiGroup( Transporting::MG const &a_s
Reaction const *reaction1 = m_reactions.get<Reaction>( a_index );
if( !reaction1->active( ) ) return( nullptr );
if( a_reactionsToExclude.find( static_cast<int>( a_index ) ) != a_reactionsToExclude.end( ) ) return( nullptr );
if( a_reactionsToExclude.find( a_index ) != a_reactionsToExclude.end( ) ) return( nullptr );
return( checkIf_nuclearPlusCoulombInterferenceWanted( a_settings, reaction1 ) );
}
@@ -790,7 +795,7 @@ std::size_t ProtareSingle::numberOfInactiveReactions( ) const {
*
***********************************************************************************************************/
void ProtareSingle::updateReactionIndices( int a_offset ) const {
void ProtareSingle::updateReactionIndices( std::size_t a_offset ) const {
for( std::size_t i1 = 0; i1 < m_reactions.size( ); ++i1 ) {
Reaction const *reaction1 = m_reactions.get<Reaction>( i1 + a_offset );
@@ -927,22 +932,23 @@ GUPI::Ancestry const *ProtareSingle::findInAncestry3( std::string const &a_item
* @param a_settings [in] Specifies the requested label.
* @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
* @param a_reactionsToExclude [in] A list of reaction indices that are to be ignored when calculating the cross section.
* @param a_label [in] If not an empty string, this is used as the label for the form to return and the *a_temperatureInfo* labels are ignored.
*
* @return The requested multi-group cross section as a GIDI::Vector.
***********************************************************************************************************/
Vector ProtareSingle::multiGroupCrossSection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude ) const {
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude, std::string const &a_label ) const {
Vector vector;
if( useMultiGroupSummedData( a_settings, a_reactionsToExclude ) ) {
vector = m_multiGroupSummedReaction->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo ); }
vector = m_multiGroupSummedReaction->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo, a_label ); }
else {
for( std::size_t i1 = 0; i1 < m_reactions.size( ); ++i1 ) {
Reaction const *reaction1 = reactionToMultiGroup( a_settings, i1, a_reactionsToExclude );
if( reaction1 != nullptr ) vector += reaction1->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo );
if( reaction1 != nullptr ) vector += reaction1->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo, a_label );
}
}
@@ -1094,7 +1100,7 @@ Vector ProtareSingle::multiGroupQ( LUPI::StatusMessageReporting &a_smr, Transpor
Matrix ProtareSingle::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles,
std::string const &a_productID, int a_order, ExcludeReactionsSet const &a_reactionsToExclude ) const {
std::string const &a_productID, std::size_t a_order, ExcludeReactionsSet const &a_reactionsToExclude ) const {
Matrix matrix( 0, 0 );
@@ -1135,7 +1141,7 @@ Matrix ProtareSingle::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_s
***********************************************************************************************************/
Matrix ProtareSingle::multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
LUPI_maybeUnused ExcludeReactionsSet const &a_reactionsToExclude ) const {
Matrix matrix( 0, 0 );
@@ -1167,7 +1173,7 @@ Matrix ProtareSingle::multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_s
***********************************************************************************************************/
Vector ProtareSingle::multiGroupTransportCorrection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
TransportCorrectionType a_transportCorrectionType, double a_temperature, LUPI_maybeUnused ExcludeReactionsSet const &a_reactionsToExclude ) const {
if( a_transportCorrectionType == TransportCorrectionType::None ) return( Vector( 0 ) );
@@ -1468,7 +1474,7 @@ stringAndDoublePairs ProtareSingle::muCutoffForCoulombPlusNuclearElastic( ) cons
stringAndDoublePair labelMu( style2->label( ), style2->muCutoff( ) );
muCutoffs.push_back( labelMu );
muCutoffs.push_back( std::move( labelMu ) );
}
}
@@ -1579,4 +1585,15 @@ void ProtareSingle::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &
a_writeInfo.addNodeEnder( moniker( ) );
}
/* *********************************************************************************************************//**
* This method parses the **targetInfo** node in the **evaluated** style node into the *m_targetInfo* member of *this*.
*
* @param a_node [in] The protare (i.e., reactionSuite) node to be parsed and used to construct a Protare.
***********************************************************************************************************/
void ProtareSingle::parseEvaluatedTargetInfo( HAPI::Node const &a_node ) {
m_targetInfo.parseEvaluatedTargetInfo( a_node );
}
}
@@ -239,7 +239,7 @@ Documentation_1_10::Suite &ProtareComposite::documentations( ) {
* @return The style with label *a_label*.
******************************************************************/
Styles::Base &ProtareComposite::style( std::string const a_label ) {
Styles::Base &ProtareComposite::style( std::string const &a_label ) {
return( m_protares[0]->style( a_label ) );
}
@@ -479,7 +479,7 @@ Reaction const *ProtareComposite::orphanProduct( std::size_t a_index ) const {
*
***********************************************************************************************************/
void ProtareComposite::updateReactionIndices( LUPI_maybeUnused int a_offset ) const {
void ProtareComposite::updateReactionIndices( LUPI_maybeUnused std::size_t a_offset ) const {
std::size_t reactionOffset = 0;
@@ -558,18 +558,19 @@ Vector ProtareComposite::multiGroupInverseSpeed( LUPI::StatusMessageReporting &a
* @param a_settings [in] Specifies the requested label.
* @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
* @param a_reactionsToExclude [in] A list of reaction indices that are to be ignored when calculating the cross section.
* @param a_label [in] If not an empty string, this is used as the label for the form to return and the *a_temperatureInfo* labels are ignored.
*
* @return The requested multi-group cross section as a GIDI::Vector.
***********************************************************************************************************/
Vector ProtareComposite::multiGroupCrossSection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude ) const {
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude, std::string const &a_label ) const {
Vector vector;
ExcludeReactionsSet excludeReactionsSet( a_reactionsToExclude );
for( std::size_t i1 = 0; i1 < m_protares.size( ); ++i1 ) {
vector += m_protares[i1]->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo, a_reactionsToExclude );
vector += m_protares[i1]->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo, a_reactionsToExclude, a_label );
excludeReactionsSetAdjust( excludeReactionsSet, *m_protares[i1] );
}
@@ -698,7 +699,7 @@ Vector ProtareComposite::multiGroupFissionGammaMultiplicity( LUPI::StatusMessage
Matrix ProtareComposite::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles,
std::string const &a_productID, int a_order, ExcludeReactionsSet const &a_reactionsToExclude ) const {
std::string const &a_productID, std::size_t a_order, ExcludeReactionsSet const &a_reactionsToExclude ) const {
Matrix matrix( 0, 0 );
ExcludeReactionsSet excludeReactionsSet( a_reactionsToExclude );
@@ -726,7 +727,7 @@ Matrix ProtareComposite::multiGroupProductMatrix( LUPI::StatusMessageReporting &
***********************************************************************************************************/
Matrix ProtareComposite::multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
ExcludeReactionsSet const &a_reactionsToExclude ) const {
Matrix matrix( 0, 0 );
@@ -757,7 +758,7 @@ Matrix ProtareComposite::multiGroupFissionMatrix( LUPI::StatusMessageReporting &
***********************************************************************************************************/
Vector ProtareComposite::multiGroupTransportCorrection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
TransportCorrectionType a_transportCorrectionType, double a_temperature, ExcludeReactionsSet const &a_reactionsToExclude ) const {
Vector vector;
@@ -321,7 +321,7 @@ Documentation_1_10::Suite &ProtareTNSL::documentations( ) {
* @return The style with label *a_label*.
******************************************************************/
Styles::Base &ProtareTNSL::style( std::string const a_label ) {
Styles::Base &ProtareTNSL::style( std::string const &a_label ) {
return( m_protare->style( a_label ) );
}
@@ -436,10 +436,9 @@ std::size_t ProtareTNSL::numberOfReactions( ) const {
Reaction *ProtareTNSL::reaction( std::size_t a_index ) {
int index = a_index - m_TNSL->numberOfReactions( );
if( a_index < m_TNSL->numberOfReactions( ) ) return( m_TNSL->reaction( a_index ) );
if( index < 0 ) return( m_TNSL->reaction( a_index ) );
return( m_protare->reaction( index ) );
return( m_protare->reaction( a_index - m_TNSL->numberOfReactions( ) ) );
}
/* *********************************************************************************************************//**
@@ -451,10 +450,9 @@ Reaction *ProtareTNSL::reaction( std::size_t a_index ) {
Reaction const *ProtareTNSL::reaction( std::size_t a_index ) const {
int index = a_index - m_TNSL->numberOfReactions( );
if( a_index < m_TNSL->numberOfReactions( ) ) return( m_TNSL->reaction( a_index ) );
if( index < 0 ) return( m_TNSL->reaction( a_index ) );
return( m_protare->reaction( a_index ) );
return( m_protare->reaction( a_index - m_TNSL->numberOfReactions( ) ) );
}
/* *********************************************************************************************************//**
@@ -471,10 +469,9 @@ Reaction const *ProtareTNSL::reaction( std::size_t a_index ) const {
Reaction const *ProtareTNSL::reaction( std::size_t a_index, Transporting::MG const &a_settings,
ExcludeReactionsSet const &a_reactionsToExclude ) const {
int index = a_index - m_TNSL->numberOfReactions( );
if( a_index < m_TNSL->numberOfReactions( ) ) return( m_TNSL->reaction( a_index, a_settings, a_reactionsToExclude ) );
if( index < 0 ) return( m_TNSL->reaction( a_index, a_settings, a_reactionsToExclude ) );
return( m_protare->reaction( a_index, a_settings, a_reactionsToExclude ) );
return( m_protare->reaction( a_index - m_TNSL->numberOfReactions( ), a_settings, a_reactionsToExclude ) );
}
/* *********************************************************************************************************//**
@@ -517,7 +514,7 @@ Reaction const *ProtareTNSL::orphanProduct( std::size_t a_index ) const {
*
***********************************************************************************************************/
void ProtareTNSL::updateReactionIndices( LUPI_maybeUnused int a_offset ) const {
void ProtareTNSL::updateReactionIndices( LUPI_maybeUnused std::size_t a_offset ) const {
m_TNSL->updateReactionIndices( 0 );
m_protare->updateReactionIndices( m_TNSL->numberOfReactions( ) );
@@ -583,23 +580,25 @@ Vector ProtareTNSL::multiGroupInverseSpeed( LUPI::StatusMessageReporting &a_smr,
* @param a_settings [in] Specifies the requested label.
* @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
* @param a_reactionsToExclude [in] A list of reaction indices that are to be ignored when calculating the cross section.
* @param a_label [in] If not an empty string, this is used as the label for the form to return and the *a_temperatureInfo* labels are ignored.
*
* @return The requested multi-group cross section as a GIDI::Vector.
***********************************************************************************************************/
Vector ProtareTNSL::multiGroupCrossSection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude ) const {
Styles::TemperatureInfo const &a_temperatureInfo, ExcludeReactionsSet const &a_reactionsToExclude,
std::string const &a_label ) const {
ExcludeReactionsSet excludeReactionsSet( a_reactionsToExclude );
Vector vector = m_protare->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo, excludeReactionsSet );
Vector vector = m_protare->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo, excludeReactionsSet, a_label );
excludeReactionsSetAdjust( excludeReactionsSet, *m_protare );
if( !m_elasticReaction->active( ) ) return( vector );
Vector vectorElastic = m_elasticReaction->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo );
Vector vectorElastic = m_elasticReaction->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo, a_label );
combineVectors( a_settings, a_temperatureInfo, vector, vectorElastic,
m_TNSL->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo, excludeReactionsSet ) );
m_TNSL->multiGroupCrossSection( a_smr, a_settings, a_temperatureInfo, excludeReactionsSet, a_label ) );
return( vector );
}
@@ -711,7 +710,7 @@ Vector ProtareTNSL::multiGroupFissionGammaMultiplicity( LUPI::StatusMessageRepor
Matrix ProtareTNSL::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles,
std::string const &a_productID, int a_order, ExcludeReactionsSet const &a_reactionsToExclude ) const {
std::string const &a_productID, std::size_t a_order, ExcludeReactionsSet const &a_reactionsToExclude ) const {
ExcludeReactionsSet excludeReactionsSet( a_reactionsToExclude );
Matrix matrix = m_protare->multiGroupProductMatrix( a_smr, a_settings, a_temperatureInfo, a_particles, a_productID, a_order, excludeReactionsSet );
@@ -740,7 +739,7 @@ Matrix ProtareTNSL::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr
***********************************************************************************************************/
Matrix ProtareTNSL::multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
ExcludeReactionsSet const &a_reactionsToExclude ) const {
return( m_protare->multiGroupFissionMatrix( a_smr, a_settings, a_temperatureInfo, a_particles, a_order, a_reactionsToExclude ) );
@@ -763,7 +762,7 @@ Matrix ProtareTNSL::multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_smr
***********************************************************************************************************/
Vector ProtareTNSL::multiGroupTransportCorrection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order,
TransportCorrectionType a_transportCorrectionType, double a_temperature, ExcludeReactionsSet const &a_reactionsToExclude ) const {
if( a_transportCorrectionType == TransportCorrectionType::None ) return( Vector( 0 ) );
@@ -18,8 +18,9 @@ namespace GIDI {
* Parses a <**reaction**> node.
***********************************************************************************************************/
Reaction::Reaction( int a_ENDF_MT, std::string a_fissionGenre ) :
Reaction::Reaction( int a_ENDF_MT, std::string const &a_fissionGenre ) :
Form( FormType::reaction ),
m_reactionIndex( 0 ),
m_active( true ),
m_ENDF_MT( a_ENDF_MT ),
m_fissionGenre( a_fissionGenre ),
@@ -272,7 +273,7 @@ void Reaction::setOutputChannel( OutputChannel *a_outputChannel ) {
* for the TNSL data for that boundary.
***********************************************************************************************************/
void Reaction::modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> a_maximumTNSL_MultiGroupIndex ) {
void Reaction::modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> const &a_maximumTNSL_MultiGroupIndex ) {
m_crossSection.modifiedMultiGroupElasticForTNSL( a_maximumTNSL_MultiGroupIndex );
m_availableEnergy.modifiedMultiGroupElasticForTNSL( a_maximumTNSL_MultiGroupIndex );
@@ -340,16 +341,18 @@ bool Reaction::areAllProductsTracked( Transporting::Particles const &a_particles
* @param a_smr [Out] If errors are not to be thrown, then the error is reported via this instance.
* @param a_settings [in] Specifies the requested label.
* @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
* @param a_label [in] If not an empty string, this is used as the label for the form to return and the *a_temperatureInfo* labels are ignored.
*
* @return The requested multi-group cross section as a GIDI::Vector.
***********************************************************************************************************/
Vector Reaction::multiGroupCrossSection( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo ) const {
Styles::TemperatureInfo const &a_temperatureInfo, std::string const &a_label ) const {
Vector vector( 0 );
Functions::Gridded1d const *form = dynamic_cast<Functions::Gridded1d const*>( a_settings.form( a_smr, m_crossSection, a_temperatureInfo, "cross section" ) );
Functions::Gridded1d const *form = dynamic_cast<Functions::Gridded1d const*>(
a_settings.form( a_smr, m_crossSection, a_temperatureInfo, "cross section", a_label ) );
if( form != nullptr ) vector = form->data( );
return( vector );
@@ -390,7 +393,8 @@ Vector Reaction::multiGroupQ( LUPI::StatusMessageReporting &a_smr, Transporting:
***********************************************************************************************************/
Matrix Reaction::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID, int a_order ) const {
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::string const &a_productID,
std::size_t a_order ) const {
Matrix matrix( 0, 0 );
@@ -405,7 +409,7 @@ Matrix Reaction::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, T
Matrix matrix2( productionCrossSection.size( ), productionCrossSection.size( ) );
for( std::size_t i1 = 0; i1 < productionCrossSection.size( ); ++i1 ) {
matrix2.set( i1, multiGroupIndexFromEnergy, productionCrossSection[i1] );
matrix2.set( i1, static_cast<std::size_t>( multiGroupIndexFromEnergy ), productionCrossSection[i1] );
}
matrix += matrix2;
}
@@ -430,7 +434,7 @@ Matrix Reaction::multiGroupProductMatrix( LUPI::StatusMessageReporting &a_smr, T
***********************************************************************************************************/
Matrix Reaction::multiGroupFissionMatrix( LUPI::StatusMessageReporting &a_smr, Transporting::MG const &a_settings,
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, int a_order ) const {
Styles::TemperatureInfo const &a_temperatureInfo, Transporting::Particles const &a_particles, std::size_t a_order ) const {
Matrix matrix( 0, 0 );
@@ -687,7 +691,7 @@ void Reaction::continuousEnergyProductData( Transporting::Settings const &a_sett
***********************************************************************************************************/
void Reaction::mapContinuousEnergyProductData( Transporting::Settings const &a_settings, std::string const &a_particleID,
std::vector<double> const &a_energies, int a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> const &a_energies, std::size_t a_offset, std::vector<double> &a_productEnergies, std::vector<double> &a_productMomenta,
std::vector<double> &a_productGains, bool a_ignoreIncompleteParticles ) const {
// if( ENDF_MT( ) == 516 ) return; // FIXME, may be something wrong with the way FUDGE converts ENDF to GNDS.
@@ -144,7 +144,8 @@ double Regions1d::evaluate( double a_x1 ) const {
}
iX1 = 0; /* x1 < last value of Xs. */
}
return( m_function1ds[iX1]->evaluate( a_x1 ) );
return( m_function1ds[static_cast<std::size_t>(iX1)]->evaluate( a_x1 ) );
}
/* *********************************************************************************************************//**
@@ -157,7 +158,7 @@ double Regions1d::evaluate( double a_x1 ) const {
* @param a_scaleFactor [in] A factor applied to each evaluation before it is added to *a_results*.
***********************************************************************************************************/
void Regions1d::mapToXsAndAdd( int a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const {
void Regions1d::mapToXsAndAdd( std::size_t a_offset, std::vector<double> const &a_Xs, std::vector<double> &a_results, double a_scaleFactor ) const {
for( auto iter = m_function1ds.begin( ); iter < m_function1ds.end( ); ++iter ) {
(*iter)->mapToXsAndAdd( a_offset, a_Xs, a_results, a_scaleFactor );
@@ -121,7 +121,7 @@ double Regions2d::evaluate( double a_x2, double a_x1 ) const {
iX1 = 0; /* x1 < last value of Xs. */
}
return( m_function2ds[iX1]->evaluate( a_x2, a_x1 ) );
return( m_function2ds[static_cast<std::size_t>(iX1)]->evaluate( a_x2, a_x1 ) );
}
/* *********************************************************************************************************//**
@@ -51,7 +51,7 @@ Vector Settings::multiGroupZeroVector( Particles const &a_particles, bool a_coll
Particle const *projectile( a_particles.particle( projectileID( ) ) );
int n1 = projectile->fineMultiGroup( ).numberOfGroups( );
std::size_t n1 = projectile->fineMultiGroup( ).numberOfGroups( );
if( a_collapse ) n1 = projectile->numberOfGroups( );
Vector vector( n1 );
@@ -73,8 +73,8 @@ Matrix Settings::multiGroupZeroMatrix( Particles const &a_particles, std::string
Particle const *projectile( a_particles.particle( projectileID( ) ) );
Particle const *product( a_particles.particle( a_pid ) );
int n1 = projectile->fineMultiGroup( ).numberOfGroups( );
int n2 = product->fineMultiGroup( ).numberOfGroups( );
std::size_t n1 = projectile->fineMultiGroup( ).numberOfGroups( );
std::size_t n2 = product->fineMultiGroup( ).numberOfGroups( );
if( a_collapse ) {
n1 = projectile->numberOfGroups( );
n2 = product->numberOfGroups( );
@@ -128,28 +128,32 @@ MG::MG( std::string const &a_projectileID, Mode a_mode, DelayedNeutrons a_delaye
}
/* *********************************************************************************************************//**
* Searches the suite *a_suite* for the form style specified by *mode( )* and matching one in *a_temperatureInfo*.
* Searches the suite *a_suite* for the form style specified by *m_mode* and matching one in *a_temperatureInfo*.
* This only works for multi-group data (i.e., multiGroup or multiGroupWithSnElasticUpScatter type data).
* If *a_label* is not an empty string, then it is used as the label for the form to return and *a_temperatureInfo* is ignored.
*
* @param a_smr [Out] If errors are not to be thrown, then the error is reported via this instance.
* @param a_suite [in] The suite to search for the requested form.
* @param a_temperatureInfo [in] Specifies the temperature and labels use to lookup the requested data.
* @param a_dataType [in] The type of data being required. Only used if data not found.
* @param a_label [in] The not an empty string, this is used as the label for the form to return.
***********************************************************************************************************/
Form const *MG::form( LUPI::StatusMessageReporting &a_smr, GIDI::Suite const &a_suite, Styles::TemperatureInfo const &a_temperatureInfo,
std::string a_dataType ) const {
std::string a_dataType, std::string const &a_label ) const {
std::string label;
if( m_mode == Mode::multiGroup ) {
if( a_label != "" ) {
label = a_label; }
else if( m_mode == Mode::multiGroup ) {
label = a_temperatureInfo.heatedMultiGroup( ); }
else if( m_mode == Mode::multiGroupWithSnElasticUpScatter ) {
label = a_temperatureInfo.SnElasticUpScatter( );
}
Suite::const_iterator iter = a_suite.find( label, true );
if( iter == a_suite.end( ) ) {
if( ( iter == a_suite.end( ) ) && ( a_label == "" ) ) {
if( m_mode == Mode::multiGroupWithSnElasticUpScatter ) iter = a_suite.find( a_temperatureInfo.heatedMultiGroup( ), true );
}
@@ -31,11 +31,11 @@ namespace Transporting {
* @param a_fluxes [in] The flux for this Legendre order.
***********************************************************************************************************/
Flux_order::Flux_order( int a_order, int a_length, double const *a_energies, double const *a_fluxes ) :
Flux_order::Flux_order( std::size_t a_order, std::size_t a_length, double const *a_energies, double const *a_fluxes ) :
m_order( a_order ) {
for( int i1 = 0; i1 < a_length; ++i1 ) m_energies.push_back( a_energies[i1] );
for( int i1 = 0; i1 < a_length; ++i1 ) m_fluxes.push_back( a_fluxes[i1] );
for( std::size_t i1 = 0; i1 < a_length; ++i1 ) m_energies.push_back( a_energies[i1] );
for( std::size_t i1 = 0; i1 < a_length; ++i1 ) m_fluxes.push_back( a_fluxes[i1] );
}
/* *********************************************************************************************************//**
@@ -44,7 +44,7 @@ Flux_order::Flux_order( int a_order, int a_length, double const *a_energies, dou
* @param a_fluxes [in] The flux for this Legendre order.
***********************************************************************************************************/
Flux_order::Flux_order( int a_order, std::vector<double> const &a_energies, std::vector<double> const &a_fluxes ) :
Flux_order::Flux_order( std::size_t a_order, std::vector<double> const &a_energies, std::vector<double> const &a_fluxes ) :
m_order( a_order ),
m_energies( a_energies ),
m_fluxes( a_fluxes ) {
@@ -76,13 +76,13 @@ Flux_order::~Flux_order( ) {
* @param a_valuesPerLine [in] The number of points (i.e., energy, flux pairs) to print per line.
***********************************************************************************************************/
void Flux_order::print( int a_valuesPerLine ) const {
void Flux_order::print( unsigned int a_valuesPerLine ) const {
int nE = (int) m_energies.size( );
auto nE = m_energies.size( );
bool printIndent = true;
std::cout << " ORDER: " << m_order << " (number of points = " << m_energies.size( ) << ")" << std::endl;
for( int iE = 0; iE < nE; ++iE ) {
for( std::size_t iE = 0; iE < nE; ++iE ) {
if( printIndent ) std::cout << " ";
printIndent = false;
std::string buffer = LUPI::Misc::argumentsToString( " %15.8e %15.8e", m_energies[iE], m_fluxes[iE] );
@@ -129,7 +129,7 @@ Flux::Flux( Flux const &a_flux ) :
m_label( a_flux.label( ) ),
m_temperature( a_flux.temperature( ) ) {
for( int i1 = 0; i1 <= a_flux.maxOrder( ); ++i1 ) { addFluxOrder( a_flux[i1] ); }
for( std::size_t i1 = 0; i1 <= a_flux.maxOrder( ); ++i1 ) { addFluxOrder( a_flux[i1] ); }
}
/* *********************************************************************************************************//**
@@ -149,9 +149,9 @@ void Flux::addFluxOrder( Flux_order const &a_fluxOrder ) {
/*
* Orders can only be added in sequence (e.g., 0 first, then 1, ...).
*/
int order = a_fluxOrder.order( );
auto order = a_fluxOrder.order( );
if( order > (int) m_fluxOrders.size( ) ) throw Exception( "Flux::addFluxOrder: order > (int) m_fluxOrders.size( )." );
if( order > m_fluxOrders.size( ) ) throw Exception( "Flux::addFluxOrder: order > m_fluxOrders.size( )." );
m_fluxOrders.push_back( a_fluxOrder );
}
@@ -166,16 +166,18 @@ ProcessedFlux Flux::process( std::vector<double> const &a_multiGroup ) const {
/*
Currently only does l=0 flux.
*/
int i1 = 0;
std::size_t i1 = 0;
std::vector<double> groupedFlux;
ptwXPoints *boundaries = ptwX_create( nullptr, a_multiGroup.size( ), a_multiGroup.size( ), &(a_multiGroup[0]) );
int64_t size = static_cast<int64_t>( a_multiGroup.size( ) );
ptwXPoints *boundaries = ptwX_create( nullptr, size, size, &(a_multiGroup[0]) );
if( boundaries == nullptr ) throw Exception( "ptwX_create failted for boundaries." );
for( ; i1 < 1; ++i1 ) { // only do l=0 currenlty hence ' i1 < 1' test.
Flux_order const *__fluxOrder = &(m_fluxOrders[i1]);
ptwXYPoints *__flux = ptwXY_createFrom_Xs_Ys( nullptr, ptwXY_interpolationLinLin, ptwXY_interpolationToString( ptwXY_interpolationLinLin ),
10, 1e-3, 10, 10, __fluxOrder->size( ), __fluxOrder->energies( ), __fluxOrder->fluxes( ), 0 );
10, 1e-3, 10, 10, static_cast<int64_t>( __fluxOrder->size( ) ), __fluxOrder->energies( ),
__fluxOrder->fluxes( ), 0 );
if( __flux == nullptr ) throw Exception( "ptwXY_createFrom_Xs_Ys failed for __flux." );
ptwXPoints *groupedFluxX = ptwXY_groupOneFunction( nullptr, __flux, boundaries, ptwXY_group_normType_none, nullptr );
@@ -199,7 +201,7 @@ ProcessedFlux Flux::process( std::vector<double> const &a_multiGroup ) const {
* @param a_valuesPerLine [in] The number of points (i.e., energy, flux pairs) to print per line.
***********************************************************************************************************/
void Flux::print( std::string const &a_indent, bool a_outline, int a_valuesPerLine ) const {
void Flux::print( std::string const &a_indent, bool a_outline, unsigned int a_valuesPerLine ) const {
std::cout << a_indent << "FLUX: label = '" << m_label << "': maximum order = " << ( size( ) - 1 ) << std::endl;
if( a_outline ) return;
@@ -246,7 +248,7 @@ Fluxes_from_bdfls::Fluxes_from_bdfls( char const *a_fileName, double a_temperatu
void Fluxes_from_bdfls::initialize( char const *a_fileName, double a_temperature_MeV ) {
char buffer[132], *pEnd, cValue[16];
long numberOfValuesInOrders[16];
std::size_t numberOfValuesInOrders[16];
FILE *fIn = fopen( a_fileName, "r" );
if( fIn == nullptr ) throw Exception( "Fluxes_from_bdfls::initialize: Could not open bdfls file." );
@@ -268,34 +270,36 @@ void Fluxes_from_bdfls::initialize( char const *a_fileName, double a_temperature
std::string label( LLNL_fidToLabel( fid ) );
Flux flux( label, a_temperature_MeV );
long maximumFluxOrder( -1 );
long maximumFluxOrder2( -1 );
if( fgets( buffer, 132, fIn ) == nullptr ) throw Exception( "Fluxes_from_bdfls::initialize: fgets failed for maximumFluxOrder." );
maximumFluxOrder = strtol( buffer, &pEnd, 10 );
if( maximumFluxOrder == -1 ) throw Exception( "Fluxes_from_bdfls::initialize: converting maximumFluxOrder to long failed." );
maximumFluxOrder2 = strtol( buffer, &pEnd, 10 );
std::size_t maximumFluxOrder = static_cast<std::size_t>( maximumFluxOrder2 );
if( static_cast<long>( maximumFluxOrder ) != maximumFluxOrder2 ) throw Exception( "Fluxes_from_bdfls::initialize: converting maximumFluxOrder to long failed." );
if( maximumFluxOrder >= (long) ( sizeof( numberOfValuesInOrders ) / sizeof( numberOfValuesInOrders[0] ) ) )
throw Exception( "Fluxes_from_bdfls::initialize: need to increase size of numberOfValuesInOrders" );
for( long order = 0; order <= maximumFluxOrder; ++order ) {
numberOfValuesInOrders[order] = -1;
for( std::size_t order = 0; order <= maximumFluxOrder; ++order ) {
long numberOfValuesInOrders2 = -1;
if( fgets( buffer, 132, fIn ) == nullptr ) throw Exception( "Fluxes_from_bdfls::initialize: fgets failed for maximumFluxOrders." );
numberOfValuesInOrders[order] = strtol( buffer, &pEnd, 10 );
if( numberOfValuesInOrders[order] == -1 ) throw Exception( "Fluxes_from_bdfls::initialize: converting numberOfValuesInOrders[order] to long failed." );
numberOfValuesInOrders[order] /= 2;
numberOfValuesInOrders2 = strtol( buffer, &pEnd, 10 );
if( numberOfValuesInOrders2 == -1 ) throw Exception( "Fluxes_from_bdfls::initialize: converting numberOfValuesInOrders[order] to long failed." );
numberOfValuesInOrders[order] = static_cast<std::size_t>( numberOfValuesInOrders2 ) / 2;
}
for( long order = 0; order <= maximumFluxOrder; ++order ) {
long index = 0, numberOfValuesInOrder = 2 * numberOfValuesInOrders[order];
std::vector<double> energiesAndFluxes( numberOfValuesInOrder );
for( std::size_t order = 0; order <= maximumFluxOrder; ++order ) {
std::size_t index = 0;
long numberOfValuesInOrder = 2 * static_cast<long>( numberOfValuesInOrders[order] );
std::vector<double> energiesAndFluxes( static_cast<std::size_t>( numberOfValuesInOrder ) );
while( numberOfValuesInOrder > 0 ) {
long i1, n1 = 6;
if( numberOfValuesInOrder < 6 ) n1 = numberOfValuesInOrder;
std::size_t n1 = 6;
if( numberOfValuesInOrder < 6 ) n1 = static_cast<std::size_t>( numberOfValuesInOrder );
if( fgets( buffer, 132, fIn ) == nullptr ) throw Exception( "Fluxes_from_bdfls::initialize: fgets failed for energies/fluxes." );
for( i1 = 0; i1 < n1; ++i1, ++index ) {
for( std::size_t i1 = 0; i1 < n1; ++i1, ++index ) {
strncpy( cValue, &buffer[12*i1], 12 );
cValue[12] = 0;
energiesAndFluxes[index] = strtod( cValue, &pEnd );
}
numberOfValuesInOrder -= n1;
numberOfValuesInOrder -= static_cast<long>( n1 );
}
std::vector<double> energies( numberOfValuesInOrders[order] );
@@ -332,7 +336,7 @@ Flux Fluxes_from_bdfls::getViaFID( int a_fid ) const {
std::string label( LLNL_fidToLabel( a_fid ) );
for( int if1 = 0; if1 < (int) m_fluxes.size( ); ++if1 ) {
for( std::size_t if1 = 0; if1 < m_fluxes.size( ); ++if1 ) {
if( m_fluxes[if1].label( ) == label ) return( m_fluxes[if1] );
}
throw Exception( "Fluxes_from_bdfls::getViaFID: fid not found." );
@@ -366,7 +370,7 @@ Functions::XYs3d *Fluxes_from_bdfls::get3dViaFID( int a_fid ) const {
Functions::Legendre1d *legendre1d = new Functions::Legendre1d( axes, 0, energies[i1] );
std::vector<double> &coefficients = legendre1d->coefficients( );
for( int i2 = 0; i2 < flux.size( ); ++i2 ) coefficients.push_back( flux[i2].fluxes( )[i1] );
for( std::size_t i2 = 0; i2 < flux.size( ); ++i2 ) coefficients.push_back( flux[i2].fluxes( )[i1] );
xys2d->append( legendre1d );
}
xys3d->append( xys2d );
@@ -382,10 +386,10 @@ Functions::XYs3d *Fluxes_from_bdfls::get3dViaFID( int a_fid ) const {
std::vector<std::string> Fluxes_from_bdfls::labels( ) const {
int size = (int) m_fluxes.size( );
auto size = m_fluxes.size( );
std::vector<std::string> _labels( size );
for( int if1 = 0; if1 < size; ++if1 ) _labels[if1] = m_fluxes[if1].label( );
for( std::size_t if1 = 0; if1 < size; ++if1 ) _labels[if1] = m_fluxes[if1].label( );
return( _labels );
}
@@ -397,11 +401,11 @@ std::vector<std::string> Fluxes_from_bdfls::labels( ) const {
std::vector<int> Fluxes_from_bdfls::FIDs( ) const {
int size = (int) m_fluxes.size( );
auto size = m_fluxes.size( );
std::vector<int> fids( size );
char *e;
for( int if1 = 0; if1 < size; ++if1 ) {
for( std::size_t if1 = 0; if1 < size; ++if1 ) {
fids[if1] = (int) strtol( &(m_fluxes[if1].label( ).c_str( )[9]), &e, 10 );
}
return( fids );
@@ -414,12 +418,12 @@ std::vector<int> Fluxes_from_bdfls::FIDs( ) const {
* @param a_valuesPerLine [in] Passed to other *print* methods.
***********************************************************************************************************/
void Fluxes_from_bdfls::print( bool a_outline, int a_valuesPerLine ) const {
void Fluxes_from_bdfls::print( bool a_outline, unsigned int a_valuesPerLine ) const {
int nfs = (int) m_fluxes.size( );
auto nfs = m_fluxes.size( );
std::cout << "BDFLS FLUXes: number of fluxes = " << nfs << std::endl;
for( int if1 = 0; if1 < nfs ; ++if1 ) m_fluxes[if1].print( " ", a_outline, a_valuesPerLine );
for( std::size_t if1 = 0; if1 < nfs ; ++if1 ) m_fluxes[if1].print( " ", a_outline, a_valuesPerLine );
}
}
@@ -108,7 +108,7 @@ MultiGroup &MultiGroup::operator=( MultiGroup const &a_rhs ) {
int MultiGroup::multiGroupIndexFromEnergy( double a_energy, bool a_encloseOutOfRange ) const {
int iMin = 0, iMid, iMax = (int) m_boundaries.size( ), iMaxM1 = iMax - 1;
std::size_t iMin = 0, iMid, iMax = m_boundaries.size( ), iMaxM1 = iMax - 1;
if( iMax == 0 ) return( -3 );
if( a_energy < m_boundaries[0] ) {
@@ -116,7 +116,7 @@ int MultiGroup::multiGroupIndexFromEnergy( double a_energy, bool a_encloseOutOfR
return( -2 );
}
if( a_energy > m_boundaries[iMaxM1] ) {
if( a_encloseOutOfRange ) return( iMax - 2 );
if( a_encloseOutOfRange ) return( static_cast<int>( iMax ) - 2 );
return( -1 );
}
while( 1 ) {
@@ -129,7 +129,7 @@ int MultiGroup::multiGroupIndexFromEnergy( double a_energy, bool a_encloseOutOfR
}
}
if( iMin == iMaxM1 ) iMin--;
return( iMin );
return( static_cast<int>( iMin ) );
}
/* *********************************************************************************************************//**
@@ -151,14 +151,14 @@ void MultiGroup::set( std::string const &a_label, std::vector<double> const &a_b
* @param a_valuesPerLine [in] The number of points (i.e., energy, flux pairs) to print per line.
***********************************************************************************************************/
void MultiGroup::print( std::string const &a_indent, bool a_outline, int a_valuesPerLine ) const {
void MultiGroup::print( std::string const &a_indent, bool a_outline, unsigned int a_valuesPerLine ) const {
int nbs = size( );
std::size_t nbs = size( );
bool printIndent( true );
std::cout << a_indent << "GROUP: label = '" << m_label << "': length = " << nbs << std::endl;
if( a_outline ) return;
for( int ib = 0; ib < nbs; ib++ ) {
for( std::size_t ib = 0; ib < nbs; ib++ ) {
if( printIndent ) std::cout << a_indent;
printIndent = false;
std::cout << LUPI::Misc::argumentsToString( "%16.8e", m_boundaries[ib] );
@@ -223,8 +223,8 @@ void Groups_from_bdfls::initialize( char const *a_fileName ) {
numberOfBoundaries = strtol( buffer, &pEnd, 10 );
if( numberOfBoundaries == -1 ) throw Exception( "Groups_from_bdfls::initialize: converting gid to long failed." );
long index( 0 );
std::vector<double> boundaries( numberOfBoundaries );
std::size_t index( 0 );
std::vector<double> boundaries( static_cast<std::size_t>( numberOfBoundaries ) );
while( numberOfBoundaries > 0 ) {
long i1, n1( 6 );
if( numberOfBoundaries < 6 ) n1 = numberOfBoundaries;
@@ -258,7 +258,7 @@ Groups_from_bdfls::~Groups_from_bdfls( ) {
MultiGroup Groups_from_bdfls::viaLabel( std::string const &a_label ) const {
for( int ig = 0; ig < (int) m_multiGroups.size( ); ++ig ) {
for( std::size_t ig = 0; ig < m_multiGroups.size( ); ++ig ) {
if( m_multiGroups[ig].label( ) == a_label ) return( m_multiGroups[ig] );
}
throw Exception( "Groups_from_bdfls::viaLabel: label not found." );
@@ -286,10 +286,10 @@ MultiGroup Groups_from_bdfls::getViaGID( int a_gid ) const {
std::vector<std::string> Groups_from_bdfls::labels( ) const {
int size = (int) m_multiGroups.size( );
std::size_t size = m_multiGroups.size( );
std::vector<std::string> _labels( size );
for( int if1 = 0; if1 < size; ++if1 ) _labels[if1] = m_multiGroups[if1].label( );
for( std::size_t if1 = 0; if1 < size; ++if1 ) _labels[if1] = m_multiGroups[if1].label( );
return( _labels );
}
@@ -301,11 +301,11 @@ std::vector<std::string> Groups_from_bdfls::labels( ) const {
std::vector<int> Groups_from_bdfls::GIDs( ) const {
int size = (int) m_multiGroups.size( );
std::size_t size = m_multiGroups.size( );
std::vector<int> fids( size );
char *e;
for( int if1 = 0; if1 < size; ++if1 ) {
for( std::size_t if1 = 0; if1 < size; ++if1 ) {
fids[if1] = (int) strtol( &(m_multiGroups[if1].label( ).c_str( )[9]), &e, 10 );
}
return( fids );
@@ -318,12 +318,12 @@ std::vector<int> Groups_from_bdfls::GIDs( ) const {
* @param a_valuesPerLine [in] Passed to each MultiGroup print method.
***********************************************************************************************************/
void Groups_from_bdfls::print( bool a_outline, int a_valuesPerLine ) const {
void Groups_from_bdfls::print( bool a_outline, unsigned int a_valuesPerLine ) const {
int ngs = (int) m_multiGroups.size( );
std::size_t ngs = m_multiGroups.size( );
std::cout << "BDFLS GROUPs: number of groups = " << ngs << std::endl;
for( int if1 = 0; if1 < ngs ; ++if1 ) m_multiGroups[if1].print( " ", a_outline, a_valuesPerLine );
for( std::size_t if1 = 0; if1 < ngs ; ++if1 ) m_multiGroups[if1].print( " ", a_outline, a_valuesPerLine );
}
}
@@ -298,9 +298,10 @@ void Particle::process( Transportable const &a_transportable, double a_epsilon )
+ "' from multi-group '" + a_transportable.group( ).label( ) + "' of size " + std::to_string( groupBoundaries.size( ) )
+ " to multi-group '" + m_multiGroup.label( ) + "' of size " + std::to_string( m_multiGroup.boundaries( ).size( ) ) );
if( m_multiGroup.size( ) == 0 ) {
if( m_mode != Transporting::Mode::MonteCarloContinuousEnergy ) throw Exception( "Multi-group boundaries not set for particle '" + m_pid + "'." ); }
else {
if( m_mode != Transporting::Mode::MonteCarloContinuousEnergy ) {
if( m_multiGroup.size( ) == 0 ) {
m_multiGroup = MultiGroup( a_transportable.group( ).label( ), groupBoundaries );
}
if( m_fineMultiGroup.size( ) > 0 ) {
if( m_fineMultiGroup.size( ) != groupBoundaries.size( ) )
throw Exception( "For particle '" + m_pid + "', redefining particle's fine multi-group of different size not allowed." );
@@ -311,7 +312,7 @@ void Particle::process( Transportable const &a_transportable, double a_epsilon )
return; // Processing already done.
}
int i1 = 0, n1 = (int) groupBoundaries.size( );
std::size_t i1 = 0, n1 = groupBoundaries.size( );
while( i1 < n1 ) {
if( fabs( m_multiGroup[0] - groupBoundaries[i1] ) <= a_epsilon * groupBoundaries[i1] ) break;
@@ -320,7 +321,7 @@ void Particle::process( Transportable const &a_transportable, double a_epsilon )
if( i1 == n1 ) throw Exception( "Groups not compatible: " + errInfo + "." );
m_collapseIndices.push_back( i1 );
for( int i2 = 1; i2 < (int) m_multiGroup.size( ); ++i2 ) {
for( std::size_t i2 = 1; i2 < m_multiGroup.size( ); ++i2 ) {
while( i1 < n1 ) {
if( fabs( m_multiGroup[i2] - groupBoundaries[i1] ) <= a_epsilon * groupBoundaries[i1] ) break;
++i1;
@@ -329,9 +330,17 @@ void Particle::process( Transportable const &a_transportable, double a_epsilon )
m_collapseIndices.push_back( i1 );
}
for( std::size_t i2 = 0; i2 < m_fluxes.size( ); ++i2 ) {
ProcessedFlux __processedFlux( m_fluxes[i2].process( groupBoundaries ) );
m_processedFluxes.push_back( __processedFlux );
if( m_fluxes.size( ) == 0 ) {
std::vector<double> fluxes;
for( std::size_t index = 0; index < groupBoundaries.size( ) - 1; ++index ) {
fluxes.push_back( groupBoundaries[index+1] - groupBoundaries[index] );
}
m_processedFluxes.push_back( ProcessedFlux( 0.0, fluxes ) ); }
else {
for( std::size_t i2 = 0; i2 < m_fluxes.size( ); ++i2 ) {
ProcessedFlux __processedFlux( m_fluxes[i2].process( groupBoundaries ) );
m_processedFluxes.push_back( __processedFlux );
}
}
m_fineMultiGroup = a_transportable.group( );
@@ -361,7 +370,7 @@ void Particle::print( std::string const &a_indent ) const {
m_multiGroup.print( indent2 );
std::cout << indent2;
for( std::vector<int>::const_iterator iter = m_collapseIndices.begin( ); iter != m_collapseIndices.end( ); ++iter ) std::cout << " " << *iter;
for( auto iter = m_collapseIndices.begin( ); iter != m_collapseIndices.end( ); ++iter ) std::cout << " " << *iter;
std::cout << std::endl;
}
@@ -54,6 +54,83 @@ std::string const *Suite::findLabelInLineage( GIDI::Suite const &a_suite, std::s
return( label );
}
/* *********************************************************************************************************//**
*
*
* @param a_ends [in] If **true** only the end of each chain is returned.
* @param a_styles [in] The style's suite whose styles are analyzed.
*
* @return
***********************************************************************************************************/
std::vector< std::vector< Base const * > > Suite::chains( bool a_ends ) const {
std::vector< std::vector< Base const * > > chains1;
for( auto iter = begin( ); iter != end( ); ++iter ) {
Base const *base = static_cast<Base const *>( *iter );
chains1.push_back( base->chain( ) );
}
if( a_ends ) {
std::vector< std::vector<Base const *> > chains2;
for( auto iter1 = chains1.begin( ); iter1 != chains1.end( ); ++iter1 ) {
Base const *head = (*iter1)[0];
bool found = false;
for( auto iter2 = chains1.begin( ); iter2 != chains1.end( ); ++iter2 ) {
if( (*iter2)[0]->isStyleInDerivedForm( head ) ) {
found = true;
break;
}
}
if( !found ) {
std::vector< Base const * > item;
item.push_back( head );
chains2.push_back( item );
}
}
chains1 = chains2;
}
return( chains1 );
}
/* *********************************************************************************************************//**
* This methods updates the *m_chainEnds* member of *this*.
***********************************************************************************************************/
void Suite::updateChainEnds( ) {
m_chainEnds.clear( );
m_preProcessingChainEnds.clear( );
auto chains1 = chains( true );
for( auto iter = chains1.begin( ); iter != chains1.end( ); ++iter ) m_chainEnds.push_back( (*iter)[0] );
chains1 = chains( false );
std::vector<Base const *> preProcessingChains;
for( auto iter = chains1.begin( ); iter != chains1.end( ); ++iter ) {
auto moniker = (*iter)[0]->moniker( );
if( ( moniker == GIDI_evaluatedStyleChars ) || ( moniker == GIDI_crossSectionReconstructedStyleChars )
|| ( moniker == GIDI_realizationChars ) ) {
preProcessingChains.push_back( (*iter)[0] );
}
}
for( auto iter1 = preProcessingChains.begin( ); iter1 != preProcessingChains.end( ); ++iter1 ) {
bool found = false;
for( auto iter2 = preProcessingChains.begin( ); iter2 != preProcessingChains.end( ); ++iter2 ) {
if( (*iter2)->isStyleInDerivedForm( *iter1 ) ) {
found = true;
break;
}
}
if( !found ) {
m_preProcessingChainEnds.push_back( *iter1 );
}
}
}
/*! \class Base
* This is the virtual base class inherited by all **style** classes. It handles the *date* and **derivedFrom** members.
*/
@@ -63,7 +140,6 @@ std::string const *Suite::findLabelInLineage( GIDI::Suite const &a_suite, std::s
* @param a_node [in] The **HAPI::Node** to be parsed.
* @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
* @param a_parent [in] The parent GIDI::Suite.
* @return
***********************************************************************************************************/
Base::Base( HAPI::Node const &a_node, SetupInfo &a_setupInfo, GIDI::Suite *a_parent ) :
@@ -115,6 +191,45 @@ Base const *Base::getDerivedStyle( std::string const &a_moniker ) const {
return( _style );
}
/* *********************************************************************************************************//**
* Thie method returns the list of self and all its derived from styles in reverse order (i.e, the first style in the list is *this*).
*
* @return The list of derived styles of *this* (includng *this*) in reverse order.
***********************************************************************************************************/
std::vector<Base const *> Base::chain( ) const {
std::vector<Base const *> chain1;
Base const *style = this;
while( style != nullptr ) {
chain1.push_back( style );
style = style->getDerivedStyle( );
}
return( chain1 );
}
/* *********************************************************************************************************//**
* This method returns **true** if *a_style* is in *this* derivedFrom list and **false** otherwise.
*
* @param a_style [in] The style to check for.
*
* @return The list of derived styles of *this* (includng *this*) in reverse order.
***********************************************************************************************************/
bool Base::isStyleInDerivedForm( Base const *a_style ) const {
Base const *style = getDerivedStyle( );
while( style != nullptr ) {
if( style == a_style ) return( true );
style = style->getDerivedStyle( );
}
return( false );
}
/* *********************************************************************************************************//**
* Returns the base attributes for *this* as a *std::string* instance.
*
@@ -151,6 +266,7 @@ Evaluated::Evaluated( HAPI::Node const &a_node, SetupInfo &a_setupInfo, GIDI::Su
m_temperature( a_node.child( GIDI_temperatureChars ), a_setupInfo ),
m_projectileEnergyDomain( a_node.child( GIDI_projectileEnergyDomainChars ), a_setupInfo ) {
a_setupInfo.m_protare->parseEvaluatedTargetInfo( a_node.child( GIDI_targetInfoChars ) );
}
/* *********************************************************************************************************//**
@@ -113,9 +113,9 @@ void Suite::parse( Construction::Settings const &a_construction, HAPI::Node cons
* @return [in] The index of the node with keyValue *a_keyValue* in *this*.
***********************************************************************************************************/
int Suite::operator[]( std::string const &a_keyValue ) const {
std::size_t Suite::operator[]( std::string const &a_keyValue ) const {
std::map<std::string, int>::const_iterator iter = m_map.find( a_keyValue );
auto iter = m_map.find( a_keyValue );
if( iter == m_map.end( ) ) {
throw Exception( "form '" + a_keyValue + "' not in suite " + toXLink( ) + "." );
}
@@ -131,7 +131,7 @@ int Suite::operator[]( std::string const &a_keyValue ) const {
void Suite::add( Form *a_form ) {
int i1 = 0;
std::size_t i1 = 0;
for( Suite::iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter, ++i1 ) {
if( (*iter)->keyValue( ) == a_form->keyValue( ) ) {
@@ -140,7 +140,7 @@ void Suite::add( Form *a_form ) {
return;
}
}
m_map[a_form->keyValue( )] = (int) m_forms.size( );
m_map[a_form->keyValue( )] = m_forms.size( );
m_forms.push_back( a_form );
a_form->setAncestor( this );
}
@@ -371,7 +371,7 @@ Form *Suite::findInstanceOfTypeInLineage( Styles::Suite const &a_styles, std::st
* for the TNSL data for that boundary.
***********************************************************************************************************/
void Suite::modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> a_maximumTNSL_MultiGroupIndex ) {
void Suite::modifiedMultiGroupElasticForTNSL( std::map<std::string,std::size_t> const &a_maximumTNSL_MultiGroupIndex ) {
for( auto iter = a_maximumTNSL_MultiGroupIndex.begin( ); iter != a_maximumTNSL_MultiGroupIndex.end( ); ++iter ) {
auto formIter = find( iter->first, true );
@@ -25,8 +25,8 @@ namespace Table {
Table::Table( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo ) :
Form( a_node, a_setupInfo, FormType::table ),
m_rows( a_node.attribute_as_int( GIDI_rowsChars ) ),
m_coluns( a_node.attribute_as_int( GIDI_columnsChars ) ),
m_rows( static_cast<std::size_t>( a_node.attribute_as_int( GIDI_rowsChars ) ) ),
m_columns( static_cast<std::size_t>( a_node.attribute_as_int( GIDI_columnsChars ) ) ),
m_storageOrder( a_node.attribute_as_string( GIDI_storageOrderChars ) ),
m_columnHeaders( a_construction, GIDI_columnHeadersChars, GIDI_indexChars, a_node, a_setupInfo, PoPI::Database( ), PoPI::Database( ), parseColumnHeaders, nullptr ),
m_data( a_construction, a_node.child( GIDI_dataChars ), a_setupInfo ) {
@@ -56,8 +56,8 @@ void Table::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent
std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
std::string attributes;
attributes += a_writeInfo.addAttribute( GIDI_rowsChars, intToString( m_rows ) );
attributes += a_writeInfo.addAttribute( GIDI_columnsChars, intToString( m_coluns ) );
attributes += a_writeInfo.addAttribute( GIDI_rowsChars, intToString( static_cast<int>( m_rows ) ) );
attributes += a_writeInfo.addAttribute( GIDI_columnsChars, intToString( static_cast<int>( m_columns ) ) );
if( m_storageOrder != GIDI_rowMajorChars ) attributes += a_writeInfo.addAttribute( GIDI_storageOrderChars, m_storageOrder );
a_writeInfo.addNodeStarter( a_indent, moniker( ), attributes );
@@ -0,0 +1,235 @@
/*
# <<BEGIN-copyright>>
# Copyright 2019, Lawrence Livermore National Security, LLC.
# This file is part of the gidiplus package (https://github.com/LLNL/gidiplus).
# gidiplus is licensed under the MIT license (see https://opensource.org/licenses/MIT).
# SPDX-License-Identifier: MIT
# <<END-copyright>>
*/
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <GIDI.hpp>
#include <HAPI.hpp>
namespace GIDI {
namespace TargetInfo {
static GUPI::Entry *parseChemicalElement( LUPI_maybeUnused GUPI::Suite *a_parent, HAPI::Node const &a_node );
static GUPI::Entry *parseNuclide( LUPI_maybeUnused GUPI::Suite *a_parent, HAPI::Node const &a_node );
/*! \class Nuclide
* The class that stores a chemicalElement node.
*/
/* *********************************************************************************************************//**
***********************************************************************************************************/
Nuclide::Nuclide( HAPI::Node const &a_node ) :
GUPI::Entry( a_node, GIDI_pidChars ),
m_atomFraction( a_node.attribute( GIDI_atomFractionChars ).as_double( ) ) {
}
/* *********************************************************************************************************//**
***********************************************************************************************************/
Nuclide::~Nuclide( ) {
}
/* *********************************************************************************************************//**
* Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
*
* @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
* @param a_indent [in] The amount to indent *this* node.
***********************************************************************************************************/
void Nuclide::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const {
std::string attributes;
attributes = a_writeInfo.addAttribute( GIDI_pidChars, pid( ) );
attributes += a_writeInfo.addAttribute( GIDI_atomFractionChars, LUPI::Misc::doubleToShortestString( atomFraction( ), 15, -2 ) );
a_writeInfo.addNodeStarterEnder( a_indent, moniker( ), attributes );
}
/*! \class ChemicalElement
* The class that stores a chemicalElement node.
*/
/* *********************************************************************************************************//**
***********************************************************************************************************/
ChemicalElement::ChemicalElement( HAPI::Node const &a_node ) :
GUPI::Entry( a_node, PoPI_symbolChars ),
m_nuclides( a_node.child( PoPI_nuclidesChars ), GIDI_pidChars, parseNuclide ) {
}
/* *********************************************************************************************************//**
***********************************************************************************************************/
ChemicalElement::~ChemicalElement( ) {
}
/* *********************************************************************************************************//**
* Returns the **Nuclide** with pid *a_pid* if it exists; otherwise, **nullptr** is returned.
*
* @param a_symbol [in] The symbol for the chemical element whose nuclide abundance data are being requested.
***********************************************************************************************************/
Nuclide const *ChemicalElement::operator[]( std::string const &a_pid ) const {
for( auto nuclideIter = m_nuclides.begin( ); nuclideIter != m_nuclides.end( ); ++nuclideIter ) {
Nuclide const *nuclide = static_cast<Nuclide *>( *nuclideIter );
if( nuclide->pid( ) == a_pid ) return( nuclide );
}
return( nullptr );
}
/* *********************************************************************************************************//**
* Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
*
* @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
* @param a_indent [in] The amount to indent *this* node.
***********************************************************************************************************/
void ChemicalElement::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const {
std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
std::string attributes;
attributes = a_writeInfo.addAttribute( PoPI_symbolChars, symbol( ) );
a_writeInfo.addNodeStarter( a_indent, moniker( ), attributes );
m_nuclides.toXMLList( a_writeInfo, indent2 );
a_writeInfo.addNodeEnder( moniker( ) );
}
/*! \class IsotopicAbundances
* The class that stores an isotopicAbundances node.
*/
/* *********************************************************************************************************//**
***********************************************************************************************************/
IsotopicAbundances::IsotopicAbundances( ) :
GUPI::Ancestry( GIDI_isotopicAbundancesChars ),
m_chemicalElements( PoPI_chemicalElementsChars, PoPI_symbolChars ) {
}
/* *********************************************************************************************************//**
***********************************************************************************************************/
IsotopicAbundances::~IsotopicAbundances( ) {
}
void IsotopicAbundances::initialize( HAPI::Node const &a_node ) {
m_chemicalElements.parse( a_node.child( PoPI_chemicalElementsChars ), parseChemicalElement );
}
/* *********************************************************************************************************//**
* Returns the **ChemicalElement** with symbol *a_symbol* if it exists; otherwise, **nullptr** is returned.
*
* @param a_symbol [in] The symbol for the chemical element whose isotopic abundance data are being requested.
***********************************************************************************************************/
ChemicalElement const *IsotopicAbundances::operator[]( std::string const &a_symbol ) const {
for( auto iter = m_chemicalElements.begin( ); iter != m_chemicalElements.end( ); ++iter ) {
ChemicalElement const *chemicalElement = static_cast<ChemicalElement const *>( *iter );
if( chemicalElement->symbol( ) == a_symbol ) return( chemicalElement );
}
return( nullptr );
}
/* *********************************************************************************************************//**
* Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
*
* @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
* @param a_indent [in] The amount to indent *this* node.
***********************************************************************************************************/
void IsotopicAbundances::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const {
std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
a_writeInfo.addNodeStarter( a_indent, moniker( ) );
m_chemicalElements.toXMLList( a_writeInfo, indent2 );
a_writeInfo.addNodeEnder( moniker( ) );
}
/*! \class TargetInfo
* The class that stores the **targetInfo** node.
*/
/* *********************************************************************************************************//**
***********************************************************************************************************/
TargetInfo::TargetInfo( ) :
GUPI::Ancestry( GIDI_targetInfoChars ) {
}
/* *********************************************************************************************************//**
***********************************************************************************************************/
TargetInfo::~TargetInfo( ) {
}
/* *********************************************************************************************************//**
* For internal use only.
*
* @param a_node [in] The **HAPI::Node** node whose text is to be converted into a list of doubles.
***********************************************************************************************************/
void TargetInfo::parseEvaluatedTargetInfo( HAPI::Node const &a_node ) {
m_isotopicAbundances.initialize( a_node.child( GIDI_isotopicAbundancesChars ) );
}
/* *********************************************************************************************************//**
* Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
*
* @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
* @param a_indent [in] The amount to indent *this* node.
***********************************************************************************************************/
void TargetInfo::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const {
std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
a_writeInfo.addNodeStarter( a_indent, moniker( ) );
m_isotopicAbundances.toXMLList( a_writeInfo, indent2 );
a_writeInfo.addNodeEnder( moniker( ) );
}
/* *********************************************************************************************************//**
***********************************************************************************************************/
static GUPI::Entry *parseChemicalElement( LUPI_maybeUnused GUPI::Suite *a_parent, HAPI::Node const &a_node ) {
return new ChemicalElement( a_node );
}
/* *********************************************************************************************************//**
***********************************************************************************************************/
static GUPI::Entry *parseNuclide( LUPI_maybeUnused GUPI::Suite *a_parent, HAPI::Node const &a_node ) {
return new Nuclide( a_node );
}
} // End of namespace TargetInfo.
} // End of namespace GIDI.
@@ -376,13 +376,13 @@ void Vector::writeWithBoundaries( FILE *a_file, char const *a_format, std::vecto
***********************************************************************************************************/
void Vector::writeWithBoundaries2( FILE *a_file, char const *a_format, std::vector<double> const &a_boundaries, double a_epsilon ) const {
int numberOfValues = (int) size( );
std::size_t numberOfValues = size( );
if( a_epsilon == 0.0 ) {
for( int index = 0; index < numberOfValues; ++index ) fprintf( a_file, a_format, a_boundaries[index], m_vector[index] ); }
for( std::size_t index = 0; index < numberOfValues; ++index ) fprintf( a_file, a_format, a_boundaries[index], m_vector[index] ); }
else {
if( numberOfValues > 0 ) fprintf( a_file, a_format, a_boundaries[0], m_vector[0] );
for( int index = 1; index < numberOfValues; ++index ) {
for( std::size_t index = 1; index < numberOfValues; ++index ) {
fprintf( a_file, a_format, a_boundaries[index] * ( 1.0 - a_epsilon ), m_vector[index-1] );
fprintf( a_file, a_format, a_boundaries[index] * ( 1.0 + a_epsilon ), m_vector[index] );
@@ -77,9 +77,9 @@ void Suite::parse( HAPI::Node const &a_node, GUPI_parseSuite a_parseSuite ) {
* @return [in] The index of the node with keyValue *a_keyValue* in *this*.
***********************************************************************************************************/
int Suite::operator[]( std::string const &a_keyValue ) const {
std::size_t Suite::operator[]( std::string const &a_keyValue ) const {
std::map<std::string, int>::const_iterator iter = m_map.find( a_keyValue );
auto const iter = m_map.find( a_keyValue );
if( iter == m_map.end( ) ) {
throw LUPI::Exception( "form '" + a_keyValue + "' not in database." );
}
@@ -95,7 +95,7 @@ int Suite::operator[]( std::string const &a_keyValue ) const {
void Suite::add( Entry *a_form ) {
int i1 = 0;
std::size_t i1 = 0;
for( Suite::iterator iter = m_entries.begin( ); iter != m_entries.end( ); ++iter, ++i1 ) {
if( (*iter)->keyValue( ) == a_form->keyValue( ) ) {
@@ -104,7 +104,7 @@ void Suite::add( Entry *a_form ) {
return;
}
}
m_map[a_form->keyValue( )] = (int) m_entries.size( );
m_map[a_form->keyValue( )] = m_entries.size( );
m_entries.push_back( a_form );
a_form->setAncestor( this );
}
@@ -39,7 +39,7 @@ Data::~Data( ) {
}
int Data::length( ) const {
size_t Data::length( ) const {
return m_data->length();
@@ -20,7 +20,7 @@ namespace HAPI {
HDFData::HDFData() :
m_node_id(-1),
m_dataspace_id(-1),
m_length(-1) {
m_length(0) {
}
/*
@@ -33,7 +33,11 @@ HDFData::HDFData( hid_t node_id ) :
m_node_id(node_id) {
m_dataspace_id = H5Dget_space(m_node_id);
m_length = H5Sget_simple_extent_npoints(m_dataspace_id);
hssize_t n_points = H5Sget_simple_extent_npoints(m_dataspace_id);
if (n_points < 0) {
throw std::runtime_error("HDF5 error: failed to get dataset size!");
}
m_length = (size_t)n_points;
}
/*
@@ -43,7 +47,7 @@ HDFData::~HDFData( ) {
}
int HDFData::length( ) const {
size_t HDFData::length( ) const {
return m_length;
}
@@ -21,7 +21,8 @@ namespace HAPI {
*/
PugiXMLData::PugiXMLData() :
m_node( pugi::xml_node() ),
m_length( -1 ) {
m_length( 0 ),
m_dataRead( false ) {
}
/*
@@ -32,7 +33,8 @@ PugiXMLData::PugiXMLData() :
*/
PugiXMLData::PugiXMLData( pugi::xml_node a_node ) :
m_node( a_node ),
m_length( -1 ) {
m_length( 0 ),
m_dataRead( false ) {
}
/*
@@ -42,9 +44,9 @@ PugiXMLData::~PugiXMLData( ) {
}
int PugiXMLData::length( ) const {
size_t PugiXMLData::length( ) const {
if (m_length == -1)
if (!m_dataRead)
throw "Can't access length until data is read!";
return m_length;
@@ -58,10 +60,11 @@ void PugiXMLData::getDoubles(nf_Buffer<double> &buffer)
double *dValues = nfu_stringToListOfDoubles( NULL, text, ' ', &numberConverted, &endCharacter, 0 );
if (dValues == NULL) throw "dValues = NULL";
if (*endCharacter != 0) throw "bad values string";
m_length = numberConverted;
m_length = (size_t)numberConverted;
m_dataRead = true;
buffer.resize(m_length);
for (int i=0; i<m_length; i++)
for (size_t i=0; i<m_length; i++)
buffer[i] = dValues[i];
free( dValues );
}
@@ -74,10 +77,11 @@ void PugiXMLData::getInts(nf_Buffer<int> &buffer)
int *iValues = nfu_stringToListOfInt32s( NULL, text, ' ', &numberConverted, &endCharacter );
if (iValues == NULL) throw "dValues = NULL";
if (*endCharacter != 0) throw "bad values string";
m_length = numberConverted;
m_length = (size_t)numberConverted;
m_dataRead = true;
buffer.resize(m_length);
for (int i=0; i<m_length; i++)
for (size_t i=0; i<m_length; i++)
buffer[i] = iValues[i];
free( iValues );
}
@@ -26,7 +26,7 @@ Text::Text() :
* @param a_text text string
* @return
*/
Text::Text( std::string const a_text ) :
Text::Text( std::string const &a_text ) :
m_text( a_text ) {
}
@@ -134,7 +134,7 @@ int ArgumentBase::parse( ArgumentParser const &a_argumentParser, int a_index, in
if( m_argumentType == ArgumentType::Positional ) {
if( maximumNeeded1 < 0 ) maximumNeeded1 = a_argc; }
else {
if( ( maximumNeeded1 < counts( ) ) && ( maximumNeeded1 > -1 ) )
if( ( maximumNeeded1 < static_cast<int>( counts( ) ) ) && ( maximumNeeded1 > -1 ) )
throw std::runtime_error( "ERROR 1220 in ArgumentBase::parse: too many values for optional argument " + name( ) + " entered." );
maximumNeeded1 = 1;
}
@@ -647,7 +647,7 @@ void ArgumentParser::parse( int a_argc, char **a_argv, bool a_printArguments ) {
}
}
for( auto argumentIterator2 = m_arguments.begin( ); argumentIterator2 != m_arguments.end( ); ++argumentIterator2 ) {
if( (*argumentIterator2)->counts( ) < (*argumentIterator2)->minimumNeeded( ) ) {
if( static_cast<int>( (*argumentIterator2)->counts( ) ) < (*argumentIterator2)->minimumNeeded( ) ) {
std::string msg( "arguments for" );
if( (*argumentIterator2)->isOptionalArgument( ) ) msg = "number of option";
@@ -113,6 +113,7 @@ bool FormatVersion::supported( ) const {
if( m_format == GNDS_formatVersion_1_10Chars ) return( true );
if( m_format == GNDS_formatVersion_2_0Chars ) return( true );
if( m_format == GNDS_formatVersion_2_0_LLNL_4Chars ) return( true );
if( m_format == GNDS_formatVersion_2_1Chars ) return( true );
return( false );
}
@@ -146,6 +146,54 @@ std::vector<std::string> splitString( std::string const &a_string, std::string c
return( segments );
}
/* *********************************************************************************************************//**
* This function adds together the strings in *a_strings* with *a_sep* between the strings in **a_strings**.
*
* @param a_delimiter [in] The delimiter string.
* @param a_strings [in] The string to split.
*
* @return A **std::string**.
***********************************************************************************************************/
std::string joinStrings( std::string const &a_sep, std::vector<std::string> a_strings ) {
std::string string;
std::string sep = "";
std::string const *sepPointer = &sep;
for( auto iter = a_strings.begin( ); iter != a_strings.end( ); ++iter ) {
string += *sepPointer + *iter;
sepPointer = &a_sep;
}
return( string );
}
/* *********************************************************************************************************//**
* This function replace one (or all if *a_all* is true) occurrence(s) of *a_old* in *a_string* with *a_new*.
*
* @param a_string [in] The string to split.
* @param a_old [in] The current sub-string in *a_string* that is replaced by *a_new*.
* @param a_new [in] The new sub-string that replace *a_old*..
* @param a_all [in] If **true** all occurrence of *a_old* are replaced by *a_new*; otherwise, only the first occurrence is replaced.
*
* @return A **std::string**.
***********************************************************************************************************/
std::string replaceString( std::string const &a_string, std::string const &a_old, std::string const &a_new, bool a_all ) {
std::string string( a_string );
while( true ) {
std::size_t index = string.find( a_old );
if( index == std::string::npos ) break;
string.replace( index, a_old.size( ), a_new );
if( !a_all ) break;
}
return( string );
}
/* *********************************************************************************************************//**
* This function splits that string *a_string* into separate strings using the delimiter character "/" as
* for a XLink. The delimiter character "/"'s in each quoted region of the string is not split.
@@ -185,7 +233,7 @@ std::vector<std::string> splitXLinkString( std::string const &a_XLink ) {
if( current == '/' ) {
std::string element = a_XLink.substr( start, end - start );
elements.push_back( element );
elements.push_back( std::move( element ) );
while( a_XLink[end] == '/' ) ++end;
start = end;
if( end == size ) break; // Happens when XLink ends with '/'.
@@ -223,6 +271,29 @@ bool stringToInt( std::string const &a_string, int &a_value ) {
return( true );
}
/* *********************************************************************************************************//**
* Converts a string to an integer. All characteros of the string must be valid int characters except for the trailing 0.
*
* @param a_string [in] The string to convert to an int.
* @param a_value [in] The converted int value.
*
* @return true if successful and false otherwise.
***********************************************************************************************************/
bool stringToSize_t( std::string const &a_string, std::size_t &a_value ) {
char const *digits = a_string.c_str( );
char *nonDigit;
long value = strtol( digits, &nonDigit, 10 );
if( digits == nonDigit ) return( false );
if( *nonDigit != 0 ) return( false );
if( ( value < 0 ) || ( value > LONG_MAX ) ) return( false );
a_value = static_cast<std::size_t>( value );
return( true );
}
/* *********************************************************************************************************//**
* Returns a string that represent the arguments formatted per *a_format*.
*
@@ -78,7 +78,7 @@ std::string StatusMessageReporting::constructMessage( std::string a_prefix, int
* @param a_clear [in] If *true*, calls the **clear()** method after the message is constructed.
***********************************************************************************************************/
std::string StatusMessageReporting::constructFullMessage( std::string a_prefix, int a_reports, bool a_clear ) {
std::string StatusMessageReporting::constructFullMessage( std::string const &a_prefix, int a_reports, bool a_clear ) {
std::string message( a_prefix );
statusMessageReport const *report;
@@ -109,10 +109,12 @@ DeltaTime Timer::deltaTime( ) {
clock_t CPU_time = clock( );
gettimeofday( &wallTime, 0 );
double dWallTime = ( wallTime.tv_sec - m_wallTime.tv_sec ) + 1e-6 * ( wallTime.tv_usec - m_wallTime.tv_usec );
double dWallTime = static_cast<double>( wallTime.tv_sec - m_wallTime.tv_sec )
+ 1e-6 * static_cast<double>( wallTime.tv_usec - m_wallTime.tv_usec );
double dCPU_time = double( CPU_time - m_CPU_time ) / CLOCKS_PER_SEC;
double dWallTimeIncremental = ( wallTime.tv_sec - m_wallTimeIncremental.tv_sec ) + 1e-6 * ( wallTime.tv_usec - m_wallTimeIncremental.tv_usec );
double dWallTimeIncremental = static_cast<double>( wallTime.tv_sec - m_wallTimeIncremental.tv_sec )
+ 1e-6 * static_cast<double>( wallTime.tv_usec - m_wallTimeIncremental.tv_usec );
double dCPU_timeIncremental = double( CPU_time - m_CPU_timeIncremental ) / CLOCKS_PER_SEC;
m_CPU_timeIncremental = CPU_time;
@@ -117,12 +117,12 @@ LUPI_HOST GRIN_inelasticForEnergy::GRIN_inelasticForEnergy( SetupInfo &a_setupIn
PoPI::Database const &a_pops, GIDI::GRIN::InelasticIncidentEnergy const *inelasticIncidentEnergy ) :
m_levelsAndProbabilities( a_setupInfo, a_pops, inelasticIncidentEnergy->table( ), true ) {
std::vector<int> indices;
std::vector<std::size_t> indices;
std::vector<double> thresholds;
int index = 0;
std::size_t index = 0;
double priorThreshold = -1;
for( auto iter = m_levelsAndProbabilities.m_levels.begin( ); iter != m_levelsAndProbabilities.m_levels.end( ); ++iter, ++index ) {
NuclideGammaBranchStateInfo const *nuclideGammaBranchStateInfo = a_setupInfo.m_protare.nuclideGammaBranchStateInfos( )[*iter];
NuclideGammaBranchStateInfo const *nuclideGammaBranchStateInfo = a_setupInfo.m_protare.nuclideGammaBranchStateInfos( )[static_cast<std::size_t>(*iter)];
double levelEnergy = nuclideGammaBranchStateInfo->nuclearLevelEnergy( );
double threshold = ( a_projectileMass + a_targetMass + levelEnergy / 2 ) * levelEnergy / a_targetMass;
@@ -180,7 +180,7 @@ LUPI_HOST_DEVICE int GRIN_inelasticForEnergy::sampleLevelIndex( double a_project
LUPI_HOST_DEVICE void GRIN_inelasticForEnergy::serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode ) {
DATA_MEMBER_VECTOR_INT( m_indices, a_buffer, a_mode );
DATA_MEMBER_VECTOR_SIZE_T( m_indices, a_buffer, a_mode );
DATA_MEMBER_VECTOR_DOUBLE( m_thresholds, a_buffer, a_mode );
m_levelsAndProbabilities.serialize( a_buffer, a_mode );
}
@@ -321,7 +321,7 @@ LUPI_HOST_DEVICE GRIN_captureToCompound::GRIN_captureToCompound( ) {
***********************************************************************************************************/
LUPI_HOST GRIN_captureToCompound::GRIN_captureToCompound( SetupInfo &a_setupInfo, PoPI::Database const &a_pops, std::string a_compoundId ) :
m_index( a_setupInfo.m_stateNamesToIndices[a_compoundId] ),
m_index( static_cast<std::size_t>( a_setupInfo.m_stateNamesToIndices[a_compoundId] ) ),
m_continuumIndices( ) {
PoPI::Nuclide const &nuclide = a_pops.get<PoPI::Nuclide const>( a_compoundId );
@@ -360,7 +360,7 @@ LUPI_HOST_DEVICE GRIN_captureToCompound::~GRIN_captureToCompound( ) {
LUPI_HOST_DEVICE void GRIN_captureToCompound::serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode ) {
DATA_MEMBER_INT( m_index, a_buffer, a_mode );
DATA_MEMBER_SIZE_T( m_index, a_buffer, a_mode );
m_continuumIndices.serialize( a_buffer, a_mode );
}
@@ -53,7 +53,7 @@ LUPI_HOST void URR_protareInfos::setup( Vector<Protare *> &a_protares ) {
ProtareSingle *protareSingle = const_cast<ProtareSingle *>( protare->protare( i2 ) );
if( protareSingle->hasURR_probabilityTables( ) ) {
protareSingle->URR_index( URR_protareInfo_1.size( ) );
protareSingle->setURR_index( static_cast<int>( URR_protareInfo_1.size( ) ) );
URR_protareInfo_1.push_back( URR_protareInfo( ) );
}
}
@@ -137,7 +137,8 @@ LUPI_HOST_DEVICE ACE_URR_probabilityTable::~ACE_URR_probabilityTable( ) {
LUPI_HOST_DEVICE double ACE_URR_probabilityTable::sample( double a_rng_Value ) {
int index = binarySearchVector( a_rng_Value, m_propabilities, true );
int intIndex = binarySearchVector( a_rng_Value, m_propabilities, true );
std::size_t index = static_cast<std::size_t>( intIndex );
if( m_propabilities[index] < a_rng_Value ) ++index;
return( m_crossSections[index] );
}
@@ -288,7 +289,7 @@ LUPI_HOST void convertACE_URR_probabilityTablesFromGIDI( GIDI::ProtareSingle con
for( auto iter = a_protare.ACE_URR_probabilityTables( ).begin( ); iter != a_protare.ACE_URR_probabilityTables( ).end( ); ++iter ) {
bool needToInitialize( true );
std::map<int, std::string> columnNames;
std::map<std::size_t, std::string> columnNames;
ACE_URR_probabilityTablesFromGIDI *ACE_URR_probabilityTablesFromGIDI1 = new ACE_URR_probabilityTablesFromGIDI( );
GIDI::ACE_URR::ProbabilityTable *form = dynamic_cast<GIDI::ACE_URR::ProbabilityTable *>( *iter );
GIDI::ACE_URR::ProbabilityTable::Forms &incidentEnergies = form->forms( );
@@ -296,10 +297,10 @@ LUPI_HOST void convertACE_URR_probabilityTablesFromGIDI( GIDI::ProtareSingle con
for( auto incidentEnergyIter = incidentEnergies.begin( ); incidentEnergyIter != incidentEnergies.end( ); ++incidentEnergyIter ) {
GIDI::ACE_URR::IncidentEnergy *incidentEnergy = *incidentEnergyIter;
GIDI::Table::Table const &table = incidentEnergy->table( );
int numberOfRows = table.rows( );
int numberOfColumns = table.columns( );
std::size_t numberOfRows = static_cast<std::size_t>( table.rows( ) );
std::size_t numberOfColumns = static_cast<std::size_t>( table.columns( ) );
int columnIndex = 0;
std::size_t columnIndex = 0;
for( auto columnHeaderIter = table.columnHeaders( ).begin( ); columnHeaderIter != table.columnHeaders( ).end( ); ++columnHeaderIter ) {
GIDI::Table::Column const *columnHeader = dynamic_cast<GIDI::Table::Column *>( *columnHeaderIter );
if( needToInitialize && columnIndex > 0 ) {
@@ -321,7 +322,7 @@ LUPI_HOST void convertACE_URR_probabilityTablesFromGIDI( GIDI::ProtareSingle con
std::vector<std::vector<double> > columns( numberOfColumns );
for( columnIndex = 0; columnIndex < numberOfColumns; ++columnIndex ) {
columns[columnIndex].reserve( numberOfRows );
for( int rowIndex = 0; rowIndex < numberOfRows; ++rowIndex ) columns[columnIndex].push_back( dValues[rowIndex*numberOfColumns+columnIndex] );
for( std::size_t rowIndex = 0; rowIndex < numberOfRows; ++rowIndex ) columns[columnIndex].push_back( dValues[rowIndex*numberOfColumns+columnIndex] );
}
free( dValues );
@@ -72,7 +72,7 @@ LUPI_HOST_DEVICE Distribution::~Distribution( ) {
}
/* *********************************************************************************************************//**
* This method calls the **setModelDBRC_data2* method if the distribution is AngularTwoBody, otherwise it * executes a thrwo.
* This method calls the **setModelDBRC_data2* method if the distribution is AngularTwoBody, otherwise it * executes a throw.
*
* @param a_modelDBRC_data [in] The instance storing data needed to treat the DRRC upscatter mode.
***********************************************************************************************************/
@@ -84,7 +84,6 @@ LUPI_HOST void Distribution::setModelDBRC_data( Sampling::Upscatter::ModelDBRC_d
static_cast<AngularTwoBody *>( this )->setModelDBRC_data2( a_modelDBRC_data );
}
/* *********************************************************************************************************//**
* This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
* bytes, pack *this* or unpack *this* depending on *a_mode*.
@@ -654,7 +653,8 @@ LUPI_HOST_DEVICE CoherentPhotoAtomicScattering::~CoherentPhotoAtomicScattering(
LUPI_HOST_DEVICE double CoherentPhotoAtomicScattering::evaluate( double a_energyIn, double a_mu ) const {
double probability;
int lowerIndexEnergy = binarySearchVector( a_energyIn, m_energies, true ); // FIXME - need to handle case where lowerIndexEnergy = 0 like in evaluateScatteringFactor.
int intLowerIndexEnergy = binarySearchVector( a_energyIn, m_energies, true ); // FIXME - need to handle case where lowerIndexEnergy = 0 like in evaluateScatteringFactor.
std::size_t lowerIndexEnergy = static_cast<std::size_t>( intLowerIndexEnergy );
double _a = m_a[lowerIndexEnergy];
double _a_2 = _a * _a;
double X1 = m_energies[lowerIndexEnergy];
@@ -702,14 +702,16 @@ LUPI_HOST_DEVICE double CoherentPhotoAtomicScattering::evaluate( double a_energy
LUPI_HOST_DEVICE double CoherentPhotoAtomicScattering::evaluateFormFactor( double a_energyIn, double a_mu ) const {
double X = a_energyIn * sqrt( 0.5 * ( 1 - a_mu ) );
int lowerIndex = binarySearchVector( X, m_energies );
int intLowerIndex = binarySearchVector( X, m_energies );
if( lowerIndex < 1 ) {
if( lowerIndex == 0 ) return( m_formFactor[0] );
if( lowerIndex == -2 ) return( m_formFactor[0] ); // This should never happend for proper a_energyIn and a_mu.
if( intLowerIndex < 1 ) {
if( intLowerIndex == 0 ) return( m_formFactor[0] );
if( intLowerIndex == -2 ) return( m_formFactor[0] ); // This should never happend for proper a_energyIn and a_mu.
return( m_formFactor.back( ) );
}
std::size_t lowerIndex = static_cast<std::size_t>( intLowerIndex );
return( m_formFactor[lowerIndex] * pow( X / m_energies[lowerIndex] , m_a[lowerIndex] ) );
}
@@ -938,13 +940,14 @@ LUPI_HOST_DEVICE double IncoherentPhotoAtomicScattering::evaluateKleinNishina( d
LUPI_HOST_DEVICE double IncoherentPhotoAtomicScattering::evaluateScatteringFactor( double a_energyIn ) const {
int lowerIndex = binarySearchVector( a_energyIn, m_energies );
int intLowerIndex = binarySearchVector( a_energyIn, m_energies );
if( lowerIndex < 1 ) {
if( lowerIndex == -1 ) return( m_scatteringFactor.back( ) );
if( intLowerIndex < 1 ) {
if( intLowerIndex == -1 ) return( m_scatteringFactor.back( ) );
return( m_scatteringFactor[1] * a_energyIn / m_energies[1] );
}
std::size_t lowerIndex = static_cast<std::size_t>( intLowerIndex );
return( m_scatteringFactor[lowerIndex] * pow( a_energyIn / m_energies[lowerIndex], m_a[lowerIndex] ) );
}
@@ -985,7 +988,8 @@ LUPI_HOST_DEVICE IncoherentBoundToFreePhotoAtomicScattering::IncoherentBoundToFr
LUPI_HOST IncoherentBoundToFreePhotoAtomicScattering::IncoherentBoundToFreePhotoAtomicScattering(
GIDI::Distributions::IncoherentBoundToFreePhotoAtomicScattering const &a_incoherentBoundToFreePhotoAtomicScattering,
SetupInfo &a_setupInfo ) :
Distribution( Type::incoherentBoundToFreePhotoAtomicScattering, a_incoherentBoundToFreePhotoAtomicScattering, a_setupInfo ) {
Distribution( Type::incoherentBoundToFreePhotoAtomicScattering, a_incoherentBoundToFreePhotoAtomicScattering, a_setupInfo ),
m_bindingEnergy( 0.0 ) {
GIDI::ProtareSingle const &GIDI_protare = a_setupInfo.m_GIDI_protare;
auto monikers = GIDI_protare.styles( ).findAllOfMoniker( GIDI_MonteCarlo_cdfStyleChars );
@@ -1074,13 +1078,14 @@ LUPI_HOST_DEVICE double IncoherentBoundToFreePhotoAtomicScattering::evaluateOccu
const double alpha_binding = -m_bindingEnergy/PoPI_electronMass_MeV_c2; // BE [MeV] / 0.511 [MeV]
const double pzmax = ( -alpha_binding + alpha_in*(alpha_in - alpha_binding)*(1-a_mu) )/( sqrt( 2*alpha_in*(alpha_in-alpha_binding)*(1-a_mu) + alpha_binding*alpha_binding ) ); // *mec
int lowerIndex = binarySearchVector( pzmax, m_pz );
const int size1 = m_occupationNumber.size();
int intLowerIndex = binarySearchVector( pzmax, m_pz );
std::size_t lowerIndex = static_cast<std::size_t>( intLowerIndex );
int size1 = static_cast<int>( m_occupationNumber.size( ) );
if( lowerIndex == -1 || lowerIndex == (size1 -1)){
if( intLowerIndex == -1 || intLowerIndex == ( size1 - 1 ) ) {
return( m_occupationNumber.back( ) );
}
if( lowerIndex == -2 ){
if( intLowerIndex == -2 ){
return( m_occupationNumber[0] );
}
@@ -1169,7 +1174,8 @@ LUPI_HOST_DEVICE void IncoherentPhotoAtomicScatteringElectron::serialize( LUPI::
* Basic constructor.
***********************************************************************************************************/
LUPI_HOST_DEVICE PairProductionGamma::PairProductionGamma( ) {
LUPI_HOST_DEVICE PairProductionGamma::PairProductionGamma( ) :
m_firstSampled( false ) {
}
@@ -1329,6 +1335,7 @@ LUPI_HOST_DEVICE void CoherentElasticTNSL::serialize( LUPI::DataBuffer &a_buffer
***********************************************************************************************************/
LUPI_HOST_DEVICE IncoherentElasticTNSL::IncoherentElasticTNSL( ) :
m_temperatureToMeV_K( 1.0 ),
m_DebyeWallerIntegral( nullptr ) {
}
@@ -35,13 +35,13 @@ LUPI_HOST_DEVICE DomainHash::DomainHash( ) :
* @param a_domainMax [in] The maximum value of the energy domain for the hash function.
***********************************************************************************************************/
LUPI_HOST_DEVICE DomainHash::DomainHash( int a_bins, double a_domainMin, double a_domainMax ) :
LUPI_HOST_DEVICE DomainHash::DomainHash( std::size_t a_bins, double a_domainMin, double a_domainMax ) :
m_bins( a_bins ),
m_domainMin( a_domainMin ),
m_domainMax( a_domainMax ),
m_u_domainMin( log( a_domainMin ) ),
m_u_domainMax( log( a_domainMax ) ),
m_inverse_du( a_bins / ( m_u_domainMax - m_u_domainMin ) ) {
m_inverse_du( static_cast<double>( a_bins ) / ( m_u_domainMax - m_u_domainMin ) ) {
}
@@ -68,12 +68,12 @@ LUPI_HOST_DEVICE DomainHash::DomainHash( DomainHash const &a_domainHash ) :
* @return The hash index.
***********************************************************************************************************/
LUPI_HOST_DEVICE int DomainHash::index( double a_domain ) const {
LUPI_HOST_DEVICE std::size_t DomainHash::index( double a_domain ) const {
if( a_domain < m_domainMin ) return( 0 );
if( a_domain > m_domainMax ) return( m_bins + 1 );
double dIndex = m_inverse_du * ( log( a_domain ) - m_u_domainMin ) + 1;
return( (int) dIndex );
return( static_cast<std::size_t>( dIndex ) );
}
/* *********************************************************************************************************//**
@@ -84,11 +84,11 @@ LUPI_HOST_DEVICE int DomainHash::index( double a_domain ) const {
* @return The hash indices.
***********************************************************************************************************/
LUPI_HOST_DEVICE Vector<int> DomainHash::map( Vector<double> const &a_domainValues ) const {
LUPI_HOST_DEVICE Vector<std::size_t> DomainHash::map( Vector<double> const &a_domainValues ) const {
std::size_t i1, size( a_domainValues.size( ) );
Vector<int> indices( m_bins + 2, 0 );
int lastIndex = 0, currentIndex, i2 = 1;
Vector<std::size_t> indices( m_bins + 2, static_cast<std::size_t>( 0 ) );
std::size_t lastIndex = 0, currentIndex, i2 = 1;
for( i1 = 0; i1 < size; ++i1 ) {
currentIndex = index( a_domainValues[i1] );
@@ -113,7 +113,7 @@ LUPI_HOST_DEVICE Vector<int> DomainHash::map( Vector<double> const &a_domainValu
LUPI_HOST_DEVICE void DomainHash::serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode ) {
DATA_MEMBER_INT( m_bins, a_buffer, a_mode );
DATA_MEMBER_SIZE_T( m_bins, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_domainMin, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_domainMax, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_u_domainMin, a_buffer, a_mode );
@@ -134,9 +134,9 @@ LUPI_HOST void DomainHash::print( bool a_printValues ) const {
std::cout << " m_u_domainMin = " << m_u_domainMin << " << m_u_domainMax = " << m_u_domainMax << std::endl;
std::cout << " m_inverse_du = " << m_inverse_du << std::endl;
if( a_printValues ) {
double domain = m_domainMin, factor = pow( m_domainMax / m_domainMin, 1. / m_bins );
double domain = m_domainMin, factor = pow( m_domainMax / m_domainMin, 1. / static_cast<double>( m_bins ) );
for( int i1 = 0; i1 < bins( ); ++i1, domain *= factor ) {
for( std::size_t i1 = 0; i1 < bins( ); ++i1, domain *= factor ) {
std::cout << LUPI::Misc::argumentsToString( " %14.7e", domain );
if( ( ( i1 + 1 ) % 10 ) == 0 ) std::cout << std::endl;
}
@@ -149,6 +149,13 @@ LUPI_HOST void DomainHash::print( bool a_printValues ) const {
* This class stores a multi-group boundaries and has a method *index* that returns an index of the group for the requested domain value.
*/
/* *********************************************************************************************************//**
***********************************************************************************************************/
LUPI_HOST_DEVICE MultiGroupHash::MultiGroupHash( ) {
}
/* *********************************************************************************************************//**
* @param a_boundaries [in] The list of multi-group boundaries.
***********************************************************************************************************/
@@ -158,6 +165,15 @@ LUPI_HOST MultiGroupHash::MultiGroupHash( std::vector<double> a_boundaries ) :
}
/* *********************************************************************************************************//**
* @param a_boundaries [in] The list of multi-group boundaries.
***********************************************************************************************************/
LUPI_HOST_DEVICE MultiGroupHash::MultiGroupHash( Vector<double> a_boundaries ) :
m_boundaries( a_boundaries ) {
}
/* *********************************************************************************************************//**
* This constructor gets the list of multi-group boundaries from the first GIDI::Styles::MultiGroup of *a_protare*.
* It calls MultiGroupHash::initialize to set up *this*.
@@ -186,6 +202,18 @@ LUPI_HOST MultiGroupHash::MultiGroupHash( GIDI::Protare const &a_protare, GIDI::
m_boundaries = particle.multiGroup( ).boundaries( );
}
/* *********************************************************************************************************//**
* This constructor gets the list of multi-group boundaries from the GIDI::Particle of *a_particles* that is the projectile.
*
* @param a_protare [in] The GIDI::Protare containing the GIDI::Styles::MultiGroup style.
* @param a_particles [in] The list of transportable particles.
***********************************************************************************************************/
LUPI_HOST MultiGroupHash::MultiGroupHash( MultiGroupHash const &a_multiGroupHash ) :
m_boundaries( a_multiGroupHash.boundaries( ) ) {
}
/* *********************************************************************************************************//**
* This method is used by several constructors to get the multi-group data.
*
@@ -477,12 +477,13 @@ LUPI_HOST_DEVICE XYs1d::~XYs1d( ) {
*/
LUPI_HOST_DEVICE double XYs1d::evaluate( double a_x1 ) const {
int lower = binarySearchVector( a_x1, m_Xs );
int intLower = binarySearchVector( a_x1, m_Xs );
if( lower < 0 ) {
if( lower == -2 ) return( m_Ys[0] );
if( intLower < 0 ) {
if( intLower == -2 ) return( m_Ys[0] );
return( m_Ys.back( ) );
}
std::size_t lower = static_cast<std::size_t>( intLower );
double evaluatedValue = 0.0;
double y1 = m_Ys[lower];
@@ -641,7 +642,7 @@ LUPI_HOST_DEVICE Gridded1d::~Gridded1d( ) {
*/
LUPI_HOST_DEVICE double Gridded1d::evaluate( double a_x1 ) const {
return( m_data[binarySearchVector( a_x1, m_grid, true )] );
return( m_data[(std::size_t) binarySearchVector( a_x1, m_grid, true )] );
}
/* *********************************************************************************************************//**
@@ -705,15 +706,17 @@ LUPI_HOST_DEVICE void Regions1d::append( Function1d_d2 *a_function1d ) {
*/
LUPI_HOST_DEVICE double Regions1d::evaluate( double a_x1 ) const {
int lower = binarySearchVector( a_x1, m_Xs );
int intLower = binarySearchVector( a_x1, m_Xs );
if( lower < 0 ) {
if( lower == -1 ) { // a_x1 > last value of m_Xs.
if( intLower < 0 ) {
if( intLower == -1 ) { // a_x1 > last value of m_Xs.
return( m_functions1d.back( )->evaluate( a_x1 ) );
}
lower = 0; // a_x1 < last value of m_Xs.
intLower = 0; // a_x1 < last value of m_Xs.
}
std::size_t lower = static_cast<std::size_t>( intLower );
return( m_functions1d[lower]->evaluate( a_x1 ) );
}
@@ -813,7 +816,8 @@ LUPI_HOST_DEVICE void Branching1d::serialize( LUPI::DataBuffer &a_buffer, LUPI::
*/
LUPI_HOST_DEVICE TerrellFissionNeutronMultiplicityModel::TerrellFissionNeutronMultiplicityModel( ) :
m_multiplicity( nullptr ) {
m_width( 1.079 ),
m_multiplicity( nullptr ) {
m_type = Function1dType::TerrellFissionNeutronMultiplicityModel;
}
@@ -1000,16 +1004,17 @@ LUPI_HOST_DEVICE XYs2d::~XYs2d( ) {
*/
LUPI_HOST_DEVICE double XYs2d::evaluate( double a_x2, double a_x1 ) const {
int lower = binarySearchVector( a_x2, m_Xs );
int intLower = binarySearchVector( a_x2, m_Xs );
double evaluatedValue = 0.0;
if( lower < 0 ) {
if( lower == -1 ) { /* X2 > last value of Xs. */
if( intLower < 0 ) {
if( intLower == -1 ) { /* X2 > last value of Xs. */
evaluatedValue = m_functions1d.back( )->evaluate( a_x1 ); }
else { /* X2 < first value of Xs. */
evaluatedValue = m_functions1d[0]->evaluate( a_x1 );
} }
else {
std::size_t lower = static_cast<std::size_t>( intLower );
double y1 = m_functions1d[lower]->evaluate( a_x1 );
if( interpolation( ) == Interpolation::FLAT ) {
@@ -1071,7 +1076,16 @@ LUPI_HOST_DEVICE void XYs2d::serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBu
*/
LUPI_HOST Function1d *parseMultiplicityFunction1d( SetupInfo &a_setupInfo, LUPI_maybeUnused Transporting::MC const &a_settings, GIDI::Suite const &a_suite ) {
GIDI::Functions::Function1dForm const *form1d( a_suite.get<GIDI::Functions::Function1dForm>( 0 ) );
auto preProcessingChainEnds = a_setupInfo.m_GIDI_protare.styles( ).preProcessingChainEnds( );
if( preProcessingChainEnds.size( ) != 1 ) throw std::runtime_error( "Functions::parseMultiplicityFunction1d: preProcessingChainEnds != 1." );
std::string const &label = preProcessingChainEnds[0]->label( );
GIDI::Functions::Function1dForm const *form1d = nullptr;
if( a_suite.has( "muCutoff" ) ) { // Special case to handle legacy no-Rutherford processing which set the label to "muCutoff".
form1d = a_suite.get<GIDI::Functions::Function1dForm const>( 0 ); }
else {
form1d = a_suite.getViaLineage<GIDI::Functions::Function1dForm const>( label );
}
if( form1d->type( ) == GIDI::FormType::branching1d ) return( new Branching1d( a_setupInfo, *static_cast<GIDI::Functions::Branching1d const *>( form1d ) ) );
if( form1d->type( ) == GIDI::FormType::unspecified1d ) return( nullptr );
@@ -1341,14 +1355,16 @@ LUPI_HOST_DEVICE Xs_pdf_cdf1d::~Xs_pdf_cdf1d( ) {
*/
LUPI_HOST_DEVICE double Xs_pdf_cdf1d::evaluate( double a_x1 ) const {
int lower = binarySearchVector( a_x1, m_Xs );
int intLower = binarySearchVector( a_x1, m_Xs );
if( lower < 0 ) {
if( lower == -2 ) return( m_pdf[0] );
if( intLower < 0 ) {
if( intLower == -2 ) return( m_pdf[0] );
return( m_pdf.back( ) );
}
std::size_t lower = static_cast<std::size_t>( intLower );
double fraction = ( a_x1 - m_Xs[lower] ) / ( m_Xs[lower+1] - m_Xs[lower] );
return( ( 1. - fraction ) * m_pdf[lower] + fraction * m_pdf[lower+1] );
}
@@ -1619,15 +1635,17 @@ LUPI_HOST_DEVICE XYs2d::~XYs2d( ) {
*/
LUPI_HOST_DEVICE double XYs2d::evaluate( double a_x2, double a_x1 ) const {
int lower = binarySearchVector( a_x2, m_Xs );
int intLower = binarySearchVector( a_x2, m_Xs );
if( lower < 0 ) {
if( lower == -2 ) return( m_probabilities[0]->evaluate( a_x1 ) );
if( intLower < 0 ) {
if( intLower == -2 ) return( m_probabilities[0]->evaluate( a_x1 ) );
return( m_probabilities.back( )->evaluate( a_x1 ) );
}
std::size_t lower = static_cast<std::size_t>( intLower );
double fraction = ( a_x2 - m_Xs[lower] ) / ( m_Xs[lower+1] - m_Xs[lower] );
double d_value = ( 1.0 - fraction ) * m_probabilities[lower]->evaluate( a_x1 ) + fraction * m_probabilities[lower+1]->evaluate( a_x1 );
return( d_value );
}
@@ -1691,15 +1709,17 @@ LUPI_HOST_DEVICE Regions2d::~Regions2d( ) {
*/
LUPI_HOST_DEVICE double Regions2d::evaluate( double a_x2, double a_x1 ) const {
int lower = binarySearchVector( a_x2, m_Xs );
int intLower = binarySearchVector( a_x2, m_Xs );
if( lower < 0 ) {
if( lower == -1 ) { // a_x2 > last value of m_Xs.
if( intLower < 0 ) {
if( intLower == -1 ) { // a_x2 > last value of m_Xs.
return( m_probabilities.back( )->evaluate( a_x2, a_x1 ) );
}
lower = 0; // a_x2 < first value of m_Xs.
intLower = 0; // a_x2 < first value of m_Xs.
}
std::size_t lower = static_cast<std::size_t>( intLower );
return( m_probabilities[lower]->evaluate( a_x2, a_x1 ) );
}
@@ -1758,7 +1778,8 @@ LUPI_HOST_DEVICE Isotropic2d::~Isotropic2d( ) {
====================== DiscreteGamma2d =====================
============================================================
*/
LUPI_HOST_DEVICE DiscreteGamma2d::DiscreteGamma2d( ) {
LUPI_HOST_DEVICE DiscreteGamma2d::DiscreteGamma2d( ) :
m_value( 0.0 ) {
m_type = ProbabilityBase2dType::discreteGamma;
}
@@ -2182,6 +2203,7 @@ LUPI_HOST_DEVICE void SimpleMaxwellianFission2d::serialize( LUPI::DataBuffer &a_
============================================================
*/
LUPI_HOST_DEVICE Watt2d::Watt2d( ) :
m_U( 0.0 ),
m_a( nullptr ),
m_b( nullptr ) {
@@ -2458,14 +2480,15 @@ LUPI_HOST_DEVICE XYs3d::~XYs3d( ) {
*/
LUPI_HOST_DEVICE double XYs3d::evaluate( double a_x3, double a_x2, double a_x1 ) const {
int lower = binarySearchVector( a_x3, m_Xs );
int intLower = binarySearchVector( a_x3, m_Xs );
double evaluatedValue;
if( lower == -2 ) { // a_x3 < first value of Xs.
if( intLower == -2 ) { // a_x3 < first value of Xs.
evaluatedValue = m_probabilities[0]->evaluate( a_x2, a_x1 ); }
else if( lower == -1 ) { // a_x3 > last value of Xs.
else if( intLower == -1 ) { // a_x3 > last value of Xs.
evaluatedValue = m_probabilities.back( )->evaluate( a_x2, a_x1 ); }
else {
std::size_t lower = static_cast<std::size_t>( intLower );
double value1 = m_probabilities[lower]->evaluate( a_x2, a_x1 );
if( interpolation( ) == Interpolation::FLAT ) {
@@ -2678,15 +2701,15 @@ LUPI_HOST static ProbabilityBase1d *ptwXY_To_Xs_pdf_cdf1d( ptwXYPoints *pdfXY )
std::vector<double> Xs( n1 ), pdf( n1 ), cdf( n1 );
if( ( cdfX = ptwXY_runningIntegral( nullptr, pdfXY ) ) == nullptr ) throw std::runtime_error( "ptwXY_To_Xs_pdf_cdf1d: ptwXY_runningIntegral returned error." );
double norm = ptwX_getPointAtIndex_Unsafely( cdfX, n1 - 1 );
double norm = ptwX_getPointAtIndex_Unsafely( cdfX, (int64_t) n1 - 1 );
if( norm <= 0 ) throw std::runtime_error( "ptwXY_To_Xs_pdf_cdf1d: norm <= 0." );
norm = 1. / norm;
for( std::size_t i1 = 0; i1 < n1; ++i1 ) {
point = ptwXY_getPointAtIndex_Unsafely( pdfXY, i1 );
point = ptwXY_getPointAtIndex_Unsafely( pdfXY, (int64_t) i1 );
Xs[i1] = point->x;
pdf[i1] = norm * point->y;
cdf[i1] = norm * ptwX_getPointAtIndex_Unsafely( cdfX, i1 );
cdf[i1] = norm * ptwX_getPointAtIndex_Unsafely( cdfX, (int64_t) i1 );
}
cdf[n1-1] = 1.;
@@ -14,7 +14,7 @@ namespace MCGIDI {
static LUPI_HOST void checkZeroReaction( GIDI::Vector &vector, bool a_zeroReactions );
static LUPI_HOST GIDI::Vector collapseAndcheckZeroReaction( GIDI::Vector &a_vector, Transporting::MC const &a_settings,
GIDI::Transporting::Particles const &a_particles, double a_temperature, bool a_zeroReactions );
static void writeVector( FILE *a_file, std::string const &a_prefix, int a_offset, Vector<double> const &a_vector );
static void writeVector( FILE *a_file, std::string const &a_prefix, std::size_t a_offset, Vector<double> const &a_vector );
/*! \class HeatedReactionCrossSectionContinuousEnergy
* Class to store a reaction's cross section.
@@ -40,7 +40,8 @@ LUPI_HOST_DEVICE HeatedReactionCrossSectionContinuousEnergy::HeatedReactionCross
* @param a_crossSection [in] The cross section for the reaction.
***********************************************************************************************************/
LUPI_HOST HeatedReactionCrossSectionContinuousEnergy::HeatedReactionCrossSectionContinuousEnergy( int a_offset, double a_threshold, Vector<double> &a_crossSection ) :
LUPI_HOST HeatedReactionCrossSectionContinuousEnergy::HeatedReactionCrossSectionContinuousEnergy( std::size_t a_offset,
double a_threshold, Vector<double> &a_crossSection ) :
m_offset( a_offset ),
m_threshold( a_threshold ),
m_crossSections( a_crossSection.size( ) ),
@@ -48,7 +49,7 @@ LUPI_HOST HeatedReactionCrossSectionContinuousEnergy::HeatedReactionCrossSection
m_URR_probabilityTables( nullptr ),
m_ACE_URR_probabilityTables( nullptr ) {
int index = 0; // This and next line needed as m_crossSections may be an instance of Vector<float>.
std::size_t index = 0; // This and next line needed as m_crossSections may be an instance of Vector<float>.
for( auto iter = a_crossSection.begin( ); iter != a_crossSection.end( ); ++iter, ++index ) m_crossSections[index] = *iter;
}
@@ -70,7 +71,7 @@ LUPI_HOST HeatedReactionCrossSectionContinuousEnergy::HeatedReactionCrossSection
m_URR_probabilityTables( a_URR_probabilityTables ),
m_ACE_URR_probabilityTables( a_ACE_URR_probabilityTables ) {
int index = 0; // Next lines needed as m_crossSections may be an instance of Vector<float>.
std::size_t index = 0; // Next lines needed as m_crossSections may be an instance of Vector<float>.
std::vector<double> const &Ys = a_crossSection.Ys( );
for( auto iter = Ys.begin( ); iter != Ys.end( ); ++iter, ++index ) m_crossSections[index] = *iter;
@@ -144,7 +145,7 @@ LUPI_HOST GIDI::Functions::XYs1d HeatedReactionCrossSectionContinuousEnergy::cro
LUPI_HOST_DEVICE void HeatedReactionCrossSectionContinuousEnergy::serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode ) {
DATA_MEMBER_INT( m_offset, a_buffer, a_mode );
DATA_MEMBER_SIZE_T( m_offset, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_threshold, a_buffer, a_mode );
DATA_MEMBER_VECTOR_FLOAT_OR_DOUBLE( m_crossSections, a_buffer, a_mode );
m_URR_mode = serializeURR_mode( m_URR_mode, a_buffer, a_mode );
@@ -215,7 +216,7 @@ LUPI_HOST ContinuousEnergyGain &ContinuousEnergyGain::operator=( ContinuousEnerg
/* *********************************************************************************************************//**
***********************************************************************************************************/
LUPI_HOST_DEVICE double ContinuousEnergyGain::gain( int a_energy_index, double a_energy_fraction ) const {
LUPI_HOST_DEVICE double ContinuousEnergyGain::gain( std::size_t a_energy_index, double a_energy_fraction ) const {
return( a_energy_fraction * m_gain[a_energy_index] + ( 1.0 - a_energy_fraction ) * m_gain[a_energy_index+1] );
}
@@ -336,7 +337,7 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
m_hashIndices = a_domainHash.map( m_energies );
int reactionIndex = 0;
std::size_t reactionIndex = 0;
GIDI::Axes axes;
std::vector<double> dummy;
GIDI::Functions::Ys1d totalCrossSection( axes, ptwXY_interpolationLinLin, 0, dummy );
@@ -378,15 +379,19 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
if( a_fixedGrid ) {
GIDI::Functions::Ys1d *reactionCrossSection4 = &fixedGridCrossSection;
int start = 0;
std::size_t start = 0;
if( energies[reactionCrossSection3->start( )] > fixedGridPoints[0] ) {
start = binarySearchVector( energies[reactionCrossSection3->start( )], fixedGridPoints ) + 1;
int intStart = binarySearchVector( energies[reactionCrossSection3->start( )], fixedGridPoints ) + 1;
if (intStart < 0) {
throw std::out_of_range( "Cross section out of range when initializing fixed grid!" );
}
start = static_cast<std::size_t>( intStart );
}
for( int i1 = 0; i1 < start; ++i1 ) reactionCrossSection4->set( i1, 0.0 );
for( int i1 = start; i1 < static_cast<int>( fixedGridPoints.size( ) ); ++i1 ) {
int index = fixedGridIndices[i1];
for( std::size_t i1 = 0; i1 < start; ++i1 ) reactionCrossSection4->set( i1, 0.0 );
for( std::size_t i1 = start; i1 < fixedGridPoints.size( ); ++i1 ) {
std::size_t index = static_cast<std::size_t>( fixedGridIndices[i1] );
double fraction = ( fixedGridPoints[i1] - energies[index] ) / ( energies[index+1] - energies[index] );
index -= reactionCrossSection3->start( );
@@ -405,7 +410,7 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
for( std::size_t i1 = 0; i1 < totalCrossSection.size( ); ++i1 ) m_totalCrossSection[i1+totalCrossSection.start()] = totalCrossSection[i1];
if( hasURR_probabilityTables( ) ) {
std::vector<int> reactions_in_URR_region;
std::vector<std::size_t> reactions_in_URR_region;
for( reactionIndex = 0; reactionIndex < numberOfReactions( ); ++reactionIndex ) {
if( m_reactionCrossSections[reactionIndex]->threshold( ) < URR_domainMax( ) ) {
@@ -434,7 +439,7 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
m_productionEnergy.resize( totalCrossSection.length( ), 0.0 );
m_gains.resize( a_particles.particles( ).size( ) );
int i2 = 0;
std::size_t i2 = 0;
int projectileGainIndex = -1;
int photonGainIndex = -1;
for( std::map<std::string, GIDI::Transporting::Particle>::const_iterator particle = a_particles.particles( ).begin( ); particle != a_particles.particles( ).end( );
@@ -442,15 +447,15 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
int particleIntid = a_setupInfo.m_particleIntids[particle->first];
int particleIndex = a_setupInfo.m_particleIndices[particle->first];
if( particleIntid == a_setupInfo.m_protare.projectileIntid( ) ) projectileGainIndex = i2;
if( particleIntid == a_setupInfo.m_protare.projectileIntid( ) ) projectileGainIndex = (int) i2;
m_gains[i2] = new ContinuousEnergyGain( particleIntid, particleIndex, totalCrossSection.length( ) );
if( particle->first == PoPI::IDs::photon ) photonGainIndex = i2;
if( particle->first == PoPI::IDs::photon ) photonGainIndex = (int) i2;
}
std::vector< std::vector<double> > gains( a_particles.particles( ).size( ) );
for( std::size_t reactionIndex2 = 0; reactionIndex2 < a_reactions.size( ) + a_orphanProducts.size( ); ++reactionIndex2 ) {
int offset = 0;
std::size_t offset = 0;
std::vector<double> deposition_energy( m_energies.size( ), 0.0 );
std::vector<double> deposition_momentum( m_energies.size( ), 0.0 );
std::vector<double> production_energy( m_energies.size( ), 0.0 );
@@ -474,7 +479,7 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
offset = reactionCrossSection->start( );
}
if( a_settings.useSlowerContinuousEnergyConversion( ) ) { // Old way which is slow as it does one energy at a time.
for( std::size_t energy_index = (std::size_t) offset; energy_index < m_energies.size( ); ++energy_index ) {
for( std::size_t energy_index = offset; energy_index < m_energies.size( ); ++energy_index ) {
double energy = m_energies[energy_index];
if( reactionCrossSection == nullptr ) {
@@ -491,7 +496,7 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
deposition_momentum[energy_index] = available_momentum->evaluate( energy );
}
int i1 = 0;
std::size_t i1 = 0;
for( std::map<std::string, GIDI::Transporting::Particle>::const_iterator particle = a_particles.particles( ).begin( ); particle != a_particles.particles( ).end( );
++particle, ++i1 ) {
double product_energy, product_momentum, product_gain;
@@ -508,7 +513,7 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
reaction->continuousEnergyProductData( a_settings, particle->first, energy, product_energy, product_momentum,
product_gain, true );
}
if( i1 == projectileGainIndex ) --product_gain;
if( (int) i1 == projectileGainIndex ) --product_gain;
deposition_energy[energy_index] -= product_energy;
deposition_momentum[energy_index] -= product_momentum;
@@ -518,12 +523,12 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
else { // New way which is hopefully faster.
if( reactionCrossSection == nullptr ) {
if( isPhotoAtomic ) { // Treat as Q = 0.0 since 2 photons will be emitted.
for( std::size_t energyIndex = (std::size_t) offset; energyIndex < m_energies.size( ); ++energyIndex ) {
for( std::size_t energyIndex = offset; energyIndex < m_energies.size( ); ++energyIndex ) {
deposition_energy[energyIndex] = m_energies[energyIndex];
} }
else {
available_energy->mapToXsAndAdd( offset, *energiesPointer, deposition_energy, 1.0 );
for( std::size_t energyIndex = (std::size_t) offset; energyIndex < m_energies.size( ); ++energyIndex ) {
for( std::size_t energyIndex = offset; energyIndex < m_energies.size( ); ++energyIndex ) {
double Q = deposition_energy[energyIndex] - m_energies[energyIndex];
if( fabs( Q ) < 1e-12 * deposition_energy[energyIndex] )
Q = 0.0; // Probably 0.0 due to rounding errors.
@@ -533,7 +538,7 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
available_momentum->mapToXsAndAdd( offset, *energiesPointer, deposition_momentum, 1.0 );
}
int i1 = 0;
std::size_t i1 = 0;
for( std::map<std::string, GIDI::Transporting::Particle>::const_iterator particle = a_particles.particles( ).begin( );
particle != a_particles.particles( ).end( ); ++particle, ++i1 ) {
if( particle->first == PoPI::IDs::electron ) continue; // As of this coding, electrons are not complete in GNDS files.
@@ -541,7 +546,7 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
if( ( reactionCrossSection != nullptr ) && ( particle->first != PoPI::IDs::photon ) ) continue;
if( reaction->isPairProduction( ) && ( particle->first == PoPI::IDs::photon ) ) {
for( std::size_t energyIndex = (std::size_t) offset; energyIndex < m_energies.size( ); ++energyIndex ) {
for( std::size_t energyIndex = offset; energyIndex < m_energies.size( ); ++energyIndex ) {
deposition_energy[energyIndex] -= 2.0 * PoPI_electronMass_MeV_c2; // Assumes energy unit is MeV.
gains[i1][energyIndex] = 2.0;
} }
@@ -550,30 +555,31 @@ LUPI_HOST HeatedCrossSectionContinuousEnergy::HeatedCrossSectionContinuousEnergy
deposition_momentum, gains[i1], true );
}
if( i1 == projectileGainIndex ) {
for( std::size_t energyIndex = (std::size_t) offset; energyIndex < m_energies.size( ); ++energyIndex ) --gains[i1][energyIndex];
if( (int) i1 == projectileGainIndex ) {
for( std::size_t energyIndex = offset; energyIndex < m_energies.size( ); ++energyIndex ) --gains[i1][energyIndex];
}
}
}
if( a_particles.hasParticle( PoPI::IDs::photon ) ) {
if( a_setupInfo.m_initialStateIndices.find( reaction->label( ) ) != a_setupInfo.m_initialStateIndices.end( ) ) {
int initialStateIndex = a_setupInfo.m_initialStateIndices[reaction->label( )];
if( initialStateIndex >= 0 ) {
int intInitialStateIndex = a_setupInfo.m_initialStateIndices[reaction->label( )];
if( intInitialStateIndex >= 0 ) {
std::size_t initialStateIndex = static_cast<std::size_t>( intInitialStateIndex );
NuclideGammaBranchStateInfo *nuclideGammaBranchStateInfo = a_setupInfo.m_protare.nuclideGammaBranchStateInfos( )[initialStateIndex];
double multiplicity = nuclideGammaBranchStateInfo->multiplicity( );
double averageGammaEnergy = nuclideGammaBranchStateInfo->averageGammaEnergy( );
for( std::size_t energyIndex = (std::size_t) offset; energyIndex < m_energies.size( ); ++energyIndex ) {
for( std::size_t energyIndex = offset; energyIndex < m_energies.size( ); ++energyIndex ) {
deposition_energy[energyIndex] -= averageGammaEnergy;
if( photonGainIndex >= 0 ) gains[photonGainIndex][energyIndex] += multiplicity;
if( photonGainIndex >= 0 ) gains[static_cast<std::size_t>(photonGainIndex)][energyIndex] += multiplicity;
}
}
}
}
double crossSection = 0.0;
for( std::size_t energyIndex = (std::size_t) offset; energyIndex < m_energies.size( ); ++energyIndex ) {
for( std::size_t energyIndex = offset; energyIndex < m_energies.size( ); ++energyIndex ) {
if( reactionCrossSection == nullptr ) {
crossSection = MCGIDI_reaction_cross_section->crossSection( energyIndex ); }
else {
@@ -617,7 +623,7 @@ LUPI_HOST_DEVICE HeatedCrossSectionContinuousEnergy::~HeatedCrossSectionContinuo
* @return The index bounding *a_energy* in the member *m_energies*.
***********************************************************************************************************/
LUPI_HOST_DEVICE int HeatedCrossSectionContinuousEnergy::evaluationInfo( int a_hashIndex, double a_energy, double *a_energyFraction ) const {
LUPI_HOST_DEVICE std::size_t HeatedCrossSectionContinuousEnergy::evaluationInfo( std::size_t a_hashIndex, double a_energy, double *a_energyFraction ) const {
return Sampling::evaluationForHashIndex( a_hashIndex, m_hashIndices, a_energy, m_energies, a_energyFraction );
}
@@ -674,13 +680,13 @@ LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::URR_domainMax( ) con
=========================================================
*/
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::crossSection( URR_protareInfos const &a_URR_protareInfos, int a_URR_index,
int a_hashIndex, double a_energy, LUPI_maybeUnused bool a_sampling ) const {
std::size_t a_hashIndex, double a_energy, LUPI_maybeUnused bool a_sampling ) const {
double energy_fraction;
int energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
std::size_t energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
if( a_URR_index >= 0 ) {
URR_protareInfo const &URR_protare_info = a_URR_protareInfos[a_URR_index];
URR_protareInfo const &URR_protare_info = a_URR_protareInfos[static_cast<std::size_t>(a_URR_index)];
if( URR_protare_info.m_inURR ) {
double cross_section = 0.0;
@@ -697,25 +703,25 @@ LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::crossSection( URR_pr
/*
=========================================================
*/
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos,
int a_URR_index, int a_hashIndex, double a_energy, LUPI_maybeUnused bool a_sampling ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos,
int a_URR_index, std::size_t a_hashIndex, double a_energy, LUPI_maybeUnused bool a_sampling ) const {
double energyFraction;
int energyIndex = evaluationInfo( a_hashIndex, a_energy, &energyFraction );
std::size_t energyIndex = evaluationInfo( a_hashIndex, a_energy, &energyFraction );
return( reactionCrossSection2( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_energy, energyIndex, energyFraction ) );
}
/*
=========================================================
*/
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::reactionCrossSection2( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos,
int a_URR_index, double a_energy, int a_energyIndex, double a_energyFraction, LUPI_maybeUnused bool a_sampling ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::reactionCrossSection2( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos,
int a_URR_index, double a_energy, std::size_t a_energyIndex, double a_energyFraction, LUPI_maybeUnused bool a_sampling ) const {
HeatedReactionCrossSectionContinuousEnergy const &reaction = *m_reactionCrossSections[a_reactionIndex];
double URR_cross_section_factor = 1.0;
if( a_URR_index >= 0 ) {
URR_protareInfo const &URR_protare_info = a_URR_protareInfos[a_URR_index];
URR_protareInfo const &URR_protare_info = a_URR_protareInfos[static_cast<std::size_t>(a_URR_index)];
if( URR_protare_info.m_inURR ) {
if( m_URR_mode == Transporting::URR_mode::pdfs ) {
if( reaction.URR_probabilityTables( ) != nullptr )
@@ -733,15 +739,16 @@ LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::reactionCrossSection
/*
=========================================================
*/
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index,
double a_energy_in ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::reactionCrossSection( std::size_t a_reactionIndex,
URR_protareInfos const &a_URR_protareInfos, int a_URR_index, double a_energy_in ) const {
int energyIndex = binarySearchVector( a_energy_in, m_energies );
int intEnergyIndex = binarySearchVector( a_energy_in, m_energies );
std::size_t energyIndex = static_cast<std::size_t>( intEnergyIndex );
double energyFraction;
if( energyIndex < 0 ) {
if( energyIndex == -1 ) {
energyIndex = static_cast<int>( m_energies.size( ) ) - 2;
if( intEnergyIndex < 0 ) {
if( intEnergyIndex == -1 ) {
energyIndex = m_energies.size( ) - 2;
energyFraction = 0.0; }
else {
energyIndex = 0;
@@ -776,7 +783,7 @@ LUPI_HOST GIDI::Functions::XYs1d HeatedCrossSectionContinuousEnergy::crossSectio
* @returns A GIDI::Functions::XYs1d instance.
***********************************************************************************************************/
LUPI_HOST GIDI::Functions::XYs1d HeatedCrossSectionContinuousEnergy::reactionCrossSectionAsGIDI_XYs1d( int a_reactionIndex ) const {
LUPI_HOST GIDI::Functions::XYs1d HeatedCrossSectionContinuousEnergy::reactionCrossSectionAsGIDI_XYs1d( std::size_t a_reactionIndex ) const {
return( m_reactionCrossSections[a_reactionIndex]->crossSectionAsGIDI_XYs1d( m_temperature, m_energies ) );
}
@@ -789,10 +796,10 @@ LUPI_HOST GIDI::Functions::XYs1d HeatedCrossSectionContinuousEnergy::reactionCro
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::depositionEnergy( int a_hashIndex, double a_energy ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::depositionEnergy( std::size_t a_hashIndex, double a_energy ) const {
double energy_fraction;
int energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
std::size_t energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
return( energy_fraction * m_depositionEnergy[energy_index] + ( 1.0 - energy_fraction ) * m_depositionEnergy[energy_index+1] );
}
@@ -805,10 +812,10 @@ LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::depositionEnergy( in
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::depositionMomentum( int a_hashIndex, double a_energy ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::depositionMomentum( std::size_t a_hashIndex, double a_energy ) const {
double energy_fraction;
int energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
std::size_t energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
return( energy_fraction * m_depositionMomentum[energy_index] + ( 1.0 - energy_fraction ) * m_depositionMomentum[energy_index+1] );
}
@@ -821,10 +828,10 @@ LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::depositionMomentum(
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::productionEnergy( int a_hashIndex, double a_energy ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::productionEnergy( std::size_t a_hashIndex, double a_energy ) const {
double energy_fraction;
int energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
std::size_t energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
return( energy_fraction * m_productionEnergy[energy_index] + ( 1.0 - energy_fraction ) * m_productionEnergy[energy_index+1] );
}
@@ -837,10 +844,10 @@ LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::productionEnergy( in
* @param a_particleIndex [in] The index of the particle whose gain is requested.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::gain( int a_hashIndex, double a_energy, int a_particleIndex ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::gain( std::size_t a_hashIndex, double a_energy, int a_particleIndex ) const {
double energy_fraction;
int energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
std::size_t energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
for( std::size_t i1 = 0; i1 < m_gains.size( ); ++i1 ) {
if( a_particleIndex == m_gains[i1]->particleIndex( ) ) return( m_gains[i1]->gain( energy_index, energy_fraction ) );
@@ -857,10 +864,10 @@ LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::gain( int a_hashInde
* @param a_particleIntid [in] The intid of the particle whose gain is requested.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::gainViaIntid( int a_hashIndex, double a_energy, int a_particleIntid ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionContinuousEnergy::gainViaIntid( std::size_t a_hashIndex, double a_energy, int a_particleIntid ) const {
double energy_fraction;
int energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
std::size_t energy_index = evaluationInfo( a_hashIndex, a_energy, &energy_fraction );
for( std::size_t i1 = 0; i1 < m_gains.size( ); ++i1 ) {
if( a_particleIntid == m_gains[i1]->particleIntid( ) ) return( m_gains[i1]->gain( energy_index, energy_fraction ) );
@@ -904,14 +911,14 @@ LUPI_HOST void HeatedCrossSectionContinuousEnergy::setUserParticleIndexViaIntid(
LUPI_HOST_DEVICE void HeatedCrossSectionContinuousEnergy::serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode ) {
DATA_MEMBER_DOUBLE( m_temperature, a_buffer, a_mode );
DATA_MEMBER_VECTOR_INT( m_hashIndices, a_buffer, a_mode );
DATA_MEMBER_VECTOR_SIZE_T( m_hashIndices, a_buffer, a_mode );
DATA_MEMBER_VECTOR_DOUBLE( m_energies, a_buffer, a_mode );
DATA_MEMBER_VECTOR_FLOAT_OR_DOUBLE( m_totalCrossSection, a_buffer, a_mode );
DATA_MEMBER_VECTOR_FLOAT_OR_DOUBLE( m_depositionEnergy, a_buffer, a_mode );
DATA_MEMBER_VECTOR_FLOAT_OR_DOUBLE( m_depositionMomentum, a_buffer, a_mode );
DATA_MEMBER_VECTOR_FLOAT_OR_DOUBLE( m_productionEnergy, a_buffer, a_mode );
m_URR_mode = serializeURR_mode( m_URR_mode, a_buffer, a_mode );
DATA_MEMBER_VECTOR_INT( m_reactionsInURR_region, a_buffer, a_mode );
DATA_MEMBER_VECTOR_SIZE_T( m_reactionsInURR_region, a_buffer, a_mode );
m_ACE_URR_probabilityTables = serializeACE_URR_probabilityTables( m_ACE_URR_probabilityTables, a_buffer, a_mode );
std::size_t vectorSize = m_reactionCrossSections.size( );
@@ -1013,7 +1020,7 @@ LUPI_HOST void HeatedCrossSectionContinuousEnergy::print( ProtareSingle const *a
}
std::cout << std::endl;
int reactionIndex = 0;
std::size_t reactionIndex = 0;
std::cout << std::endl;
std::cout << a_indent << "# Number of reactions = " << m_reactionCrossSections.size( ) << std::endl;
for( auto iter = m_reactionCrossSections.begin( ); iter != m_reactionCrossSections.end( ); ++iter, ++reactionIndex ) {
@@ -1042,7 +1049,16 @@ LUPI_HOST_DEVICE HeatedCrossSectionsContinuousEnergy::HeatedCrossSectionsContinu
LUPI_HOST_DEVICE HeatedCrossSectionsContinuousEnergy::~HeatedCrossSectionsContinuousEnergy( ) {
clear( );
}
/* *********************************************************************************************************//**
***********************************************************************************************************/
LUPI_HOST_DEVICE void HeatedCrossSectionsContinuousEnergy::clear( ) {
for( Vector<HeatedCrossSectionContinuousEnergy *>::const_iterator iter = m_heatedCrossSections.begin( ); iter != m_heatedCrossSections.end( ); ++iter ) delete *iter;
m_heatedCrossSections.clear( );
}
/* *********************************************************************************************************//**
@@ -1075,7 +1091,7 @@ LUPI_HOST void HeatedCrossSectionsContinuousEnergy::update( LUPI_maybeUnused LUP
}
m_thresholds.resize( m_heatedCrossSections[0]->numberOfReactions( ) );
for( int i1 = 0; i1 < m_heatedCrossSections[0]->numberOfReactions( ); ++i1 ) m_thresholds[i1] = m_heatedCrossSections[0]->threshold( i1 );
for( std::size_t i1 = 0; i1 < m_heatedCrossSections[0]->numberOfReactions( ); ++i1 ) m_thresholds[i1] = m_heatedCrossSections[0]->threshold( i1 );
}
/* *********************************************************************************************************//**
@@ -1090,9 +1106,8 @@ LUPI_HOST void HeatedCrossSectionsContinuousEnergy::update( LUPI_maybeUnused LUP
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::crossSection( URR_protareInfos const &a_URR_protareInfos, int a_URR_index,
int a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double cross_section;
if( a_temperature <= m_temperatures[0] ) {
@@ -1100,7 +1115,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::crossSection( URR_p
else if( a_temperature >= m_temperatures.back( ) ) {
cross_section = m_heatedCrossSections.back( )->crossSection( a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
cross_section = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->crossSection( a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling )
+ fraction * m_heatedCrossSections[i1]->crossSection( a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling );
@@ -1122,17 +1138,16 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::crossSection( URR_p
LUPI_HOST_DEVICE void HeatedCrossSectionsContinuousEnergy::crossSectionVector( double a_temperature, double a_userFactor,
std::size_t a_numberAllocated, double *a_crossSectionVector ) const {
int number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
int index1 = 0, index2 = 0;
std::size_t index1 = 0, index2 = 0;
double fraction = 0.0;
if( a_temperature <= m_temperatures[0] ) {
}
else if( a_temperature >= m_temperatures.back( ) ) {
index1 = index2 = number_of_temperatures - 1;
index1 = index2 = m_temperatures.size( ) - 1;
fraction = 1.0; }
else {
for( ; index2 < number_of_temperatures; ++index2 ) if( a_temperature < m_temperatures[index2] ) break;
for( ; index2 < m_temperatures.size( ); ++index2 ) if( a_temperature < m_temperatures[index2] ) break;
index1 = index2 - 1;
fraction = ( a_temperature - m_temperatures[index1] ) / ( m_temperatures[index2] - m_temperatures[index1] );
}
@@ -1165,9 +1180,8 @@ LUPI_HOST GIDI::Functions::XYs1d HeatedCrossSectionsContinuousEnergy::crossSecti
else if( a_temperature >= m_temperatures.back( ) ) {
crossSection1 = m_heatedCrossSections.back( )->crossSectionAsGIDI_XYs1d( ); }
else {
int number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
int i1 = 0;
for( ; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1 = 0;
for( ; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
crossSection1 = m_heatedCrossSections[i1-1]->crossSectionAsGIDI_XYs1d( );
crossSection1 *= ( 1. - fraction );
@@ -1188,7 +1202,7 @@ LUPI_HOST GIDI::Functions::XYs1d HeatedCrossSectionsContinuousEnergy::crossSecti
* @returns A GIDI::Functions::XYs1d instance.
***********************************************************************************************************/
LUPI_HOST GIDI::Functions::XYs1d HeatedCrossSectionsContinuousEnergy::reactionCrossSectionAsGIDI_XYs1d( int a_reactionIndex,
LUPI_HOST GIDI::Functions::XYs1d HeatedCrossSectionsContinuousEnergy::reactionCrossSectionAsGIDI_XYs1d( std::size_t a_reactionIndex,
double a_temperature ) const {
GIDI::Functions::XYs1d crossSection1;
@@ -1198,9 +1212,8 @@ LUPI_HOST GIDI::Functions::XYs1d HeatedCrossSectionsContinuousEnergy::reactionCr
else if( a_temperature >= m_temperatures.back( ) ) {
crossSection1 = m_heatedCrossSections.back( )->reactionCrossSectionAsGIDI_XYs1d( a_reactionIndex ); }
else {
int number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
int i1 = 0;
for( ; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1 = 0;
for( ; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
crossSection1 = m_heatedCrossSections[i1-1]->reactionCrossSectionAsGIDI_XYs1d( a_reactionIndex );
crossSection1 *= ( 1. - fraction );
@@ -1215,10 +1228,9 @@ LUPI_HOST GIDI::Functions::XYs1d HeatedCrossSectionsContinuousEnergy::reactionCr
/*
=========================================================
*/
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index,
int a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index,
std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double cross_section;
if( a_temperature <= m_temperatures[0] ) {
@@ -1226,7 +1238,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::reactionCrossSectio
else if( a_temperature >= m_temperatures.back( ) ) {
cross_section = m_heatedCrossSections.back( )->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
cross_section = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling )
+ fraction * m_heatedCrossSections[i1]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling );
@@ -1238,10 +1251,9 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::reactionCrossSectio
/*
=========================================================
*/
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index,
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index,
double a_temperature, double a_energy_in ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double cross_section;
if( a_temperature <= m_temperatures[0] ) {
@@ -1249,7 +1261,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::reactionCrossSectio
else if( a_temperature >= m_temperatures.back( ) ) {
cross_section = m_heatedCrossSections.back( )->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_energy_in ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
cross_section = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_energy_in )
+ fraction * m_heatedCrossSections[i1]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_energy_in );
@@ -1266,9 +1279,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::reactionCrossSectio
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::depositionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::depositionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double deposition_energy;
if( a_temperature <= m_temperatures[0] ) {
@@ -1276,7 +1288,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::depositionEnergy( i
else if( a_temperature >= m_temperatures.back( ) ) {
deposition_energy = m_heatedCrossSections.back( )->depositionEnergy( a_hashIndex, a_energy ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
deposition_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->depositionEnergy( a_hashIndex, a_energy )
+ fraction * m_heatedCrossSections[i1]->depositionEnergy( a_hashIndex, a_energy );
@@ -1293,9 +1306,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::depositionEnergy( i
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::depositionMomentum( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::depositionMomentum( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double deposition_momentum;
if( a_temperature <= m_temperatures[0] ) {
@@ -1303,7 +1315,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::depositionMomentum(
else if( a_temperature >= m_temperatures.back( ) ) {
deposition_momentum = m_heatedCrossSections.back( )->depositionMomentum( a_hashIndex, a_energy ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
deposition_momentum = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->depositionMomentum( a_hashIndex, a_energy )
+ fraction * m_heatedCrossSections[i1]->depositionMomentum( a_hashIndex, a_energy );
@@ -1320,9 +1333,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::depositionMomentum(
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::productionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::productionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double production_energy;
if( a_temperature <= m_temperatures[0] ) {
@@ -1330,7 +1342,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::productionEnergy( i
else if( a_temperature >= m_temperatures.back( ) ) {
production_energy = m_heatedCrossSections.back( )->productionEnergy( a_hashIndex, a_energy ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
production_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->productionEnergy( a_hashIndex, a_energy )
+ fraction * m_heatedCrossSections[i1]->productionEnergy( a_hashIndex, a_energy );
@@ -1348,9 +1361,9 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::productionEnergy( i
* @param a_particleIndex [in] The index of the particle whose gain is requested.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::gain( int a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::gain( std::size_t a_hashIndex, double a_temperature,
double a_energy, int a_particleIndex ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double production_energy;
if( a_temperature <= m_temperatures[0] ) {
@@ -1358,7 +1371,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::gain( int a_hashInd
else if( a_temperature >= m_temperatures.back( ) ) {
production_energy = m_heatedCrossSections.back( )->gain( a_hashIndex, a_energy, a_particleIndex ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
production_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->gain( a_hashIndex, a_energy, a_particleIndex )
+ fraction * m_heatedCrossSections[i1]->gain( a_hashIndex, a_energy, a_particleIndex );
@@ -1376,9 +1390,9 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::gain( int a_hashInd
* @param a_particleIntid [in] The intid of the particle whose gain is requested.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::gainViaIntid( int a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::gainViaIntid( std::size_t a_hashIndex, double a_temperature,
double a_energy, int a_particleIntid ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double production_energy;
if( a_temperature <= m_temperatures[0] ) {
@@ -1386,7 +1400,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsContinuousEnergy::gainViaIntid( int a
else if( a_temperature >= m_temperatures.back( ) ) {
production_energy = m_heatedCrossSections.back( )->gainViaIntid( a_hashIndex, a_energy, a_particleIntid ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
production_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->gainViaIntid( a_hashIndex, a_energy, a_particleIntid )
+ fraction * m_heatedCrossSections[i1]->gainViaIntid( a_hashIndex, a_energy, a_particleIntid );
@@ -1560,7 +1575,7 @@ LUPI_HOST_DEVICE HeatedReactionCrossSectionMultiGroup::HeatedReactionCrossSectio
=========================================================
*/
LUPI_HOST HeatedReactionCrossSectionMultiGroup::HeatedReactionCrossSectionMultiGroup( SetupInfo &a_setupInfo, LUPI_maybeUnused Transporting::MC const &a_settings,
int a_offset, std::vector<double> const &a_crossSection, double a_threshold ) :
std::size_t a_offset, std::vector<double> const &a_crossSection, double a_threshold ) :
m_threshold( a_threshold ),
m_offset( a_offset ),
m_crossSections( a_crossSection ),
@@ -1588,7 +1603,7 @@ LUPI_HOST HeatedReactionCrossSectionMultiGroup::HeatedReactionCrossSectionMultiG
LUPI_HOST_DEVICE void HeatedReactionCrossSectionMultiGroup::serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode ) {
DATA_MEMBER_DOUBLE( m_threshold, a_buffer, a_mode );
DATA_MEMBER_INT( m_offset, a_buffer, a_mode );
DATA_MEMBER_SIZE_T( m_offset, a_buffer, a_mode );
DATA_MEMBER_VECTOR_DOUBLE( m_crossSections, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_augmentedThresholdCrossSection, a_buffer, a_mode );
}
@@ -1600,7 +1615,7 @@ LUPI_HOST_DEVICE void HeatedReactionCrossSectionMultiGroup::serialize( LUPI::Dat
* @param a_reactionIndex [in] The index of the reaction.
***********************************************************************************************************/
LUPI_HOST void HeatedReactionCrossSectionMultiGroup::write( FILE *a_file, int a_reactionIndex ) const {
LUPI_HOST void HeatedReactionCrossSectionMultiGroup::write( FILE *a_file, std::size_t a_reactionIndex ) const {
std::string buffer = LUPI::Misc::argumentsToString( "Reaction cross section (%3d)", a_reactionIndex );
writeVector( a_file, buffer, m_offset, m_crossSections );
@@ -1654,9 +1669,8 @@ LUPI_HOST HeatedCrossSectionMultiGroup::HeatedCrossSectionMultiGroup( LUPI::Stat
checkZeroReaction( vector, a_zeroReactions );
std::vector<double> data;
for( std::size_t i1 = start; i1 < vector.size( ); ++i1 ) data.push_back( vector[i1] );
int offset = static_cast<int>( start );
m_reactionCrossSections.push_back( new HeatedReactionCrossSectionMultiGroup( a_setupInfo, a_settings, offset, data,
m_reactionCrossSections.push_back( new HeatedReactionCrossSectionMultiGroup( a_setupInfo, a_settings, start, data,
(*reactionIter)->crossSectionThreshold( ) ) );
totalCrossSection += vector;
@@ -1684,7 +1698,7 @@ LUPI_HOST HeatedCrossSectionMultiGroup::HeatedCrossSectionMultiGroup( LUPI::Stat
std::map<std::string, GIDI::Transporting::Particle> particles = a_particles.particles( );
m_gains.resize( particles.size( ) );
int i1 = 0;
std::size_t i1 = 0;
for( std::map<std::string, GIDI::Transporting::Particle>::const_iterator particle = particles.begin( ); particle != particles.end( ); ++particle, ++i1 ) {
int particleIntid = a_setupInfo.m_particleIntids[particle->first];
int particleIndex = a_setupInfo.m_particleIndices[particle->first];
@@ -1713,7 +1727,7 @@ LUPI_HOST_DEVICE HeatedCrossSectionMultiGroup::~HeatedCrossSectionMultiGroup( )
* @return A vector of the length of the number of multi-group groups.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionMultiGroup::crossSection( int a_hashIndex, bool a_sampling ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionMultiGroup::crossSection( std::size_t a_hashIndex, bool a_sampling ) const {
double crossSection2 = m_totalCrossSection[a_hashIndex];
@@ -1731,7 +1745,7 @@ LUPI_HOST_DEVICE double HeatedCrossSectionMultiGroup::crossSection( int a_hashIn
* @return A vector of the length of the number of multi-group groups.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionMultiGroup::gain( int a_particleIndex, int a_hashIndex ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionMultiGroup::gain( std::size_t a_hashIndex, int a_particleIndex ) const {
for( std::size_t i1 = 0; i1 < m_gains.size( ); ++i1 ) {
if( a_particleIndex == m_gains[i1]->particleIndex( ) ) return( m_gains[i1]->gain( a_hashIndex ) );
@@ -1749,7 +1763,7 @@ LUPI_HOST_DEVICE double HeatedCrossSectionMultiGroup::gain( int a_particleIndex,
* @return A vector of the length of the number of multi-group groups.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionMultiGroup::gainViaIntid( int a_particleIntid, int a_hashIndex ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionMultiGroup::gainViaIntid( std::size_t a_hashIndex, int a_particleIntid ) const {
for( std::size_t i1 = 0; i1 < m_gains.size( ); ++i1 ) {
if( a_particleIntid == m_gains[i1]->particleIntid( ) ) return( m_gains[i1]->gain( a_hashIndex ) );
@@ -1857,7 +1871,7 @@ LUPI_HOST void HeatedCrossSectionMultiGroup::write( FILE *a_file ) const {
writeVector( a_file, "Production energy", 0, m_productionEnergy );
for( auto iter = m_gains.begin( ); iter != m_gains.end( ); ++iter ) (*iter)->write( a_file );
int reactionIndex = 0;
std::size_t reactionIndex = 0;
for( Vector<HeatedReactionCrossSectionMultiGroup *>::const_iterator iter = m_reactionCrossSections.begin( ); iter < m_reactionCrossSections.end( ); ++iter ) {
(*iter)->write( a_file, reactionIndex );
++reactionIndex;
@@ -1915,12 +1929,12 @@ LUPI_HOST void HeatedCrossSectionsMultiGroup::update( LUPI::StatusMessageReporti
}
m_thresholds.resize( m_heatedCrossSections[0]->numberOfReactions( ) );
for( int i1 = 0; i1 < m_heatedCrossSections[0]->numberOfReactions( ); ++i1 ) m_thresholds[i1] = m_heatedCrossSections[0]->threshold( i1 );
for( std::size_t i1 = 0; i1 < m_heatedCrossSections[0]->numberOfReactions( ); ++i1 ) m_thresholds[i1] = m_heatedCrossSections[0]->threshold( i1 );
m_multiGroupThresholdIndex.resize( m_heatedCrossSections[0]->numberOfReactions( ) );
for( int i1 = 0; i1 < m_heatedCrossSections[0]->numberOfReactions( ); ++i1 ) {
for( std::size_t i1 = 0; i1 < m_heatedCrossSections[0]->numberOfReactions( ); ++i1 ) {
m_multiGroupThresholdIndex[i1] = -1;
if( m_thresholds[i1] > 0 ) m_multiGroupThresholdIndex[i1] = m_heatedCrossSections[0]->thresholdOffset( i1 );
if( m_thresholds[i1] > 0 ) m_multiGroupThresholdIndex[i1] = static_cast<int>( m_heatedCrossSections[0]->thresholdOffset( i1 ) );
}
m_projectileMultiGroupBoundariesCollapsed = a_setupInfo.m_protare.projectileMultiGroupBoundariesCollapsed( );
@@ -1934,9 +1948,8 @@ LUPI_HOST void HeatedCrossSectionsMultiGroup::update( LUPI::StatusMessageReporti
* @param a_sampling [in] Used for multi-group look up. If *true*, use augmented cross sections.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::crossSection( int a_hashIndex, double a_temperature, bool a_sampling ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::crossSection( std::size_t a_hashIndex, double a_temperature, bool a_sampling ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double cross_section;
if( a_temperature <= m_temperatures[0] ) {
@@ -1944,7 +1957,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::crossSection( int a_hashI
else if( a_temperature >= m_temperatures.back( ) ) {
cross_section = m_heatedCrossSections.back( )->crossSection( a_hashIndex, a_sampling ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
cross_section = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->crossSection( a_hashIndex, a_sampling )
@@ -1966,17 +1980,16 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::crossSection( int a_hashI
LUPI_HOST_DEVICE void HeatedCrossSectionsMultiGroup::crossSectionVector( double a_temperature, double a_userFactor,
std::size_t a_numberAllocated, double *a_crossSectionVector ) const {
int number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
int index1 = 0, index2 = 0;
std::size_t index1 = 0, index2 = 0;
double fraction = 0.0;
if( a_temperature <= m_temperatures[0] ) {
}
else if( a_temperature >= m_temperatures.back( ) ) {
index1 = index2 = number_of_temperatures - 1;
index1 = index2 = m_temperatures.size( ) - 1;
fraction = 1.0; }
else {
for( ; index2 < number_of_temperatures; ++index2 ) if( a_temperature < m_temperatures[index2] ) break;
for( ; index2 < m_temperatures.size( ); ++index2 ) if( a_temperature < m_temperatures[index2] ) break;
index1 = index2 - 1;
fraction = ( a_temperature - m_temperatures[index1] ) / ( m_temperatures[index2] - m_temperatures[index1] );
}
@@ -2001,9 +2014,8 @@ LUPI_HOST_DEVICE void HeatedCrossSectionsMultiGroup::crossSectionVector( double
* @param a_sampling [in] If *true*, use augmented cross sections.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::reactionCrossSection( int a_reactionIndex, int a_hashIndex, double a_temperature, bool a_sampling ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::reactionCrossSection( std::size_t a_reactionIndex, std::size_t a_hashIndex, double a_temperature, bool a_sampling ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double cross_section;
if( a_temperature <= m_temperatures[0] ) {
@@ -2011,7 +2023,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::reactionCrossSection( int
else if( a_temperature >= m_temperatures.back( ) ) {
cross_section = m_heatedCrossSections.back( )->reactionCrossSection( a_reactionIndex, a_hashIndex, a_sampling ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
cross_section = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->reactionCrossSection( a_reactionIndex, a_hashIndex, a_sampling )
+ fraction * m_heatedCrossSections[i1]->reactionCrossSection( a_reactionIndex, a_hashIndex, a_sampling );
@@ -2028,15 +2041,18 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::reactionCrossSection( int
* @param a_energy_in [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::reactionCrossSection( int a_reactionIndex, double a_temperature, double a_energy_in ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::reactionCrossSection( std::size_t a_reactionIndex, double a_temperature, double a_energy_in ) const {
int energyIndex = binarySearchVector( a_energy_in, m_projectileMultiGroupBoundariesCollapsed );
int intEnergyIndex = binarySearchVector( a_energy_in, m_projectileMultiGroupBoundariesCollapsed );
std::size_t energyIndex = static_cast<std::size_t>( intEnergyIndex );
if( energyIndex < 0 ) {
energyIndex = 0;
if( energyIndex == -1 ) energyIndex = static_cast<int>( m_projectileMultiGroupBoundariesCollapsed.size( ) ) - 2;
if( intEnergyIndex == -2 ) {
energyIndex = 0; }
else {
energyIndex = m_projectileMultiGroupBoundariesCollapsed.size( ) - 2;
}
return( reactionCrossSection( a_reactionIndex, energyIndex, a_temperature, false ) );
}
@@ -2049,9 +2065,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::reactionCrossSection( int
* @return The deposition energy.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::depositionEnergy( int a_hashIndex, double a_temperature ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::depositionEnergy( std::size_t a_hashIndex, double a_temperature ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double deposition_energy;
if( a_temperature <= m_temperatures[0] ) {
@@ -2059,7 +2074,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::depositionEnergy( int a_h
else if( a_temperature >= m_temperatures.back( ) ) {
deposition_energy = m_heatedCrossSections.back( )->depositionEnergy( a_hashIndex ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
deposition_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->depositionEnergy( a_hashIndex )
+ fraction * m_heatedCrossSections[i1]->depositionEnergy( a_hashIndex );
@@ -2077,9 +2093,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::depositionEnergy( int a_h
* @return The deposition energy.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::depositionMomentum( int a_hashIndex, double a_temperature ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::depositionMomentum( std::size_t a_hashIndex, double a_temperature ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double deposition_momentum;
if( a_temperature <= m_temperatures[0] ) {
@@ -2087,7 +2102,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::depositionMomentum( int a
else if( a_temperature >= m_temperatures.back( ) ) {
deposition_momentum = m_heatedCrossSections.back( )->depositionMomentum( a_hashIndex ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
deposition_momentum = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->depositionMomentum( a_hashIndex )
+ fraction * m_heatedCrossSections[i1]->depositionMomentum( a_hashIndex );
@@ -2105,9 +2121,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::depositionMomentum( int a
* @return The deposition energy.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::productionEnergy( int a_hashIndex, double a_temperature ) const {
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::productionEnergy( std::size_t a_hashIndex, double a_temperature ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
double production_energy;
if( a_temperature <= m_temperatures[0] ) {
@@ -2115,7 +2130,8 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::productionEnergy( int a_h
else if( a_temperature >= m_temperatures.back( ) ) {
production_energy = m_heatedCrossSections.back( )->productionEnergy( a_hashIndex ); }
else {
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
production_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->productionEnergy( a_hashIndex )
@@ -2135,21 +2151,20 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::productionEnergy( int a_h
* @return The multi-group gain.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::gain( int a_hashIndex, double a_temperature, int a_particleIndex ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::gain( std::size_t a_hashIndex, double a_temperature, int a_particleIndex ) const {
if( a_temperature <= m_temperatures[0] ) {
return( m_heatedCrossSections[0]->gain( a_particleIndex, a_hashIndex ) ); }
return( m_heatedCrossSections[0]->gain( a_hashIndex, a_particleIndex ) ); }
else if( a_temperature >= m_temperatures.back( ) ) {
return( m_heatedCrossSections.back( )->gain( a_particleIndex, a_hashIndex ) );
return( m_heatedCrossSections.back( )->gain( a_hashIndex, a_particleIndex ) );
}
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
double gain1 = m_heatedCrossSections[i1-1]->gain( a_particleIndex, a_hashIndex );
double gain2 = m_heatedCrossSections[i1]->gain( a_particleIndex, a_hashIndex );
double gain1 = m_heatedCrossSections[i1-1]->gain( a_hashIndex, a_particleIndex );
double gain2 = m_heatedCrossSections[i1]->gain( a_hashIndex, a_particleIndex );
return( ( 1. - fraction ) * gain1 + fraction * gain2 );
}
@@ -2164,21 +2179,20 @@ LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::gain( int a_hashIndex, do
* @return The multi-group gain.
***********************************************************************************************************/
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::gainViaIntid( int a_hashIndex, double a_temperature, int a_particleIntid ) const {
int i1, number_of_temperatures = static_cast<int>( m_temperatures.size( ) );
LUPI_HOST_DEVICE double HeatedCrossSectionsMultiGroup::gainViaIntid( std::size_t a_hashIndex, double a_temperature, int a_particleIntid ) const {
if( a_temperature <= m_temperatures[0] ) {
return( m_heatedCrossSections[0]->gainViaIntid( a_particleIntid, a_hashIndex ) ); }
return( m_heatedCrossSections[0]->gainViaIntid( a_hashIndex, a_particleIntid ) ); }
else if( a_temperature >= m_temperatures.back( ) ) {
return( m_heatedCrossSections.back( )->gainViaIntid( a_particleIntid, a_hashIndex ) );
return( m_heatedCrossSections.back( )->gainViaIntid( a_hashIndex, a_particleIntid ) );
}
for( i1 = 0; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
std::size_t i1;
for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
double gain1 = m_heatedCrossSections[i1-1]->gainViaIntid( a_particleIntid, a_hashIndex );
double gain2 = m_heatedCrossSections[i1]->gainViaIntid( a_particleIntid, a_hashIndex );
double gain1 = m_heatedCrossSections[i1-1]->gainViaIntid( a_hashIndex, a_particleIntid );
double gain2 = m_heatedCrossSections[i1]->gainViaIntid( a_hashIndex, a_particleIntid );
return( ( 1. - fraction ) * gain1 + fraction * gain2 );
}
@@ -2278,7 +2292,7 @@ LUPI_HOST void HeatedCrossSectionsMultiGroup::write( FILE *a_file, int a_tempera
LUPI_HOST void HeatedCrossSectionsMultiGroup::print( ) const {
for( std::size_t index = 0; index < m_heatedCrossSections.size( ); ++index ) write( stdout, index );
for( std::size_t index = 0; index < m_heatedCrossSections.size( ); ++index ) write( stdout, static_cast<int>( index ) );
}
/* *********************************************************************************************************//**
@@ -2319,7 +2333,7 @@ static LUPI_HOST GIDI::Vector collapseAndcheckZeroReaction( GIDI::Vector &a_vect
* @param a_vector [in] The vector to write.
***********************************************************************************************************/
static void writeVector( FILE *a_file, std::string const &a_prefix, int a_offset, Vector<double> const &a_vector ) {
static void writeVector( FILE *a_file, std::string const &a_prefix, std::size_t a_offset, Vector<double> const &a_vector ) {
std::string indent( 20 * a_offset, ' ' );
@@ -83,7 +83,8 @@ LUPI_HOST int MCGIDI_popsIntid( PoPI::Database const &a_pops, std::string const
LUPI_HOST int MCGIDI_popsIndex( PoPI::Database const &a_pops, std::string const &a_id ) {
if( !a_pops.exists( a_id ) ) return( -1 );
return( a_pops[a_id] );
return( static_cast<int>( a_pops[a_id] ) );
}
/* *********************************************************************************************************//**
@@ -145,7 +145,7 @@ LUPI_HOST_DEVICE void NuclideGammaBranchStateInfo::serialize( LUPI::DataBuffer &
DATA_MEMBER_DOUBLE( m_nuclearLevelEnergyWidth, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_multiplicity, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_averageGammaEnergy, a_buffer, a_mode );
DATA_MEMBER_VECTOR_INT( m_branchIndices, a_buffer, a_mode );
DATA_MEMBER_VECTOR_SIZE_T( m_branchIndices, a_buffer, a_mode );
}
/* *********************************************************************************************************//**
@@ -24,6 +24,7 @@ LUPI_HOST_DEVICE Product::Product( ) :
m_intid( -1 ),
m_index( -1 ),
m_userParticleIndex( -1 ),
m_isCompleteParticle( false ),
m_mass( 0.0 ),
m_excitationEnergy( 0.0 ),
m_twoBodyOrder( TwoBodyOrder::notApplicable ),
@@ -30,7 +30,7 @@ namespace MCGIDI {
LUPI_HOST Protare *protareFromGIDIProtare( LUPI::StatusMessageReporting &a_smr, GIDI::Protare const &a_protare, PoPI::Database const &a_pops, Transporting::MC &a_settings,
GIDI::Transporting::Particles const &a_particles, DomainHash const &a_domainHash, GIDI::Styles::TemperatureInfos const &a_temperatureInfos,
std::set<int> const &a_reactionsToExclude, int a_reactionsToExcludeOffset, bool a_allowFixedGrid ) {
GIDI::ExcludeReactionsSet const &a_reactionsToExclude, std::size_t a_reactionsToExcludeOffset, bool a_allowFixedGrid ) {
Protare *protare( nullptr );
@@ -543,7 +543,7 @@ LUPI_HOST_DEVICE ProtareSingle *Protare::protare( std::size_t a_index ) {
* @return Pointer to the requested protare or nullptr if invalid *a_index*..
***********************************************************************************************************/
LUPI_HOST_DEVICE ProtareSingle const *Protare::protareWithReaction( int a_index ) const {
LUPI_HOST_DEVICE ProtareSingle const *Protare::protareWithReaction( std::size_t a_index ) const {
ProtareSingle const *protare1 = nullptr;
@@ -688,7 +688,7 @@ LUPI_HOST_DEVICE std::size_t Protare::numberOfReactions( ) const {
* @return The reaction at index *a_index*.
***********************************************************************************************************/
LUPI_HOST_DEVICE Reaction const *Protare::reaction( int a_index ) const {
LUPI_HOST_DEVICE Reaction const *Protare::reaction( std::size_t a_index ) const {
Reaction const *reaction1 = nullptr;
@@ -740,7 +740,7 @@ LUPI_HOST_DEVICE std::size_t Protare::numberOfOrphanProducts( ) const {
* @return The orphanProduct at index *a_index*.
***********************************************************************************************************/
LUPI_HOST_DEVICE Reaction const *Protare::orphanProduct( int a_index ) const {
LUPI_HOST_DEVICE Reaction const *Protare::orphanProduct( std::size_t a_index ) const {
Reaction const *orphanProduct1 = nullptr;
@@ -917,7 +917,7 @@ LUPI_HOST_DEVICE double Protare::URR_domainMax( ) const {
* @return *true* if the reaction has URR robability tables and *false* otherwise.
***********************************************************************************************************/
LUPI_HOST_DEVICE bool Protare::reactionHasURR_probabilityTables( int a_index ) const {
LUPI_HOST_DEVICE bool Protare::reactionHasURR_probabilityTables( std::size_t a_index ) const {
bool reactionHasURR_probabilityTables1 = false;
@@ -977,7 +977,7 @@ LUPI_HOST_DEVICE double Protare::threshold( std::size_t a_index ) const {
* @return The total cross section.
***********************************************************************************************************/
LUPI_HOST_DEVICE double Protare::crossSection( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
LUPI_HOST_DEVICE double Protare::crossSection( URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
double crossSection1 = 0.0;
@@ -1005,7 +1005,8 @@ LUPI_HOST_DEVICE double Protare::crossSection( URR_protareInfos const &a_URR_pro
* @param a_crossSectionVector [in/out] The energy dependent, total cross section to add cross section data to.
***********************************************************************************************************/
LUPI_HOST_DEVICE void Protare::crossSectionVector( double a_temperature, double a_userFactor, int a_numberAllocated, double *a_crossSectionVector ) const {
LUPI_HOST_DEVICE void Protare::crossSectionVector( double a_temperature, double a_userFactor, std::size_t a_numberAllocated,
double *a_crossSectionVector ) const {
switch( protareType( ) ) {
case ProtareType::single:
@@ -1034,7 +1035,7 @@ LUPI_HOST_DEVICE void Protare::crossSectionVector( double a_temperature, double
* @return The total cross section.
***********************************************************************************************************/
LUPI_HOST_DEVICE double Protare::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_hashIndex,
LUPI_HOST_DEVICE double Protare::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex,
double a_temperature, double a_energy, bool a_sampling ) const {
double reactionCrossSection1 = 0.0;
@@ -1068,7 +1069,7 @@ LUPI_HOST_DEVICE double Protare::reactionCrossSection( int a_reactionIndex, URR_
* @return The total cross section.
***********************************************************************************************************/
LUPI_HOST_DEVICE double Protare::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double Protare::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const {
double reactionCrossSection1 = 0.0;
@@ -1097,7 +1098,7 @@ LUPI_HOST_DEVICE double Protare::reactionCrossSection( int a_reactionIndex, URR_
* @return The total deposition energy.
***********************************************************************************************************/
LUPI_HOST_DEVICE double Protare::depositionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double Protare::depositionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
double depositionEnergy1 = 0.0;
@@ -1126,7 +1127,7 @@ LUPI_HOST_DEVICE double Protare::depositionEnergy( int a_hashIndex, double a_tem
* @return The total deposition momentum.
***********************************************************************************************************/
LUPI_HOST_DEVICE double Protare::depositionMomentum( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double Protare::depositionMomentum( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
double depositionMomentum1 = 0.0;
@@ -1155,7 +1156,7 @@ LUPI_HOST_DEVICE double Protare::depositionMomentum( int a_hashIndex, double a_t
* @return The total production energy.
***********************************************************************************************************/
LUPI_HOST_DEVICE double Protare::productionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double Protare::productionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
double productionEnergy1 = 0.0;
@@ -1185,7 +1186,7 @@ LUPI_HOST_DEVICE double Protare::productionEnergy( int a_hashIndex, double a_tem
* @return A vector of the length of the number of multi-group groups.
***********************************************************************************************************/
LUPI_HOST_DEVICE double Protare::gain( int a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const {
LUPI_HOST_DEVICE double Protare::gain( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const {
double gain1 = 0.0;
@@ -1215,7 +1216,7 @@ LUPI_HOST_DEVICE double Protare::gain( int a_hashIndex, double a_temperature, do
* @return A vector of the length of the number of multi-group groups.
***********************************************************************************************************/
LUPI_HOST_DEVICE double Protare::gainViaIntid( int a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const {
LUPI_HOST_DEVICE double Protare::gainViaIntid( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const {
double gain1 = 0.0;
@@ -1274,6 +1275,7 @@ LUPI_HOST_DEVICE ProtareSingle::ProtareSingle( ) :
m_hasURR_probabilityTables( false ),
m_URR_domainMin( -1.0 ),
m_URR_domainMax( -1.0 ),
m_upscatterModelASupported( false ),
m_projectileMultiGroupBoundaries( 0 ),
m_projectileMultiGroupBoundariesCollapsed( 0 ),
m_reactions( 0 ),
@@ -1296,14 +1298,18 @@ LUPI_HOST_DEVICE ProtareSingle::ProtareSingle( ) :
LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GIDI::ProtareSingle const &a_protare, PoPI::Database const &a_pops,
Transporting::MC &a_settings, GIDI::Transporting::Particles const &a_particles, DomainHash const &a_domainHash,
GIDI::Styles::TemperatureInfos const &a_temperatureInfos, std::set<int> const &a_reactionsToExclude, int a_reactionsToExcludeOffset,
bool a_allowFixedGrid ) :
GIDI::Styles::TemperatureInfos const &a_temperatureInfos, GIDI::ExcludeReactionsSet const &a_reactionsToExclude,
std::size_t a_reactionsToExcludeOffset, bool a_allowFixedGrid ) :
Protare( ProtareType::single, a_protare, a_settings, a_pops ),
m_interaction( a_protare.interaction( ).c_str( ) ),
m_URR_index( -1 ),
m_hasURR_probabilityTables( false ),
m_URR_domainMin( -1.0 ),
m_URR_domainMax( -1.0 ),
m_domainHash( a_domainHash ),
m_upscatterModelASupported( ( projectileIntid( ) != PoPI::Intids::photon ) &&
( projectileIntid( ) != PoPI::Intids::electron ) &&
!isTNSL_ProtareSingle( ) ),
m_projectileMultiGroupBoundaries( 0 ),
m_projectileMultiGroupBoundariesCollapsed( 0 ),
m_reactions( 0 ),
@@ -1400,7 +1406,7 @@ LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GID
if( a_settings.nuclearPlusCoulombInterferenceOnly( ) ) nuclearPlusCoulombInterferenceReaction = a_protare.nuclearPlusCoulombInterferenceOnlyReaction( );
for( std::size_t reactionIndex = 0; reactionIndex < a_protare.reactions( ).size( ); ++reactionIndex ) {
if( a_reactionsToExclude.find( static_cast<int>( reactionIndex + a_reactionsToExcludeOffset ) ) != a_reactionsToExclude.end( ) ) continue;
if( a_reactionsToExclude.find( reactionIndex + a_reactionsToExcludeOffset ) != a_reactionsToExclude.end( ) ) continue;
GIDI::Reaction const *GIDI_reaction = a_protare.reaction( reactionIndex );
@@ -1440,7 +1446,7 @@ LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GID
setupInfo.m_initialStateIndex = -1;
Reaction *reaction = new Reaction( **GIDI_reaction, setupInfo, a_settings, particles, a_temperatureInfos );
setupInfo.m_initialStateIndices[(*GIDI_reaction)->label( )] = setupInfo.m_initialStateIndex;
reaction->updateProtareSingleInfo( this, static_cast<int>( m_reactions.size( ) ) );
reaction->updateProtareSingleInfo( this, m_reactions.size( ) );
m_reactions.push_back( reaction );
}
@@ -1461,7 +1467,7 @@ LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GID
if( a_settings.sampleNonTransportingParticles( ) || particles.hasParticle( PoPI::IDs::photon ) ) {
setupInfo.m_reactionType = Transporting::Reaction::Type::OrphanProducts;
m_orphanProducts.reserve( a_protare.orphanProducts( ).size( ) );
std::vector< std::vector<int> > associatedOrphanProductIndices( m_reactions.size( ) );
std::vector< std::vector<std::size_t> > associatedOrphanProductIndices( m_reactions.size( ) );
for( std::size_t orphanProductIndex = 0; orphanProductIndex < a_protare.orphanProducts( ).size( ); ++orphanProductIndex ) {
GIDI::Reaction const *GIDI_reaction = a_protare.orphanProduct( orphanProductIndex );
@@ -1470,7 +1476,7 @@ LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GID
setupInfo.m_reaction = GIDI_reaction;
Reaction *orphanProductReaction = new Reaction( *GIDI_reaction, setupInfo, a_settings, particles, a_temperatureInfos );
orphanProductReaction->updateProtareSingleInfo( this, static_cast<int>( m_orphanProducts.size( ) ) );
orphanProductReaction->updateProtareSingleInfo( this, m_orphanProducts.size( ) );
m_orphanProducts.push_back( orphanProductReaction );
GIDI::Functions::Reference1d const *reference( GIDI_reaction->crossSection( ).get<GIDI::Functions::Reference1d>( 0 ) );
@@ -1498,7 +1504,7 @@ LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GID
std::string label( m_reactions[reactionIndex]->label( ).c_str( ) );
if( label == GIDI_reaction2->label( ) ) {
associatedOrphanProductIndices[reactionIndex].push_back( static_cast<int>( m_orphanProducts.size( ) ) - 1 );
associatedOrphanProductIndices[reactionIndex].push_back( m_orphanProducts.size( ) - 1 );
break;
}
}
@@ -1511,7 +1517,7 @@ LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GID
if( size > 0 ) {
std::vector<Product *> associatedOrphanProducts;
for( std::size_t index1 = 0; index1 < size; ++index1 ) {
int associatedOrphanProductIndex = associatedOrphanProductIndices[reactionIndex][index1];
std::size_t associatedOrphanProductIndex = associatedOrphanProductIndices[reactionIndex][index1];
m_orphanProducts[associatedOrphanProductIndex]->addOrphanProductToProductList( associatedOrphanProducts );
}
reaction->setOrphanProductData( associatedOrphanProductIndices[reactionIndex], associatedOrphanProducts );
@@ -1527,6 +1533,7 @@ LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GID
GIDI_orphanProducts.push_back( GIDI_reaction );
}
bool removeContinuousEnergyData = false;
if( m_continuousEnergy ) {
m_heatedCrossSections.update( a_smr, setupInfo, a_settings, particles, a_domainHash, a_temperatureInfos, GIDI_reactions, GIDI_orphanProducts,
m_fixedGrid, zeroReactions );
@@ -1536,23 +1543,70 @@ LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GID
else {
m_heatedMultigroupCrossSections.update( a_smr, a_protare, setupInfo, a_settings, particles, a_temperatureInfos, GIDI_reactions,
GIDI_orphanProducts, zeroReactions, a_reactionsToExclude );
if( ( a_settings.upscatterModelAGroupBoundaries().size( ) > 0 ) ||
( a_settings.upscatterModel( ) == Sampling::Upscatter::Model::DBRC ) ) { // Load pointwise data to recompute Model A cross sections on user-defined grid or for DBRC.
removeContinuousEnergyData = true;
m_heatedCrossSections.update( a_smr, setupInfo, a_settings, particles, a_domainHash, a_temperatureInfos, GIDI_reactions, GIDI_orphanProducts,
m_fixedGrid, zeroReactions );
}
}
if( ( PoPI::Intids::photon != projectileIntid( ) ) && ( PoPI::Intids::electron != projectileIntid( ) ) && ( a_settings.upscatterModel( ) == Sampling::Upscatter::Model::A ) ) {
GIDI::Styles::Base const *style = a_protare.styles( ).get<GIDI::Styles::Base>( a_settings.upscatterModelALabel( ) );
if( m_upscatterModelASupported && ( a_settings.upscatterModel( ) == Sampling::Upscatter::Model::A ) ) {
std::vector<double> const &upscatterModelAGroupBoundaries = a_settings.upscatterModelAGroupBoundaries( );
if( upscatterModelAGroupBoundaries.size( ) == 0 ) {
GIDI::Styles::Base const *style = a_protare.styles( ).get<GIDI::Styles::Base>( a_temperatureInfos[0].heatedMultiGroup( ) );
if( style->moniker( ) == GIDI_SnElasticUpScatterStyleChars ) style = a_protare.styles( ).get<GIDI::Styles::Base>( style->derivedStyle( ) );
if( style->moniker( ) != GIDI_heatedMultiGroupStyleChars ) throw GIDI::Exception( "Label does not yield a heatedMultiGroup style." );
if( style->moniker( ) == GIDI_SnElasticUpScatterStyleChars ) style = a_protare.styles( ).get<GIDI::Styles::Base>( style->derivedStyle( ) );
if( style->moniker( ) != GIDI_heatedMultiGroupStyleChars ) throw GIDI::Exception( "Label does not yield a heatedMultiGroup style." );
GIDI::Styles::HeatedMultiGroup const &heatedMultiGroup = *static_cast<GIDI::Styles::HeatedMultiGroup const *>( style );
std::vector<double> const &boundaries = heatedMultiGroup.groupBoundaries( a_protare.projectile( ).ID( ) );
GIDI::Styles::HeatedMultiGroup const &heatedMultiGroup = *static_cast<GIDI::Styles::HeatedMultiGroup const *>( style );
std::vector<double> const &boundaries = heatedMultiGroup.groupBoundaries( a_protare.projectile( ).ID( ) );
m_upscatterModelAGroupVelocities.resize( boundaries.size( ) );
for( std::size_t i1 = 0; i1 < boundaries.size( ); ++i1 ) m_upscatterModelAGroupVelocities[i1] = MCGIDI_particleBeta( projectileMass( ), boundaries[i1] );
m_upscatterModelAGroupEnergies.resize( boundaries.size( ) );
m_upscatterModelAGroupVelocities.resize( boundaries.size( ) );
for( std::size_t i1 = 0; i1 < boundaries.size( ); ++i1 ) {
m_upscatterModelAGroupEnergies[i1] = boundaries[i1];
m_upscatterModelAGroupVelocities[i1] = MCGIDI_particleBeta( projectileMass( ), boundaries[i1] );
}
GIDI::ExcludeReactionsSet reactionsToExclude;
auto upscatterModelACrossSectionForm = a_protare.multiGroupCrossSection( a_smr, multiGroupSettings, a_temperatureInfos[0],
reactionsToExclude, a_temperatureInfos[0].heatedMultiGroup( ) );
m_upscatterModelACrossSection.resize( upscatterModelACrossSectionForm.size( ) );
for( std::size_t i1 = 0; i1 < upscatterModelACrossSectionForm.size( ); ++i1 )
m_upscatterModelACrossSection[i1] = upscatterModelACrossSectionForm[i1]; }
else {
m_upscatterModelAGroupEnergies.reserve( upscatterModelAGroupBoundaries.size( ) );
m_upscatterModelAGroupVelocities.reserve( upscatterModelAGroupBoundaries.size( ) );
for( auto iter = upscatterModelAGroupBoundaries.begin( ); iter != upscatterModelAGroupBoundaries.end( ); ++iter ) {
m_upscatterModelAGroupEnergies.push_back( *iter );
m_upscatterModelAGroupVelocities.push_back( MCGIDI_particleBeta( projectileMass( ), *iter ) );
}
GIDI::Transporting::MultiGroup boundaries( "Model A", upscatterModelAGroupBoundaries );
GIDI::Functions::XYs1d crossSectionXYs1d = m_heatedCrossSections.crossSectionAsGIDI_XYs1d( 0.0 );
GIDI::Transporting::Flux flux( "Model A", 0.0 );
std::vector<double> energies, fluxes;
energies.push_back( upscatterModelAGroupBoundaries[0] );
energies.push_back( upscatterModelAGroupBoundaries.back( ) );
fluxes.push_back( 1.0 );
fluxes.push_back( 1.0 );
flux.addFluxOrder( GIDI::Transporting::Flux_order( 0, energies, fluxes ) );
GIDI::Vector crossSectionVector = multiGroupXYs1d( boundaries, crossSectionXYs1d, flux );
m_upscatterModelACrossSection.resize( crossSectionVector.size( ) );
for( std::size_t index = 0; index < crossSectionVector.size( ); ++index )
m_upscatterModelACrossSection[index] = crossSectionVector[index];
}
if( !m_continuousEnergy ) m_multiGroupHash = MultiGroupHash( m_projectileMultiGroupBoundariesCollapsed );
}
if( m_continuousEnergy && ( PoPI::Intids::neutron == projectileIntid( ) ) && ( a_settings.upscatterModel( ) == Sampling::Upscatter::Model::DBRC ) ) {
int reactionIndex = 0;
if( ( PoPI::Intids::neutron == projectileIntid( ) ) && ( a_settings.upscatterModel( ) == Sampling::Upscatter::Model::DBRC ) ) {
std::size_t reactionIndex = 0;
for( auto reactionIter = m_reactions.begin( ); reactionIter != m_reactions.end( ); ++reactionIter, ++reactionIndex ) {
if( (*reactionIter)->ENDF_MT( ) == 2 ) {
Reaction *reaction = *reactionIter;
@@ -1564,8 +1618,8 @@ LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GID
Vector<double> const &energies = heatedCrossSectionContinuousEnergy->energies( );
Vector<MCGIDI_FLOAT> const &crossSectionsFloat = heatedReactionCrossSectionContinuousEnergy->crossSections( );
Vector<double> crossSections( crossSectionsFloat.size( ) );
int index = 0;
for( auto iter = crossSectionsFloat.begin( ); iter != crossSectionsFloat.end( ); ++iter )
std::size_t index = 0;
for( auto iter = crossSectionsFloat.begin( ); iter != crossSectionsFloat.end( ); ++iter, ++index )
crossSections[index] = *iter;
Sampling::Upscatter::ModelDBRC_data *modelDBRC_data =
@@ -1575,6 +1629,9 @@ LUPI_HOST ProtareSingle::ProtareSingle( LUPI::StatusMessageReporting &a_smr, GID
}
}
}
if( removeContinuousEnergyData ) {
m_heatedCrossSections.clear( );
}
}
/* *********************************************************************************************************//**
@@ -1654,9 +1711,8 @@ LUPI_HOST_DEVICE ProtareSingle *ProtareSingle::protare( std::size_t a_index ) {
* @return Pointer to the requested protare or nullptr if invalid *a_index*..
***********************************************************************************************************/
LUPI_HOST_DEVICE ProtareSingle const *ProtareSingle::protareWithReaction( int a_index ) const {
LUPI_HOST_DEVICE ProtareSingle const *ProtareSingle::protareWithReaction( std::size_t a_index ) const {
if( a_index < 0 ) return( nullptr );
if( static_cast<std::size_t>( a_index ) < numberOfReactions( ) ) return( this );
return( nullptr );
}
@@ -1759,7 +1815,7 @@ LUPI_HOST_DEVICE bool ProtareSingle::inURR( double a_energy ) const {
* @param a_sampling [in] Used for multi-group look up. If *true*, use augmented cross sections.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareSingle::crossSection( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
LUPI_HOST_DEVICE double ProtareSingle::crossSection( URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.crossSection( a_URR_protareInfos, m_URR_index, a_hashIndex, a_temperature, a_energy ) );
@@ -1775,7 +1831,8 @@ LUPI_HOST_DEVICE double ProtareSingle::crossSection( URR_protareInfos const &a_U
* @param a_crossSectionVector [in/out] The energy dependent, total cross section to add cross section data to.
***********************************************************************************************************/
LUPI_HOST_DEVICE void ProtareSingle::crossSectionVector( double a_temperature, double a_userFactor, int a_numberAllocated, double *a_crossSectionVector ) const {
LUPI_HOST_DEVICE void ProtareSingle::crossSectionVector( double a_temperature, double a_userFactor, std::size_t a_numberAllocated,
double *a_crossSectionVector ) const {
if( m_continuousEnergy ) {
if( !m_fixedGrid ) LUPI_THROW( "ProtareSingle::crossSectionVector: continuous energy cannot be supported." );
@@ -1797,7 +1854,7 @@ LUPI_HOST_DEVICE void ProtareSingle::crossSectionVector( double a_temperature, d
* @param a_sampling [in] Used for multi-group look up. If *true*, use augmented cross sections.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareSingle::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_hashIndex,
LUPI_HOST_DEVICE double ProtareSingle::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex,
double a_temperature, double a_energy, bool a_sampling ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.reactionCrossSection( a_reactionIndex, a_URR_protareInfos, m_URR_index, a_hashIndex,
@@ -1815,7 +1872,7 @@ LUPI_HOST_DEVICE double ProtareSingle::reactionCrossSection( int a_reactionIndex
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareSingle::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareSingle::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.reactionCrossSection( a_reactionIndex, a_URR_protareInfos, m_URR_index, a_temperature, a_energy ) );
@@ -1831,7 +1888,7 @@ LUPI_HOST_DEVICE double ProtareSingle::reactionCrossSection( int a_reactionIndex
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareSingle::depositionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareSingle::depositionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.depositionEnergy( a_hashIndex, a_temperature, a_energy ) );
@@ -1847,7 +1904,7 @@ LUPI_HOST_DEVICE double ProtareSingle::depositionEnergy( int a_hashIndex, double
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareSingle::depositionMomentum( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareSingle::depositionMomentum( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.depositionMomentum( a_hashIndex, a_temperature, a_energy ) );
@@ -1863,7 +1920,7 @@ LUPI_HOST_DEVICE double ProtareSingle::depositionMomentum( int a_hashIndex, doub
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareSingle::productionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareSingle::productionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.productionEnergy( a_hashIndex, a_temperature, a_energy ) );
@@ -1880,7 +1937,7 @@ LUPI_HOST_DEVICE double ProtareSingle::productionEnergy( int a_hashIndex, double
* @param a_particleIndex [in] The index of the particle whose gain is to be returned.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareSingle::gain( int a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const {
LUPI_HOST_DEVICE double ProtareSingle::gain( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.gain( a_hashIndex, a_temperature, a_energy, a_particleIndex ) );
@@ -1897,7 +1954,7 @@ LUPI_HOST_DEVICE double ProtareSingle::gain( int a_hashIndex, double a_temperatu
* @param a_particleIntid [in] The intid of the particle whose gain is to be returned.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareSingle::gainViaIntid( int a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const {
LUPI_HOST_DEVICE double ProtareSingle::gainViaIntid( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const {
if( m_continuousEnergy ) return( m_heatedCrossSections.gainViaIntid( a_hashIndex, a_temperature, a_energy, a_particleIntid ) );
@@ -1922,9 +1979,14 @@ LUPI_HOST_DEVICE void ProtareSingle::serialize2( LUPI::DataBuffer &a_buffer, LUP
DATA_MEMBER_CAST( m_hasURR_probabilityTables, a_buffer, a_mode, bool );
DATA_MEMBER_DOUBLE( m_URR_domainMin, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_URR_domainMax, a_buffer, a_mode );
m_domainHash.serialize( a_buffer, a_mode );
DATA_MEMBER_VECTOR_DOUBLE( m_projectileMultiGroupBoundaries, a_buffer, a_mode );
DATA_MEMBER_VECTOR_DOUBLE( m_projectileMultiGroupBoundariesCollapsed, a_buffer, a_mode );
DATA_MEMBER_CAST( m_upscatterModelASupported, a_buffer, a_mode, bool );
DATA_MEMBER_VECTOR_DOUBLE( m_upscatterModelAGroupEnergies, a_buffer, a_mode );
DATA_MEMBER_VECTOR_DOUBLE( m_upscatterModelAGroupVelocities, a_buffer, a_mode );
DATA_MEMBER_VECTOR_DOUBLE( m_upscatterModelACrossSection, a_buffer, a_mode );
m_multiGroupHash.serialize( a_buffer, a_mode );
vectorSize = m_nuclideGammaBranchStateInfos.size( );
int vectorSizeInt = (int) vectorSize;
@@ -1999,7 +2061,7 @@ LUPI_HOST_DEVICE void ProtareSingle::serialize2( LUPI::DataBuffer &a_buffer, LUP
}
for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
m_reactions[vectorIndex]->serialize( *workingBuffer, a_mode );
m_reactions[vectorIndex]->updateProtareSingleInfo( this, static_cast<int>( vectorIndex ) );
m_reactions[vectorIndex]->updateProtareSingleInfo( this, vectorIndex );
}
vectorSize = m_orphanProducts.size( );
@@ -2027,7 +2089,7 @@ LUPI_HOST_DEVICE void ProtareSingle::serialize2( LUPI::DataBuffer &a_buffer, LUP
for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
m_orphanProducts[vectorIndex]->serialize( *workingBuffer, a_mode );
m_orphanProducts[vectorIndex]->updateProtareSingleInfo( this, static_cast<int>( vectorIndex ) );
m_orphanProducts[vectorIndex]->updateProtareSingleInfo( this, vectorIndex );
}
if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
@@ -47,7 +47,8 @@ LUPI_HOST_DEVICE ProtareComposite::ProtareComposite( ) :
LUPI_HOST ProtareComposite::ProtareComposite( LUPI::StatusMessageReporting &a_smr, GIDI::ProtareComposite const &a_protare, PoPI::Database const &a_pops,
Transporting::MC &a_settings, GIDI::Transporting::Particles const &a_particles, DomainHash const &a_domainHash,
GIDI::Styles::TemperatureInfos const &a_temperatureInfos, std::set<int> const &a_reactionsToExclude, int a_reactionsToExcludeOffset, LUPI_maybeUnused bool a_allowFixedGrid ) :
GIDI::Styles::TemperatureInfos const &a_temperatureInfos, GIDI::ExcludeReactionsSet const &a_reactionsToExclude,
std::size_t a_reactionsToExcludeOffset, LUPI_maybeUnused bool a_allowFixedGrid ) :
Protare( ProtareType::composite, a_protare, a_settings, a_pops ),
m_numberOfReactions( 0 ),
m_numberOfOrphanProducts( 0 ) {
@@ -169,12 +170,10 @@ LUPI_HOST_DEVICE ProtareSingle *ProtareComposite::protare( std::size_t a_index )
* @return Pointer to the requested protare or nullptr if invalid *a_index*..
***********************************************************************************************************/
LUPI_HOST_DEVICE ProtareSingle const *ProtareComposite::protareWithReaction( int a_index ) const {
if( a_index < 0 ) return( nullptr );
LUPI_HOST_DEVICE ProtareSingle const *ProtareComposite::protareWithReaction( std::size_t a_index ) const {
for( std::size_t i1 = 0; i1 < m_protares.size( ); ++i1 ) {
int numberOfReactions = m_protares[i1]->numberOfReactions( );
std::size_t numberOfReactions = m_protares[i1]->numberOfReactions( );
if( a_index < numberOfReactions ) return( m_protares[i1] );
a_index -= numberOfReactions;
@@ -215,12 +214,12 @@ LUPI_HOST_DEVICE Vector<double> ProtareComposite::temperatures( std::size_t a_in
* @return The reaction at index *a_index*.
***********************************************************************************************************/
LUPI_HOST_DEVICE Reaction const *ProtareComposite::reaction( int a_index ) const {
LUPI_HOST_DEVICE Reaction const *ProtareComposite::reaction( std::size_t a_index ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
for( std::size_t i1 = 0; i1 < length; ++i1 ) {
int numberOfReactions = m_protares[i1]->numberOfReactions( );
std::size_t numberOfReactions = m_protares[i1]->numberOfReactions( );
if( a_index < numberOfReactions ) return( m_protares[i1]->reaction( a_index ) );
a_index -= numberOfReactions;
@@ -238,12 +237,12 @@ LUPI_HOST_DEVICE Reaction const *ProtareComposite::reaction( int a_index ) const
* @return The reaction at index *a_index*.
***********************************************************************************************************/
LUPI_HOST_DEVICE Reaction const *ProtareComposite::orphanProduct( int a_index ) const {
LUPI_HOST_DEVICE Reaction const *ProtareComposite::orphanProduct( std::size_t a_index ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
for( std::size_t i1 = 0; i1 < length; ++i1 ) {
int numberOfReactions = m_protares[i1]->numberOfOrphanProducts( );
std::size_t numberOfReactions = m_protares[i1]->numberOfOrphanProducts( );
if( a_index < numberOfReactions ) return( m_protares[i1]->orphanProduct( a_index ) );
a_index -= numberOfReactions;
@@ -354,12 +353,12 @@ LUPI_HOST_DEVICE double ProtareComposite::URR_domainMax( ) const {
* @return *true* if the reaction has URR robability tables and false otherwise.
***********************************************************************************************************/
LUPI_HOST_DEVICE bool ProtareComposite::reactionHasURR_probabilityTables( int a_index ) const {
LUPI_HOST_DEVICE bool ProtareComposite::reactionHasURR_probabilityTables( std::size_t a_index ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
std::size_t length = m_protares.size( );
for( std::size_t i1 = 0; i1 < length; ++i1 ) {
int numberOfReactions = m_protares[i1]->numberOfReactions( );
std::size_t numberOfReactions = m_protares[i1]->numberOfReactions( );
if( a_index < numberOfReactions ) return( m_protares[i1]->reactionHasURR_probabilityTables( a_index ) );
a_index -= numberOfReactions;
@@ -404,7 +403,7 @@ LUPI_HOST_DEVICE double ProtareComposite::threshold( std::size_t a_index ) const
* @return The total cross section.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareComposite::crossSection( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
LUPI_HOST_DEVICE double ProtareComposite::crossSection( URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
double cross_section = 0.0;
@@ -423,7 +422,7 @@ LUPI_HOST_DEVICE double ProtareComposite::crossSection( URR_protareInfos const &
* @param a_crossSectionVector [in/out] The energy dependent, total cross section to add cross section data to.
***********************************************************************************************************/
LUPI_HOST_DEVICE void ProtareComposite::crossSectionVector( double a_temperature, double a_userFactor, int a_numberAllocated, double *a_crossSectionVector ) const {
LUPI_HOST_DEVICE void ProtareComposite::crossSectionVector( double a_temperature, double a_userFactor, std::size_t a_numberAllocated, double *a_crossSectionVector ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
@@ -444,13 +443,13 @@ LUPI_HOST_DEVICE void ProtareComposite::crossSectionVector( double a_temperature
* @return The total cross section.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareComposite::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
LUPI_HOST_DEVICE double ProtareComposite::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
double cross_section = 0.0;
for( std::size_t i1 = 0; i1 < length; ++i1 ) {
int numberOfReactions = m_protares[i1]->numberOfReactions( );
std::size_t numberOfReactions = m_protares[i1]->numberOfReactions( );
if( a_reactionIndex < numberOfReactions ) {
cross_section = m_protares[i1]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling );
@@ -473,13 +472,13 @@ LUPI_HOST_DEVICE double ProtareComposite::reactionCrossSection( int a_reactionIn
* @return The total cross section.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareComposite::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareComposite::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
double cross_section = 0.0;
for( std::size_t i1 = 0; i1 < length; ++i1 ) {
int numberOfReactions = m_protares[i1]->numberOfReactions( );
std::size_t numberOfReactions = m_protares[i1]->numberOfReactions( );
if( a_reactionIndex < numberOfReactions ) {
cross_section = m_protares[i1]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_temperature, a_energy );
@@ -501,7 +500,7 @@ LUPI_HOST_DEVICE double ProtareComposite::reactionCrossSection( int a_reactionIn
* @return The total deposition energy.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareComposite::depositionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareComposite::depositionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
double deposition_energy = 0.0;
@@ -521,7 +520,7 @@ LUPI_HOST_DEVICE double ProtareComposite::depositionEnergy( int a_hashIndex, dou
* @return The total deposition momentum.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareComposite::depositionMomentum( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareComposite::depositionMomentum( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
double deposition_momentum = 0.0;
@@ -541,7 +540,7 @@ LUPI_HOST_DEVICE double ProtareComposite::depositionMomentum( int a_hashIndex, d
* @return The total production energy.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareComposite::productionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareComposite::productionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
double production_energy = 0.0;
@@ -562,7 +561,7 @@ LUPI_HOST_DEVICE double ProtareComposite::productionEnergy( int a_hashIndex, dou
* @return [in] A vector of the length of the number of multi-group groups.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareComposite::gain( int a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const {
LUPI_HOST_DEVICE double ProtareComposite::gain( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
double gain1 = m_protares[0]->gain( a_hashIndex, a_temperature, a_energy, a_particleIndex );
@@ -583,7 +582,7 @@ LUPI_HOST_DEVICE double ProtareComposite::gain( int a_hashIndex, double a_temper
* @return [in] A vector of the length of the number of multi-group groups.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareComposite::gainViaIntid( int a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const {
LUPI_HOST_DEVICE double ProtareComposite::gainViaIntid( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const {
std::size_t length = static_cast<std::size_t>( m_protares.size( ) );
double gain1 = m_protares[0]->gainViaIntid( a_hashIndex, a_temperature, a_energy, a_particleIntid );
@@ -607,8 +606,8 @@ LUPI_HOST_DEVICE void ProtareComposite::serialize2( LUPI::DataBuffer &a_buffer,
int vectorSizeInt = static_cast<int>( vectorSize );
LUPI::DataBuffer *workingBuffer = &a_buffer;
DATA_MEMBER_INT( m_numberOfReactions, a_buffer, a_mode );
DATA_MEMBER_INT( m_numberOfOrphanProducts, a_buffer, a_mode );
DATA_MEMBER_SIZE_T( m_numberOfReactions, a_buffer, a_mode );
DATA_MEMBER_SIZE_T( m_numberOfOrphanProducts, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_minimumEnergy, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_maximumEnergy, a_buffer, a_mode );
@@ -631,7 +630,10 @@ LUPI_HOST_DEVICE void ProtareComposite::serialize2( LUPI::DataBuffer &a_buffer,
a_buffer.incrementPlacement( sizeof( ProtareSingle ) * vectorSize );
}
for( std::size_t i1 = 0; i1 < vectorSize; ++i1 ) m_protares[i1]->serialize2( a_buffer, a_mode );
for( std::size_t i1 = 0; i1 < vectorSize; ++i1 ) {
m_protares[i1]->serializeCommon( a_buffer, a_mode );
m_protares[i1]->serialize2( a_buffer, a_mode );
}
}
}
@@ -64,18 +64,19 @@ LUPI_HOST_DEVICE ProtareTNSL::ProtareTNSL( ) :
LUPI_HOST ProtareTNSL::ProtareTNSL( LUPI::StatusMessageReporting &a_smr, GIDI::ProtareTNSL const &a_protare, PoPI::Database const &a_pops, Transporting::MC &a_settings,
GIDI::Transporting::Particles const &a_particles, DomainHash const &a_domainHash, GIDI::Styles::TemperatureInfos const &a_temperatureInfos,
std::set<int> const &a_reactionsToExclude, int a_reactionsToExcludeOffset, LUPI_maybeUnused bool a_allowFixedGrid ) :
GIDI::ExcludeReactionsSet const &a_reactionsToExclude, std::size_t a_reactionsToExcludeOffset, LUPI_maybeUnused bool a_allowFixedGrid ) :
Protare( ProtareType::TNSL, a_protare, a_settings, a_pops ),
m_protareWithElastic( static_cast<ProtareSingle *>( protareFromGIDIProtare( a_smr, *a_protare.protare( ), a_pops, a_settings, a_particles,
a_domainHash, a_temperatureInfos, a_reactionsToExclude, a_reactionsToExcludeOffset, false ) ) ),
m_TNSL( static_cast<ProtareSingle *>( protareFromGIDIProtare( a_smr, *a_protare.TNSL( ), a_pops, a_settings, a_particles, a_domainHash,
TNSL_temperatureInfos( *a_protare.TNSL( ), a_settings ), a_reactionsToExclude, a_reactionsToExcludeOffset + static_cast<int>( m_protareWithElastic->numberOfReactions( ) ), false ) ) ),
TNSL_temperatureInfos( *a_protare.TNSL( ), a_settings ), a_reactionsToExclude, a_reactionsToExcludeOffset + m_protareWithElastic->numberOfReactions( ), false ) ) ),
m_protareWithoutElastic( nullptr ) {
std::set<int> reactionsToExclude( a_reactionsToExclude );
GIDI::ExcludeReactionsSet reactionsToExclude( a_reactionsToExclude );
reactionsToExclude.insert( 0 );
m_protareWithoutElastic = static_cast<ProtareSingle *>( protareFromGIDIProtare( a_smr, *a_protare.protare( ), a_pops, a_settings, a_particles, a_domainHash, a_temperatureInfos, reactionsToExclude ) );
m_protareWithoutElastic->setUpscatterModelASupported( false );
m_numberOfTNSLReactions = m_TNSL->numberOfReactions( );
m_TNSL_maximumEnergy = m_TNSL->maximumEnergy( );
@@ -170,13 +171,10 @@ LUPI_HOST_DEVICE ProtareSingle *ProtareTNSL::protare( std::size_t a_index ) {
* @return Pointer to the requested protare or nullptr if invalid *a_index*..
***********************************************************************************************************/
LUPI_HOST_DEVICE ProtareSingle const *ProtareTNSL::protareWithReaction( int a_index ) const {
LUPI_HOST_DEVICE ProtareSingle const *ProtareTNSL::protareWithReaction( std::size_t a_index ) const {
int index = a_index - m_numberOfTNSLReactions;
if( a_index < 0 ) return( nullptr );
if( index < 0 ) return( m_TNSL );
return( m_protareWithElastic->protareWithReaction( index ) );
if( a_index < m_numberOfTNSLReactions ) return( m_TNSL );
return( m_protareWithElastic->protareWithReaction( a_index - m_numberOfTNSLReactions ) );
}
/* *********************************************************************************************************//**
@@ -207,12 +205,10 @@ LUPI_HOST_DEVICE Vector<double> ProtareTNSL::temperatures( std::size_t a_index )
* @return The reaction at index *a_index*.
***********************************************************************************************************/
LUPI_HOST_DEVICE Reaction const *ProtareTNSL::reaction( int a_index ) const {
LUPI_HOST_DEVICE Reaction const *ProtareTNSL::reaction( std::size_t a_index ) const {
int index = a_index - m_numberOfTNSLReactions;
if( index < 0 ) return( m_TNSL->reaction( a_index ) );
return( m_protareWithElastic->reaction( index ) );
if( a_index < m_numberOfTNSLReactions ) return( m_TNSL->reaction( a_index ) );
return( m_protareWithElastic->reaction( a_index - m_numberOfTNSLReactions ) );
}
/* *********************************************************************************************************//**
@@ -223,12 +219,10 @@ LUPI_HOST_DEVICE Reaction const *ProtareTNSL::reaction( int a_index ) const {
* @return *true* if the reaction has URR robability tables and false otherwise.
***********************************************************************************************************/
LUPI_HOST_DEVICE bool ProtareTNSL::reactionHasURR_probabilityTables( int a_index ) const {
LUPI_HOST_DEVICE bool ProtareTNSL::reactionHasURR_probabilityTables( std::size_t a_index ) const {
int index = a_index - m_numberOfTNSLReactions;
if( index < 0 ) return( false );
return( m_protareWithElastic->reactionHasURR_probabilityTables( index ) );
if( a_index < m_numberOfTNSLReactions ) return( false );
return( m_protareWithElastic->reactionHasURR_probabilityTables( a_index - m_numberOfTNSLReactions ) );
}
/* *********************************************************************************************************//**
@@ -242,10 +236,8 @@ LUPI_HOST_DEVICE bool ProtareTNSL::reactionHasURR_probabilityTables( int a_index
LUPI_HOST_DEVICE double ProtareTNSL::threshold( std::size_t a_index ) const {
int index = a_index - m_numberOfTNSLReactions;
if( index < 0 ) return( m_TNSL->threshold( a_index ) );
return( m_protareWithElastic->threshold( index ) );
if( a_index < m_numberOfTNSLReactions ) return( m_TNSL->threshold( a_index ) );
return( m_protareWithElastic->threshold( a_index - m_numberOfTNSLReactions ) );
}
/* *********************************************************************************************************//**
@@ -261,7 +253,7 @@ LUPI_HOST_DEVICE double ProtareTNSL::threshold( std::size_t a_index ) const {
* @return The total cross section.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareTNSL::crossSection( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
LUPI_HOST_DEVICE double ProtareTNSL::crossSection( URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
double crossSection1 = 0.0;
@@ -284,7 +276,8 @@ LUPI_HOST_DEVICE double ProtareTNSL::crossSection( URR_protareInfos const &a_URR
* @param a_crossSectionVector [in/out] The energy dependent, total cross section to add cross section data to.
***********************************************************************************************************/
LUPI_HOST_DEVICE void ProtareTNSL::crossSectionVector( double a_temperature, double a_userFactor, int a_numberAllocated, double *a_crossSectionVector ) const {
LUPI_HOST_DEVICE void ProtareTNSL::crossSectionVector( double a_temperature, double a_userFactor, std::size_t a_numberAllocated,
double *a_crossSectionVector ) const {
if( a_temperature <= m_TNSL_maximumTemperature ) {
m_TNSL->crossSectionVector( a_temperature, a_userFactor, a_numberAllocated, a_crossSectionVector );
@@ -308,19 +301,19 @@ LUPI_HOST_DEVICE void ProtareTNSL::crossSectionVector( double a_temperature, dou
* @return The total cross section.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareTNSL::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
LUPI_HOST_DEVICE double ProtareTNSL::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling ) const {
int index = a_reactionIndex - m_numberOfTNSLReactions;
std::size_t index = a_reactionIndex - m_numberOfTNSLReactions;
double crossSection1 = 0.0;
if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
if( index < 0 ) {
if( a_reactionIndex < m_numberOfTNSLReactions ) {
crossSection1 = m_TNSL->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling ); }
else {
if( index > 0 ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling );
if( a_reactionIndex > m_numberOfTNSLReactions ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling );
} }
else {
if( index >= 0 ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling );
if( a_reactionIndex >= m_numberOfTNSLReactions ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_hashIndex, a_temperature, a_energy, a_sampling );
}
return( crossSection1 );
@@ -337,19 +330,19 @@ LUPI_HOST_DEVICE double ProtareTNSL::reactionCrossSection( int a_reactionIndex,
* @return The total cross section.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareTNSL::reactionCrossSection( int a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareTNSL::reactionCrossSection( std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, double a_temperature, double a_energy ) const {
int index = a_reactionIndex - m_numberOfTNSLReactions;
std::size_t index = a_reactionIndex - m_numberOfTNSLReactions;
double crossSection1 = 0.0;
if( ( a_energy < m_TNSL_maximumEnergy ) && ( a_temperature <= m_TNSL_maximumTemperature ) ) {
if( index < 0 ) {
if( a_reactionIndex < m_numberOfTNSLReactions ) {
crossSection1 = m_TNSL->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_temperature, a_energy ); }
else {
if( index > 0 ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_temperature, a_energy );
if( a_reactionIndex > m_numberOfTNSLReactions ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_temperature, a_energy );
} }
else {
if( index >= 0 ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_temperature, a_energy );
if( a_reactionIndex >= m_numberOfTNSLReactions ) crossSection1 = m_protareWithElastic->reactionCrossSection( index, a_URR_protareInfos, a_temperature, a_energy );
}
return( crossSection1 );
@@ -365,7 +358,7 @@ LUPI_HOST_DEVICE double ProtareTNSL::reactionCrossSection( int a_reactionIndex,
* @return The total deposition energy.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareTNSL::depositionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareTNSL::depositionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
double deposition_energy = 0.0;
@@ -389,7 +382,7 @@ LUPI_HOST_DEVICE double ProtareTNSL::depositionEnergy( int a_hashIndex, double a
* @return The total deposition momentum.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareTNSL::depositionMomentum( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareTNSL::depositionMomentum( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
double deposition_momentum = 0.0;
@@ -413,7 +406,7 @@ LUPI_HOST_DEVICE double ProtareTNSL::depositionMomentum( int a_hashIndex, double
* @return The total production energy.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareTNSL::productionEnergy( int a_hashIndex, double a_temperature, double a_energy ) const {
LUPI_HOST_DEVICE double ProtareTNSL::productionEnergy( std::size_t a_hashIndex, double a_temperature, double a_energy ) const {
double production_energy = 0.0;
@@ -438,7 +431,7 @@ LUPI_HOST_DEVICE double ProtareTNSL::productionEnergy( int a_hashIndex, double a
* @return [in] A vector of the length of the number of multi-group groups.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareTNSL::gain( int a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const {
LUPI_HOST_DEVICE double ProtareTNSL::gain( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex ) const {
double gain1 = 0.0;
@@ -463,7 +456,7 @@ LUPI_HOST_DEVICE double ProtareTNSL::gain( int a_hashIndex, double a_temperature
* @return [in] A vector of the length of the number of multi-group groups.
***********************************************************************************************************/
LUPI_HOST_DEVICE double ProtareTNSL::gainViaIntid( int a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const {
LUPI_HOST_DEVICE double ProtareTNSL::gainViaIntid( std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid ) const {
double gain1 = 0.0;
@@ -513,8 +506,11 @@ LUPI_HOST_DEVICE void ProtareTNSL::serialize2( LUPI::DataBuffer &a_buffer, LUPI:
a_buffer.incrementPlacement( sizeof( ProtareSingle ) );
a_buffer.incrementPlacement( sizeof( ProtareSingle ) );
}
m_protareWithElastic->serializeCommon( a_buffer, a_mode );
m_protareWithElastic->serialize2( a_buffer, a_mode );
m_TNSL->serializeCommon( a_buffer, a_mode );
m_TNSL->serialize2( a_buffer, a_mode );
m_protareWithoutElastic->serializeCommon( a_buffer, a_mode );
m_protareWithoutElastic->serialize2( a_buffer, a_mode );
}
@@ -21,8 +21,8 @@ namespace MCGIDI {
LUPI_HOST_DEVICE Reaction::Reaction( ) :
m_protareSingle( nullptr ),
m_reactionIndex( -1 ),
m_GIDI_reactionIndex( -1 ),
m_reactionIndex( MCGIDI_nullReaction ),
m_GIDI_reactionIndex( MCGIDI_nullReaction ),
m_label( ),
m_ENDF_MT( 0 ),
m_ENDL_C( 0 ),
@@ -34,13 +34,13 @@ LUPI_HOST_DEVICE Reaction::Reaction( ) :
m_targetMass( 0.0 ),
m_crossSectionThreshold( 0.0 ),
m_twoBodyThreshold( 0.0 ),
m_upscatterModelASupported( false ),
m_hasFinalStatePhotons( false ),
m_fissionResiduaIntid( -1 ),
m_fissionResiduaIndex( -1 ),
m_fissionResiduaUserIndex( -1 ),
m_fissionResiduals( GIDI::Construction::FissionResiduals::none ),
m_fissionResidualMass( 0.0 ),
m_totalDelayedNeutronMultiplicity( nullptr ),
#ifdef MCGIDI_USE_OUTPUT_CHANNEL
m_outputChannel( nullptr ),
#endif
@@ -64,7 +64,7 @@ LUPI_HOST_DEVICE Reaction::Reaction( ) :
LUPI_HOST Reaction::Reaction( GIDI::Reaction const &a_reaction, SetupInfo &a_setupInfo, Transporting::MC const &a_settings,
GIDI::Transporting::Particles const &a_particles, LUPI_maybeUnused GIDI::Styles::TemperatureInfos const &a_temperatureInfos ) :
m_protareSingle( nullptr ),
m_reactionIndex( -1 ),
m_reactionIndex( MCGIDI_nullReaction ),
m_GIDI_reactionIndex( a_reaction.reactionIndex( ) ),
m_label( a_reaction.label( ).c_str( ) ),
m_ENDF_MT( a_reaction.ENDF_MT( ) ),
@@ -77,9 +77,6 @@ LUPI_HOST Reaction::Reaction( GIDI::Reaction const &a_reaction, SetupInfo &a_set
m_targetMass( a_setupInfo.m_protare.targetMass( ) ),
m_crossSectionThreshold( a_reaction.crossSectionThreshold( ) ),
m_twoBodyThreshold( a_reaction.twoBodyThreshold( ) ),
m_upscatterModelASupported( ( a_setupInfo.m_protare.projectileIntid( ) != PoPI::Intids::photon ) &&
( a_setupInfo.m_protare.projectileIntid( ) != PoPI::Intids::electron ) &&
( a_setupInfo.m_reactionType == Transporting::Reaction::Type::Reactions ) ),
m_fissionResiduaIntid( -1 ),
m_fissionResiduaIndex( -1 ),
m_fissionResiduaUserIndex( -1 ),
@@ -108,7 +105,7 @@ LUPI_HOST Reaction::Reaction( GIDI::Reaction const &a_reaction, SetupInfo &a_set
m_productMultiplicities.reserve( product_ids.size( ) );
for( std::set<std::string>::iterator iter = product_ids.begin( ); iter != product_ids.end( ); ++iter ) {
m_productIntids.push_back( MCGIDI_popsIntid( a_setupInfo.m_pops, *iter ) );
m_productIndices.push_back( a_setupInfo.m_popsUser[*iter] );
m_productIndices.push_back( static_cast<int>( a_setupInfo.m_popsUser[*iter] ) );
m_userProductIndices.push_back( -1 );
m_productMultiplicities.push_back( a_reaction.productMultiplicity( *iter ) );
}
@@ -120,16 +117,10 @@ LUPI_HOST Reaction::Reaction( GIDI::Reaction const &a_reaction, SetupInfo &a_set
m_userProductIndicesTransportable.reserve( product_ids.size( ) );
for( std::set<std::string>::iterator iter = product_ids.begin( ); iter != product_ids.end( ); ++iter ) {
m_productIntidsTransportable.push_back( MCGIDI_popsIntid( a_setupInfo.m_pops, *iter ) );
m_productIndicesTransportable.push_back( a_setupInfo.m_popsUser[*iter] );
m_productIndicesTransportable.push_back( static_cast<int>( a_setupInfo.m_popsUser[*iter] ) );
m_userProductIndicesTransportable.push_back( -1 );
}
if( m_upscatterModelASupported && ( a_settings.upscatterModel( ) == Sampling::Upscatter::Model::A ) ) {
GIDI::Vector const &l_upscatterModelACrossSection = a_reaction.crossSection( ).get<GIDI::Functions::Gridded1d>( a_settings.upscatterModelALabel( ) )->data( );
m_upscatterModelACrossSection.resize( l_upscatterModelACrossSection.size( ) );
for( std::size_t i1 = 0; i1 < l_upscatterModelACrossSection.size( ); ++i1 ) m_upscatterModelACrossSection[i1] = l_upscatterModelACrossSection[i1];
}
m_hasFinalStatePhotons = a_setupInfo.m_hasFinalStatePhotons;
m_fissionResiduals = a_reaction.outputChannel( )->fissionResiduals( );
if( m_fissionResiduals == GIDI::Construction::FissionResiduals::ENDL99120 ) {
@@ -225,7 +216,7 @@ LUPI_HOST_DEVICE double Reaction::finalQ( double a_energy ) const {
* @param a_energy_in [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE double Reaction::crossSection( URR_protareInfos const &a_URR_protareInfos, int a_hashIndex, double a_temperature, double a_energy_in ) const {
LUPI_HOST_DEVICE double Reaction::crossSection( URR_protareInfos const &a_URR_protareInfos, std::size_t a_hashIndex, double a_temperature, double a_energy_in ) const {
return( m_protareSingle->reactionCrossSection( m_reactionIndex, a_URR_protareInfos, a_hashIndex, a_temperature, a_energy_in, false ) );
}
@@ -265,7 +256,7 @@ LUPI_HOST GIDI::Functions::XYs1d Reaction::crossSectionAsGIDI_XYs1d( double a_te
LUPI_HOST_DEVICE int Reaction::productMultiplicity( int a_index ) const {
int i1 = 0;
std::size_t i1 = 0;
for( Vector<int>::iterator iter = m_productIndices.begin( ); iter != m_productIndices.end( ); ++iter, ++i1 ) {
if( *iter == a_index ) return( m_productMultiplicities[i1] );
@@ -284,7 +275,7 @@ LUPI_HOST_DEVICE int Reaction::productMultiplicity( int a_index ) const {
LUPI_HOST_DEVICE int Reaction::productMultiplicityViaIntid( int a_intid ) const {
int i1 = 0;
std::size_t i1 = 0;
for( Vector<int>::iterator iter = m_productIntids.begin( ); iter != m_productIntids.end( ); ++iter, ++i1 ) {
if( *iter == a_intid ) return( m_productMultiplicities[i1] );
@@ -309,7 +300,7 @@ LUPI_HOST_DEVICE double Reaction::productAverageMultiplicity( int a_index, doubl
if( m_crossSectionThreshold > a_projectileEnergy ) return( multiplicity );
int i1 = 0;
std::size_t i1 = 0;
for( Vector<int>::iterator iter = m_productIndices.begin( ); iter != m_productIndices.end( ); ++iter, ++i1 ) {
if( *iter == a_index ) {
multiplicity = m_productMultiplicities[i1];
@@ -351,7 +342,7 @@ LUPI_HOST_DEVICE double Reaction::productAverageMultiplicityViaIntid( int a_inti
if( m_crossSectionThreshold > a_projectileEnergy ) return( multiplicity );
int i1 = 0;
std::size_t i1 = 0;
for( Vector<int>::iterator iter = m_productIntids.begin( ); iter != m_productIntids.end( ); ++iter, ++i1 ) {
if( *iter == a_intid ) {
multiplicity = m_productMultiplicities[i1];
@@ -516,7 +507,7 @@ LUPI_HOST_DEVICE void Reaction::addOrphanProductToProductList( Vector<Reaction *
* @param a_associatedOrphanProducts [in] The list of pointers to the associated orphan products.
***********************************************************************************************************/
LUPI_HOST void Reaction::setOrphanProductData( std::vector<int> const &a_associatedOrphanProductIndcies,
LUPI_HOST void Reaction::setOrphanProductData( std::vector<std::size_t> const &a_associatedOrphanProductIndcies,
std::vector<Product *> const &a_associatedOrphanProducts ) {
m_associatedOrphanProductIndices.reserve( a_associatedOrphanProductIndcies.size( ) );
@@ -538,7 +529,7 @@ LUPI_HOST void Reaction::setOrphanProductData( std::vector<int> const &a_associa
LUPI_HOST_DEVICE void Reaction::serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode ) {
DATA_MEMBER_INT( m_GIDI_reactionIndex, a_buffer, a_mode );
DATA_MEMBER_SIZE_T( m_GIDI_reactionIndex, a_buffer, a_mode );
DATA_MEMBER_STRING( m_label, a_buffer, a_mode );
DATA_MEMBER_INT( m_ENDF_MT, a_buffer, a_mode );
DATA_MEMBER_INT( m_ENDL_C, a_buffer, a_mode );
@@ -550,14 +541,12 @@ LUPI_HOST_DEVICE void Reaction::serialize( LUPI::DataBuffer &a_buffer, LUPI::Dat
DATA_MEMBER_DOUBLE( m_targetMass, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_crossSectionThreshold, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_twoBodyThreshold, a_buffer, a_mode );
DATA_MEMBER_CAST( m_upscatterModelASupported, a_buffer, a_mode, bool );
DATA_MEMBER_CAST( m_hasFinalStatePhotons, a_buffer, a_mode, bool );
DATA_MEMBER_INT( m_fissionResiduaIntid, a_buffer, a_mode );
DATA_MEMBER_INT( m_fissionResiduaIndex, a_buffer, a_mode );
DATA_MEMBER_INT( m_fissionResiduaUserIndex, a_buffer, a_mode );
serializeFissionResiduals( m_fissionResiduals, a_buffer, a_mode );
DATA_MEMBER_DOUBLE( m_fissionResidualMass, a_buffer, a_mode );
DATA_MEMBER_VECTOR_DOUBLE( m_upscatterModelACrossSection, a_buffer, a_mode );
DATA_MEMBER_VECTOR_INT( m_productIntids, a_buffer, a_mode );
DATA_MEMBER_VECTOR_INT( m_productIndices, a_buffer, a_mode );
@@ -591,7 +580,7 @@ LUPI_HOST_DEVICE void Reaction::serialize( LUPI::DataBuffer &a_buffer, LUPI::Dat
serializeDelayedNeutrons( a_buffer, a_mode, m_delayedNeutrons );
#endif
DATA_MEMBER_VECTOR_INT( m_associatedOrphanProductIndices, a_buffer, a_mode );
DATA_MEMBER_VECTOR_SIZE_T( m_associatedOrphanProductIndices, a_buffer, a_mode );
std::size_t vectorSize = m_associatedOrphanProducts.size( );
int vectorSizeInt = (int) vectorSize;
@@ -605,7 +594,7 @@ LUPI_HOST_DEVICE void Reaction::serialize( LUPI::DataBuffer &a_buffer, LUPI::Dat
if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
m_protareSingle = nullptr;
m_reactionIndex = -1;
m_reactionIndex = MCGIDI_nullReaction;
}
DATA_MEMBER_CAST( m_GRIN_specialSampleProducts, a_buffer, a_mode, bool );
@@ -36,7 +36,7 @@ namespace Sampling {
* @return The index bounding *a_energy* in the member *a_energies*.
***********************************************************************************************************/
LUPI_HOST_DEVICE int evaluationForHashIndex( int a_hashIndex, Vector<int> const &a_hashIndices, double a_energy,
LUPI_HOST_DEVICE std::size_t evaluationForHashIndex( std::size_t a_hashIndex, Vector<std::size_t> const &a_hashIndices, double a_energy,
Vector<double> const &a_energies, double *a_energyFraction ) {
*a_energyFraction = 1.0;
@@ -44,10 +44,10 @@ LUPI_HOST_DEVICE int evaluationForHashIndex( int a_hashIndex, Vector<int> const
if( a_energy <= a_energies[0] ) return( 0 );
if( a_energy >= a_energies.back( ) ) {
*a_energyFraction = 0.0;
return( (int) ( a_energies.size( ) - 2 ) );
return( ( a_energies.size( ) - 2 ) );
}
int index1 = a_hashIndices[a_hashIndex];
std::size_t index1 = a_hashIndices[a_hashIndex];
#ifdef MCGIDI_CrossSectionLinearSubSearch
while( a_energies[index1] > a_energy ) --index1; // Make sure the calls gave the correct *a_hashIndex*.
@@ -56,11 +56,11 @@ LUPI_HOST_DEVICE int evaluationForHashIndex( int a_hashIndex, Vector<int> const
#endif
#ifdef MCGIDI_CrossSectionBinarySubSearch
int index2 = a_hashIndices[a_hashIndex];
int index3 = (int) a_energies.size( ) - 1;
if( ( a_hashIndex + 1 ) < (int) a_hashIndices.size( ) ) index3 = a_hashIndices[a_hashIndex+1] + 1;
if( index3 == (int) a_energies.size( ) ) --index3;
if( index2 != index3 ) index2 = binarySearchVectorBounded( a_energy, a_energies, index2, index3, false );
std::size_t index2 = a_hashIndices[a_hashIndex];
std::size_t index3 = a_energies.size( ) - 1;
if( ( a_hashIndex + 1 ) < a_hashIndices.size( ) ) index3 = a_hashIndices[a_hashIndex+1] + 1;
if( index3 == a_energies.size( ) ) --index3;
if( index2 != index3 ) index2 = static_cast<std::size_t>( binarySearchVectorBounded( a_energy, a_energies, index2, index3, false ) );
#endif
#ifdef MCGIDI_CrossSectionBinarySubSearch
@@ -130,8 +130,8 @@ LUPI_HOST_DEVICE ModelDBRC_data::~ModelDBRC_data( ) {
LUPI_HOST_DEVICE double ModelDBRC_data::evaluate( double a_energy ) {
double energyFraction;
int hashIndex = m_domainHash.index( a_energy );
int index = evaluationForHashIndex( hashIndex, m_hashIndices, a_energy, m_energies, &energyFraction );
std::size_t hashIndex = m_domainHash.index( a_energy );
std::size_t index = evaluationForHashIndex( hashIndex, m_hashIndices, a_energy, m_energies, &energyFraction );
return( energyFraction * m_crossSections[index] + ( 1.0 - energyFraction ) * m_crossSections[index+1] );
}
@@ -170,16 +170,16 @@ LUPI_HOST_DEVICE double ModelDBRC_data::crossSectionMax( double a_energy, double
double speedMin = a_speed - 4 * a_targetThermalSpeed;
if( speedMin < 0.0 ) speedMin = 0.0;
double energyMin = 0.5 * m_neutronMass * speedMin * speedMin;
int hashIndex = m_domainHash.index( energyMin );
int indexMin = evaluationForHashIndex( hashIndex, m_hashIndices, energyMin, m_energies, &energyFraction );
std::size_t hashIndex = m_domainHash.index( energyMin );
std::size_t indexMin = evaluationForHashIndex( hashIndex, m_hashIndices, energyMin, m_energies, &energyFraction );
double speedMax = a_speed + 4 * a_targetThermalSpeed;
double energyMax = 0.5 * m_neutronMass * speedMax * speedMax;
hashIndex = m_domainHash.index( energyMax );
int indexMax = evaluationForHashIndex( hashIndex, m_hashIndices, energyMax, m_energies, &energyFraction );
if( indexMax < static_cast<int>( m_energies.size( ) ) ) ++indexMax;
std::size_t indexMax = evaluationForHashIndex( hashIndex, m_hashIndices, energyMax, m_energies, &energyFraction );
if( indexMax < m_energies.size( ) ) ++indexMax;
for( int index = indexMin; index < indexMax; ++index ) {
for( std::size_t index = indexMin; index < indexMax; ++index ) {
if( crossSectionMax2 < m_crossSections[index] ) crossSectionMax2 = m_crossSections[index];
}
@@ -200,7 +200,7 @@ LUPI_HOST_DEVICE void ModelDBRC_data::serialize( LUPI::DataBuffer &a_buffer, LUP
DATA_MEMBER_DOUBLE( m_targetMass, a_buffer, a_mode );
DATA_MEMBER_VECTOR_DOUBLE( m_energies, a_buffer, a_mode );
DATA_MEMBER_VECTOR_DOUBLE( m_crossSections, a_buffer, a_mode );
DATA_MEMBER_VECTOR_INT( m_hashIndices, a_buffer, a_mode );
DATA_MEMBER_VECTOR_SIZE_T( m_hashIndices, a_buffer, a_mode );
m_domainHash.serialize( a_buffer, a_mode );
}
@@ -265,6 +265,25 @@ LUPI_HOST_DEVICE Input::Input( bool a_wantVelocity, Upscatter::Model a_upscatter
}
/* *********************************************************************************************************//**
* This method sets the *m_temperature* and *m_modelTemperature* members to *a_temperature*, the *m_energy* and *m_modelEnergy* members
* to *a_energy*, and the *m_dataInTargetFrame* member to **false**. Ergo, this method resets members in the no upscatter mode.
*
* @param a_temperature [in] The temperature of the material.
* @param a_energy [in] The energy of the projectile.
***********************************************************************************************************/
LUPI_HOST_DEVICE void Input::setTemperatureAndEnergy( double a_temperature, double a_energy ) {
m_dataInTargetFrame = false;
m_temperature = a_temperature;
m_modelTemperature = a_temperature;
m_energy = a_energy;
m_modelEnergy = a_energy;
}
} // End of namespace Sampling.
} // End of namespace MCGIDI.
@@ -42,7 +42,6 @@ LUPI_HOST MC::MC( LUPI_maybeUnused PoPI::Database const &a_pops, std::string con
m_other1dDataLookupMode( LookupMode::Data1d::continuousEnergy ),
m_distributionLookupMode( LookupMode::Distribution::pdf_cdf ),
m_upscatterModel( Sampling::Upscatter::Model::none ),
m_upscatterModelALabel( "" ),
m_URR_mode( URR_mode::none ),
m_wantTerrellPromptNeutronDistribution( false ),
m_wantRawTNSL_distributionSampling( true ),
@@ -75,7 +74,6 @@ LUPI_HOST MC::MC( LUPI_maybeUnused PoPI::Database const &a_pops, GIDI::Protare c
m_other1dDataLookupMode( LookupMode::Data1d::continuousEnergy ),
m_distributionLookupMode( LookupMode::Distribution::pdf_cdf ),
m_upscatterModel( Sampling::Upscatter::Model::none ),
m_upscatterModelALabel( "" ),
m_URR_mode( URR_mode::none ),
m_wantTerrellPromptNeutronDistribution( false ),
m_wantRawTNSL_distributionSampling( true ),
@@ -124,16 +122,26 @@ LUPI_HOST void MC::setDistributionLookupMode( LookupMode::Distribution a_distrib
}
/* *********************************************************************************************************//**
* Sets the *m_upscatterModel* member of *this* to **Sampling::Upscatter::Model::A** and the *m_upscatterModelALabel* member
* to *a_upscatterModelALabel*.
*
* @param a_upscatterModelALabel [in] The *LookupMode::Data1d* data mode.
* This method sets the member *m_upscatterModelAGroupBoundaries* to *a_groupBoundaries*. It also checks that
* the groups are in ascending order and executes a throw if they are not.
*
* @param a_groupBoundaries [in] List of multi-group boundaries.
***********************************************************************************************************/
LUPI_HOST void MC::setUpscatterModelAGroupBoundaries( std::vector<double> const &a_groupBoundaries ) {
LUPI_HOST void MC::set_upscatterModelA( std::string const &a_upscatterModelALabel ) {
double priorValue = 0.0;
m_upscatterModel = Sampling::Upscatter::Model::A;
m_upscatterModelALabel = a_upscatterModelALabel;
for( std::size_t index = 0; index < a_groupBoundaries.size( ); ++index ) {
double value = a_groupBoundaries[index];
if( index != 0 ) {
if( value <= priorValue ) throw( "MC::setUpscatterModelAGroupBoundaries: group boundaries not in ascending order/" );
}
priorValue = value;
}
m_upscatterModelAGroupBoundaries = a_groupBoundaries;
}
}
@@ -231,18 +231,18 @@ LUPI_HOST_DEVICE int MCGIDI_strncmp( const char * s1, const char * s2, size_t n
if ( pos >= size_ ) // user must not remove trailing 0
LUPI_THROW("MCGIDI::String::erase: pos index out_of_range");
long s2 = size_;
long remain = s2 - (long) pos - len;
long s2 = (long) size_;
long remain = s2 - (long) ( pos - len );
if (remain > 0) {
// erase by overwriting
MCGIDI_memmove(p + pos, p + pos + len, remain);
MCGIDI_memmove(p + pos, p + pos + len, (size_t) remain);
}
if ( remain < 0 ) remain = 0;
// remove unused space
this->resize( pos+remain );
this->resize( pos + (size_t) remain );
}
return *this;
@@ -296,7 +296,7 @@ LUPI_HOST_DEVICE int MCGIDI_strncmp( const char * s1, const char * s2, size_t n
LUPI_HOST_DEVICE void String::my_realloc( size_type n, char ** address) {
if (address != nullptr && *address != nullptr) {
p = *address;
long delta = sizeof(char) * n;
long delta = (long) ( sizeof(char) * n );
long sub = delta % 8;
if (sub != 0) delta += (8-sub);
*address += delta;
@@ -28,7 +28,7 @@ namespace PoPI {
Alias::Alias( HAPI::Node const &a_node, Database *a_DB, Particle_class a_class ) :
IDBase( a_node, a_class ),
m_pid( a_node.attribute( PoPI_pidChars ).value( ) ),
m_pidIndex( -1 ) {
m_pidIndex( SIZE_MAX ) {
if( supportedNucleusAliases.find( ID( ) ) != supportedNucleusAliases.end( ) ) {
ParseIdInfo idInfo( supportedNucleusAliases[ID( )] );
@@ -55,7 +55,7 @@ Alias::~Alias( ) {
void Alias::toXMLList( std::vector<std::string> &a_XMLList, std::string const &a_indent1 ) const {
std::string header = a_indent1 + "<particle id=\"" + ID( ) + "\" pid=\"" + m_pid + "\"/>";
a_XMLList.push_back( header );
a_XMLList.push_back( std::move( header ) );
}
/*! \class MetaStable
@@ -101,7 +101,7 @@ void MetaStable::toXMLList( std::vector<std::string> &a_XMLList, std::string con
std::string indexStr = LUPI::Misc::argumentsToString( "%d", m_metaStableIndex );
std::string header = a_indent1 + "<metaStable id=\"" + ID( ) + "\" pid=\"" + pid( ) + "\" metaStableIndex=\"" + indexStr + "\"/>";
a_XMLList.push_back( header );
a_XMLList.push_back( std::move( header ) );
}
}
@@ -9,9 +9,6 @@
#include "PoPI.hpp"
#define PoPI_idChars "id"
#define PoPI_symbolChars "symbol"
namespace PoPI {
/*! \class Base
@@ -26,7 +23,7 @@ namespace PoPI {
Base::Base( std::string const &a_id, Particle_class a_class ) :
m_id( a_id ),
m_class( a_class ),
m_index( -1 ),
m_index( SIZE_MAX ),
m_intid( -1 ) {
}
@@ -42,7 +39,7 @@ Base::Base( std::string const &a_id, Particle_class a_class ) :
Base::Base( HAPI::Node const &a_node, std::string const &a_label, Particle_class a_class ) :
m_id( a_node.attribute( a_label.c_str( ) ).value( ) ),
m_class( a_class ),
m_index( -1 ),
m_index( SIZE_MAX ),
m_intid( -1 ) {
}
@@ -95,7 +92,7 @@ IDBase::~IDBase( ) {
* @return The index assigned to *this* by *a_DB*.
***********************************************************************************************************/
int IDBase::addToDatabase( Database *a_DB ) {
std::size_t IDBase::addToDatabase( Database *a_DB ) {
a_DB->add( this );
return( index( ) );
@@ -130,7 +127,7 @@ SymbolBase::~SymbolBase( ) {
* @return The index assigned to *this* by *a_DB*.
***********************************************************************************************************/
int SymbolBase::addToSymbols( Database *a_DB ) {
std::size_t SymbolBase::addToSymbols( Database *a_DB ) {
a_DB->addSymbol( this );
return( index( ) );
@@ -13,8 +13,6 @@
namespace PoPI {
#define PoPI_chemicalElementChars "chemicalElement"
#define PoPI_isotopesChars "isotopes"
#define PoPI_Z_Chars "Z"
static std::string emptyString( "" );
@@ -92,11 +90,11 @@ void ChemicalElement::toXMLList( std::vector<std::string> &a_XMLList, std::strin
if( size == 0 ) return;
std::string header = a_indent1 + "<chemicalElement symbol=\"" + symbol( ) + "\" Z=\"" + ZStr + "\" name=\"" + m_name + "\">";
a_XMLList.push_back( header );
a_XMLList.push_back( std::move( header ) );
std::string indent2 = a_indent1 + " ";
std::string isotopeSuite = indent2 + "<" + PoPI_isotopesChars + ">";
a_XMLList.push_back( isotopeSuite );
a_XMLList.push_back( std::move( isotopeSuite ) );
std::string indent3 = indent2 + " ";
for( std::string::size_type i1 = 0; i1 < size; ++i1 ) m_isotopes[i1].toXMLList( a_XMLList, indent3 );
@@ -966,7 +964,7 @@ std::string chemicalElementInfoFromZ( int a_Z, bool a_wantSymbol, bool a_asNucle
if( a_wantSymbol && a_asNucleus ) {
char c1[3];
c1[0] = tolower( info.c_str( )[0] );
c1[0] = static_cast<char>( tolower( info.c_str( )[0] ) );
c1[1] = 0;
c1[2] = 0;
if( info.size( ) > 1 ) c1[1] = info.c_str( )[1];
@@ -1071,7 +1069,7 @@ ParseIdInfo::ParseIdInfo( std::string const &a_id ) :
std::string symbolCap;
if( symbol.size( ) > 0 ) {
char firstChar[2];
firstChar[0] = std::toupper( symbol[0] );
firstChar[0] = static_cast<char>( std::toupper( symbol[0] ) );
firstChar[1] = 0;
std::string firstStringChar( firstChar );
symbolCap = firstStringChar + symbol.substr( 1 );
@@ -1105,7 +1103,7 @@ ParseIdInfo::ParseIdInfo( std::string const &a_id ) :
else if( symbol.size( ) > 0 ) {
m_Z = Z_FromChemicalElementSymbol( symbolCap );
if( m_Z > 0 ) {
m_symbol = symbolCap;
m_symbol = std::move( symbolCap );
m_isChemicalElement = true;
m_isSupported = true;
}
@@ -16,7 +16,6 @@
#define PoPI_leptonsChars "leptons"
#define PoPI_baryonsChars "baryons"
#define PoPI_unorthodoxesChars "unorthodoxes"
#define PoPI_chemicalElementsChars "chemicalElements"
#define MsgSize (8 * 1024)
#ifdef _WIN32
@@ -169,7 +168,7 @@ void Database::addDatabase( HAPI::Node const &a_database, LUPI_maybeUnused bool
std::vector<Alias *> unresolvedAliases2;
for( std::vector<Alias *>::iterator iter = m_unresolvedAliases.begin( ); iter != m_unresolvedAliases.end( ); ++iter ) {
std::map<std::string, int>::const_iterator pidIter = m_idsMap.find( (*iter)->pid( ) ); // Locate pid.
auto pidIter = m_idsMap.find( (*iter)->pid( ) ); // Locate pid.
if( pidIter == m_idsMap.end( ) ) {
unresolvedAliases2.push_back( *iter ); }
@@ -244,9 +243,9 @@ std::vector<std::string> Database::unresolvedAliasIds( ) const {
* @return The internal index for the specified particle.
***********************************************************************************************************/
int Database::operator[]( std::string const &a_id ) const {
std::size_t Database::operator[]( std::string const &a_id ) const {
std::map<std::string, int>::const_iterator iter = m_idsMap.find( a_id );
auto iter = m_idsMap.find( a_id );
if( iter == m_idsMap.end( ) ) {
std::string errorMessage( "particle '" + a_id + "' not in database -3." );
throw Exception( errorMessage );
@@ -264,9 +263,9 @@ int Database::operator[]( std::string const &a_id ) const {
* @return **true** is the specified index is valid and **false** otherwise.
***********************************************************************************************************/
bool Database::exists( int a_index ) const {
bool Database::exists( std::size_t a_index ) const {
if( ( a_index < 0 ) || ( a_index >= (int) m_list.size( ) ) ) return( false );
if( a_index >= m_list.size( ) ) return( false );
return( true );
}
@@ -280,7 +279,7 @@ bool Database::exists( int a_index ) const {
bool Database::exists( std::string const &a_id ) const {
std::map<std::string, int>::const_iterator iter = m_idsMap.find( a_id );
auto iter = m_idsMap.find( a_id );
return( iter != m_idsMap.end( ) );
}
@@ -329,7 +328,7 @@ std::vector<std::string> Database::aliasReferences( std::string const &a_id ) {
std::string Database::final( std::string const &a_id, bool a_returnAtMetaStableAlias ) const {
int index( final( (*this)[a_id], a_returnAtMetaStableAlias ) );
std::size_t index( final( (*this)[a_id], a_returnAtMetaStableAlias ) );
return( m_list[index]->ID( ) );
}
@@ -345,7 +344,7 @@ std::string Database::final( std::string const &a_id, bool a_returnAtMetaStableA
* @return The revolved index for *a_index*.
***********************************************************************************************************/
int Database::final( int a_index, bool a_returnAtMetaStableAlias ) const {
std::size_t Database::final( std::size_t a_index, bool a_returnAtMetaStableAlias ) const {
while( isAlias( a_index ) ) {
if( a_returnAtMetaStableAlias && isMetaStableAlias( a_index ) ) break;
@@ -368,13 +367,13 @@ std::string Database::chemicalElementSymbol( std::string const &a_id ) const {
std::string symbol1;
Base const *base = nullptr;
std::map<std::string, int>::const_iterator iter = m_idsMap.find( a_id );
auto iter = m_idsMap.find( a_id );
if( iter != m_idsMap.end( ) ) {
std::string finalId = final( a_id );
iter = m_idsMap.find( finalId );
base = m_list[iter->second]; }
else {
std::map<std::string,int>::const_iterator iter2 = m_symbolMap.find( a_id );
auto iter2 = m_symbolMap.find( a_id );
if( iter2 != m_symbolMap.end( ) ) base = m_symbolList[iter2->second];
}
@@ -401,14 +400,14 @@ std::string Database::isotopeSymbol( std::string const &a_id ) const {
std::string symbol1;
Base const *base = nullptr;
std::map<std::string, int>::const_iterator iter = m_idsMap.find( a_id );
auto iter = m_idsMap.find( a_id );
if( iter != m_idsMap.end( ) ) {
std::string finalId = final( a_id );
iter = m_idsMap.find( finalId );
base = m_list[iter->second]; }
else {
std::map<std::string,int>::const_iterator iter2 = m_symbolMap.find( a_id );
auto iter2 = m_symbolMap.find( a_id );
if( iter2 != m_symbolMap.end( ) ) base = m_symbolList[iter2->second];
}
@@ -449,7 +448,7 @@ int Database::intid( std::string const &a_id ) const {
* @return The intid for *a_index* or -1 if *a_index* not in *this*.
***********************************************************************************************************/
int Database::intid( int a_index ) const {
int Database::intid( std::size_t a_index ) const {
int intid2 = -1;
@@ -473,16 +472,14 @@ int Database::intid( int a_index ) const {
* @return The intid for *a_index* or -1 if *a_index* not in *this*.
***********************************************************************************************************/
int Database::indexFromIntid( int a_intid ) const {
int index2 = -1;
std::size_t Database::indexFromIntid( int a_intid ) const {
auto iter = m_intidsMap.find( a_intid );
if( iter != m_intidsMap.end( ) ) {
index2 = iter->second;
if( iter == m_intidsMap.end( ) ) {
throw Exception( "Intid " + LUPI::Misc::argumentsToString( "%d", a_intid ) + " not in pops" );
}
return( index2 );
return( iter->second );
}
/* *********************************************************************************************************//**
@@ -493,9 +490,9 @@ int Database::indexFromIntid( int a_intid ) const {
* @return The index for the added **PoPI::Base** instance.
***********************************************************************************************************/
int Database::add( Base *a_item ) {
std::size_t Database::add( Base *a_item ) {
int index = (int) m_list.size( );
std::size_t index = m_list.size( );
m_idsMap[a_item->ID( )] = index;
m_list.push_back( a_item );
@@ -516,11 +513,11 @@ int Database::add( Base *a_item ) {
***********************************************************************************************************/
int Database::addSymbol( SymbolBase *a_item ) {
std::size_t Database::addSymbol( SymbolBase *a_item ) {
if( a_item->Class( ) == Particle_class::chemicalElement ) return( this->add( a_item ) );
int index = (int) m_symbolList.size( );
std::size_t index = m_symbolList.size( );
m_symbolMap[a_item->symbol( )] = index;
m_symbolList.push_back( a_item );
@@ -538,7 +535,7 @@ int Database::addSymbol( SymbolBase *a_item ) {
***********************************************************************************************************/
void Database::calculateNuclideGammaBranchStateInfos( NuclideGammaBranchStateInfos &a_nuclideGammaBranchStateInfos, Database const *a_pops2,
std::vector<std::string> a_extraGammaBranchStates ) const {
std::vector<std::string> &a_extraGammaBranchStates ) const {
calculateNuclideGammaBranchStateInfos2( a_nuclideGammaBranchStateInfos );
@@ -623,11 +620,11 @@ void Database::toXMLList( std::vector<std::string> &a_XMLList, std::string const
std::string indent3 = indent2 + " ";
std::string header1 = a_indent1 + "<PoPs name=\"" + m_name + "\" version=\"" + m_version + "\" format=\"" + m_formatVersion.format( ) + "\">";
a_XMLList.push_back( header1 );
a_XMLList.push_back( std::move( header1 ) );
if( m_aliases.size( ) > 0 ) {
std::string header2 = indent2 + "<" + PoPI_aliasesChars + ">";
a_XMLList.push_back( header2 );
a_XMLList.push_back( std::move( header2 ) );
for( std::vector<Alias *>::const_iterator iter = m_aliases.begin( ); iter != m_aliases.end( ); ++iter )
(*iter)->toXMLList( a_XMLList, indent3 );
appendXMLEnd( a_XMLList, PoPI_aliasesChars );
@@ -649,16 +646,16 @@ void Database::toXMLList( std::vector<std::string> &a_XMLList, std::string const
void Database::print( bool a_printIndices ) {
for( std::map<std::string,int>::const_iterator iter = m_idsMap.begin( ); iter != m_idsMap.end( ); ++iter ) {
for( auto iter = m_idsMap.begin( ); iter != m_idsMap.end( ); ++iter ) {
std::string label( iter->first );
int index = iter->second;
std::size_t index = iter->second;
Base *item = m_list[index];
std::string is_alias( "" );
std::string mass( "" );
if( item->isAlias( ) ) {
is_alias = " is an alias (final is label = '";
int finalIndex = final( index );
std::size_t finalIndex = final( index );
IDBase const &myfinal = get<IDBase>( finalIndex );
is_alias += std::string( myfinal.ID( ) );
is_alias += std::string( "')" ); }
@@ -65,7 +65,7 @@ void DecayData::toXMLList( std::vector<std::string> &a_XMLList, std::string cons
if( size == 0 ) return;
std::string header = a_indent1 + "<" + PoPI_decayDataChars + ">";
a_XMLList.push_back( header );
a_XMLList.push_back( std::move( header ) );
if( size > 0 ) {
std::string indent2 = a_indent1 + " ";
@@ -133,7 +133,7 @@ void DecayMode::calculateNuclideGammaBranchStateInfo( PoPI::Database const &a_po
void DecayMode::toXMLList( std::vector<std::string> &a_XMLList, std::string const &a_indent1 ) const {
std::string header = a_indent1 + "<decayMode label=\"" + m_label + "\" mode=\"" + m_mode + "\">";
a_XMLList.push_back( header );
a_XMLList.push_back( std::move( header ) );
std::string indent2 = a_indent1 + " ";
m_probability.toXMLList( a_XMLList, indent2 );
@@ -181,7 +181,7 @@ void Decay::toXMLList( std::vector<std::string> &a_XMLList, std::string const &a
if( m_mode != "" ) header += " mode=\"" + m_mode + "\"";
if( m_complete ) header += " mode=\"true\"";
header += ">";
a_XMLList.push_back( header );
a_XMLList.push_back( std::move( header ) );
std::string indent2 = a_indent1 + " ";
m_products.toXMLList( a_XMLList, indent2 );
@@ -218,7 +218,7 @@ Product::~Product( ) {
void Product::toXMLList( std::vector<std::string> &a_XMLList, std::string const &a_indent1 ) const {
std::string header = a_indent1 + "<product label=\"" + m_label + "\" pid=\"" + m_pid + "\"/>";
a_XMLList.push_back( header );
a_XMLList.push_back( std::move( header ) );
}
/*! \class GammaDecayData
@@ -246,9 +246,9 @@ GammaDecayData::GammaDecayData( HAPI::Node const &a_node ) :
std::string text = LUPI::Misc::stripString( data.text( ).get( ) );
auto cells = LUPI::Misc::splitString( text, ' ', true );
m_ids.reserve( m_rows );
m_probabilities.reserve( m_rows );
m_photonEmissionProbabilities.reserve( m_rows );
m_ids.reserve( static_cast<std::size_t>( m_rows ) );
m_probabilities.reserve( static_cast<std::size_t>( m_rows ) );
m_photonEmissionProbabilities.reserve( static_cast<std::size_t>( m_rows ) );
for( std::size_t cellIndex = 0; cellIndex < cells.size( ); cellIndex += 3 ) {
m_ids.push_back( cells[cellIndex] );
m_probabilities.push_back( std::stod( cells[cellIndex+1] ) );
@@ -272,7 +272,7 @@ void GammaDecayData::calculateNuclideGammaBranchStateInfo( PoPI::Database const
Particle const &initialState = a_pops.get<Particle>( a_nuclideGammaBranchStateInfo.state( ) );
double initialStateMass = initialState.massValue( "amu" );
for( int index = 0; index < m_rows; ++index ) {
for( std::size_t index = 0; index < static_cast<std::size_t>( m_rows ); ++index ) {
std::string residualState( m_ids[index] );
double _probability = m_probabilities[index];
double _photonEmissionProbabilities = m_photonEmissionProbabilities[index];
@@ -81,6 +81,7 @@ ParseIntidInfo::ParseIntidInfo( int a_intid, bool a_GRIN_mode ) :
m_AAA( -1 ),
m_ZZZ( -1 ),
m_III( -1 ),
m_nuclearLevelIndex( -1 ),
m_metaStableIndex( -1 ),
m_generation( -1 ),
m_isNeutrino( false ),
@@ -7,12 +7,11 @@
# <<END-copyright>>
*/
#include "PoPI.hpp"
#include <PoPI.hpp>
namespace PoPI {
#define PoPI_A_Chars "A"
#define PoPI_isotopeChars "isotope"
/*! \class Isotope
* This class represents **PoPs** isotope instance.
@@ -91,11 +90,11 @@ void Isotope::toXMLList( std::vector<std::string> &a_XMLList, std::string const
std::string AStr = LUPI::Misc::argumentsToString( "%d", m_A );
std::string header = a_indent1 + "<isotope symbol=\"" + symbol( ) + "\" A=\"" + AStr + "\">";
a_XMLList.push_back( header );
a_XMLList.push_back( std::move( header ) );
std::string indent2 = a_indent1 + " ";
std::string nuclideSuite = indent2 + "<" + PoPI_nuclidesChars + ">";
a_XMLList.push_back( nuclideSuite );
a_XMLList.push_back( std::move( nuclideSuite ) );
std::string indent3 = indent2 + " ";
for( std::string::size_type i1 = 0; i1 < size; ++i1 ) m_nuclides[i1].toXMLList( a_XMLList, indent3 );
@@ -79,7 +79,7 @@ void appendXMLEnd( std::vector<std::string> &a_XMLList, std::string const &a_lab
std::string specialParticleID( SpecialParticleID_mode a_mode, std::string const &a_id ) {
static std::string firstChars( "pdthaH" );
int iid = 0;
std::size_t iid = 0;
if( a_id.size( ) > 3 ) return( a_id );
@@ -180,7 +180,7 @@ int particleZ( Base const &a_particle, bool a_isNeutronProtonANucleon ) {
* @return The Z returned by **particleZ( Base const &, bool )**.
***********************************************************************************************************/
int particleZ( Database const &a_pops, int a_index, bool a_isNeutronProtonANucleon ) {
int particleZ( Database const &a_pops, std::size_t a_index, bool a_isNeutronProtonANucleon ) {
int Z = 0;
Base const &base( a_pops.get<Base>( a_pops.final( a_index ) ) );
@@ -256,7 +256,7 @@ int particleA( Base const &a_particle, bool a_isNeutronProtonANucleon ) {
* @return The A returned by **particleA( Base const &, bool )**.
***********************************************************************************************************/
int particleA( Database const &a_pops, int a_index, bool a_isNeutronProtonANucleon ) {
int particleA( Database const &a_pops, std::size_t a_index, bool a_isNeutronProtonANucleon ) {
Base const &particle( a_pops.get<Base>( a_pops.final( a_index ) ) );
@@ -314,7 +314,7 @@ int particleZA( Base const &a_particle, bool a_isNeutronProtonANucleon ) {
* @return The ZA returned by **particleZA( Base const &, bool )**.
***********************************************************************************************************/
int particleZA( Database const &a_pops, int a_index, bool a_isNeutronProtonANucleon ) {
int particleZA( Database const &a_pops, std::size_t a_index, bool a_isNeutronProtonANucleon ) {
Base const &particle( a_pops.get<Base>( a_pops.final( a_index ) ) );
@@ -367,7 +367,7 @@ int particleMetaStableIndex( Base const &a_particle ) {
* @return The meta-stable index of the particle
***********************************************************************************************************/
int particleMetaStableIndex( Database const &a_pops, int a_index ) {
int particleMetaStableIndex( Database const &a_pops, std::size_t a_index ) {
Base const &object( a_pops.get<Base>( a_pops.final( a_index ) ) );
@@ -106,7 +106,7 @@ double Nucleus::energy( std::string const &a_unit ) const {
std::cerr << std::endl << "Particle " << ID( ) << " missing energy node, please report to PoPs maintainer. Using 0.0 and continuing." << std::endl;
return( 0.0 );
}
PQ_double *pq = dynamic_cast<PQ_double *>( m_energy[0] );
PQ_double *pq = static_cast<PQ_double *>( m_energy[0] );
if( pq->unit( ) == "eV" ) return( pq->value( ) * 1e-6 ); // Kludge until units are functional.
return( pq->value( a_unit ) );
}
@@ -108,10 +108,10 @@ double Nuclide::massValue( char const *a_unit ) const {
PQ_double const *pq_mass;
if( mass( ).size( ) > 0 ) {
pq_mass = dynamic_cast<PQ_double const *>( mass( )[0] ); }
pq_mass = static_cast<PQ_double const *>( mass( )[0] ); }
else {
if( baseMass( ).size( ) == 0 ) throw Exception( "nuclide::massValue: no mass in level 0 for particle '" + ID( ) + "'." );
pq_mass = dynamic_cast<PQ_double const *>( baseMass( )[0] );
pq_mass = static_cast<PQ_double const *>( baseMass( )[0] );
}
double _mass = pq_mass->value( a_unit );
@@ -50,7 +50,8 @@ NuclideGammaBranchInfo::NuclideGammaBranchInfo( NuclideGammaBranchInfo const &a_
================= NuclideGammaBranchStateInfo ================
============================================================
*/
NuclideGammaBranchStateInfo::NuclideGammaBranchStateInfo( std::string a_state, int a_intid, std::string const &a_kind, double a_nuclearLevelEnergy ) :
NuclideGammaBranchStateInfo::NuclideGammaBranchStateInfo( std::string const &a_state, int a_intid, std::string const &a_kind,
double a_nuclearLevelEnergy ) :
m_state( a_state ),
m_intid( a_intid ),
m_kind( a_kind ),

Some files were not shown because too many files have changed in this diff Show More