Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/MCGIDI_functions.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002 # <<BEGIN-copyright>>
0003 # Copyright 2019, Lawrence Livermore National Security, LLC.
0004 # This file is part of the gidiplus package (https://github.com/LLNL/gidiplus).
0005 # gidiplus is licensed under the MIT license (see https://opensource.org/licenses/MIT).
0006 # SPDX-License-Identifier: MIT
0007 # <<END-copyright>>
0008 */
0009 
0010 #ifndef MCGIDI_functions_hpp_included
0011 #define MCGIDI_functions_hpp_included 1
0012 
0013 #include <nf_utilities.h>
0014 #include <ptwXY.h>
0015 #include <LUPI_dataBuffer.hpp>
0016 
0017 namespace MCGIDI {
0018 
0019 enum class Interpolation { LINLIN, LINLOG, LOGLIN, LOGLOG, FLAT, OTHER };
0020 enum class Function1dType { none, constant, XYs, polyomial, gridded, regions, branching, TerrellFissionNeutronMultiplicityModel };
0021 enum class Function2dType { none, XYs };
0022 enum class ProbabilityBase1dType { none, xs_pdf_cdf };
0023 enum class ProbabilityBase2dType { none, XYs, regions, isotropic, discreteGamma, primaryGamma, recoil, NBodyPhaseSpace, evaporation, 
0024         generalEvaporation, simpleMaxwellianFission, Watt, weightedFunctionals };
0025 
0026 enum class ProbabilityBase3dType { none, XYs };
0027 
0028 namespace Functions {
0029 
0030 /*
0031 ============================================================
0032 ====================== FunctionBase ========================
0033 ============================================================
0034 */
0035 class FunctionBase {
0036 
0037     private:
0038         int m_dimension;
0039         double m_domainMin;
0040         double m_domainMax;
0041         Interpolation m_interpolation;
0042         double m_outerDomainValue;
0043 
0044     public:
0045         LUPI_HOST_DEVICE FunctionBase( );
0046         LUPI_HOST   FunctionBase( GIDI::Functions::FunctionForm const &a_function );
0047         LUPI_HOST_DEVICE FunctionBase( int a_dimension, double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue = 0 );
0048         LUPI_HOST_DEVICE virtual ~FunctionBase( ) = 0;
0049 
0050         LUPI_HOST_DEVICE Interpolation interpolation( ) const { return( m_interpolation ); }
0051         LUPI_HOST_DEVICE double domainMin( ) const { return( m_domainMin ); }
0052         LUPI_HOST_DEVICE double domainMax( ) const { return( m_domainMax ); }
0053         LUPI_HOST_DEVICE double outerDomainValue( ) const { return( m_outerDomainValue ); }
0054         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0055 };
0056 
0057 /*
0058 ============================================================
0059 ======================== Function1d ========================
0060 ============================================================
0061 */
0062 class Function1d : public FunctionBase {
0063 
0064     protected:
0065         Function1dType m_type;
0066 
0067     public:
0068         LUPI_HOST_DEVICE Function1d( );
0069         LUPI_HOST_DEVICE Function1d( double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue = 0 );
0070         LUPI_HOST_DEVICE ~Function1d( );
0071 
0072         LUPI_HOST_DEVICE Function1dType type( ) const { return( m_type ); }
0073         LUPI_HOST_DEVICE String typeString( ) const ;
0074 
0075         template <typename RNG>
0076         LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION int sampleBoundingInteger( double a_x1, RNG && a_rng ) const ;
0077         LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate( double a_x1 ) const MCGIDI_TRUE_VIRTUAL;
0078         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0079 };
0080 
0081 /*
0082 ============================================================
0083 ====================== Function1d_d1 =======================
0084 ============================================================
0085 */
0086 class Function1d_d1 : public Function1d {
0087 
0088     public:
0089         LUPI_HOST_DEVICE Function1d_d1( ) :
0090             Function1d( ) { }
0091         LUPI_HOST_DEVICE Function1d_d1( double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue = 0 ) :
0092                 Function1d( a_domainMin, a_domainMax, a_interpolation, a_outerDomainValue ) { }
0093 
0094         LUPI_HOST_DEVICE double evaluate( double a_x1 ) const ;
0095 };
0096 
0097 /*
0098 ============================================================
0099 ====================== Function1d_d2 =======================
0100 ============================================================
0101 */
0102 class Function1d_d2 : public Function1d_d1 {
0103 
0104     public:
0105         LUPI_HOST_DEVICE Function1d_d2( ) :
0106             Function1d_d1( ) { }
0107         LUPI_HOST_DEVICE Function1d_d2( double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue = 0 ) :
0108                 Function1d_d1( a_domainMin, a_domainMax, a_interpolation, a_outerDomainValue ) { }
0109 
0110         LUPI_HOST_DEVICE double evaluate( double a_x1 ) const ;
0111 };
0112 
0113 /*
0114 ============================================================
0115 ======================== Constant1d ========================
0116 ============================================================
0117 */
0118 class Constant1d : public Function1d_d2 {
0119 
0120     private:
0121         double m_value;
0122 
0123     public:
0124         LUPI_HOST_DEVICE Constant1d( );
0125         LUPI_HOST_DEVICE Constant1d( double a_domainMin, double a_domainMax, double a_value, double a_outerDomainValue = 0 );
0126         LUPI_HOST Constant1d( GIDI::Functions::Constant1d const &a_constant1d );
0127         LUPI_HOST_DEVICE ~Constant1d( );
0128 
0129         LUPI_HOST_DEVICE double evaluate( LUPI_maybeUnused double a_x1 ) const { return( m_value ); }
0130         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0131 };
0132 
0133 /*
0134 ============================================================
0135 =========================== XYs1d ==========================
0136 ============================================================
0137 */
0138 class XYs1d : public Function1d_d2 {
0139 
0140     private:
0141         Vector<double> m_Xs;
0142         Vector<double> m_Ys;
0143 
0144     public:
0145         LUPI_HOST_DEVICE XYs1d( );
0146         LUPI_HOST XYs1d( Interpolation a_interpolation, Vector<double> a_Xs, Vector<double> a_Ys, double a_outerDomainValue = 0 );
0147         LUPI_HOST XYs1d( GIDI::Functions::XYs1d const &a_XYs1d );
0148         LUPI_HOST_DEVICE ~XYs1d( );
0149 
0150         LUPI_HOST_DEVICE double evaluate( double a_x1 ) const ;
0151         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0152 };
0153 
0154 /*
0155 ============================================================
0156 ======================= Polynomial1d =======================
0157 ============================================================
0158 */          
0159 class Polynomial1d : public Function1d_d2 {
0160 
0161     private:
0162         Vector<double> m_coefficients;
0163         Vector<double> m_coefficientsReversed;
0164 
0165     public:
0166         LUPI_HOST_DEVICE Polynomial1d( );
0167         LUPI_HOST Polynomial1d( double a_domainMin, double a_domainMax, Vector<double> const &a_coefficients, double a_outerDomainValue = 0 );
0168         LUPI_HOST Polynomial1d( GIDI::Functions::Polynomial1d const &a_polynomial1d );
0169         LUPI_HOST_DEVICE ~Polynomial1d( );
0170 
0171         LUPI_HOST_DEVICE Vector<double> const &coefficients( ) const { return( m_coefficients ); }
0172         LUPI_HOST_DEVICE double evaluate( double a_x1 ) const ;
0173         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0174 };
0175 
0176 /*
0177 ============================================================
0178 ========================= Gridded1d ========================
0179 ============================================================
0180 */
0181 class Gridded1d : public Function1d_d2 {
0182 
0183     private:
0184         Vector<double> m_grid;
0185         Vector<double> m_data;
0186 
0187     public:
0188         LUPI_HOST_DEVICE Gridded1d( );
0189         LUPI_HOST Gridded1d( GIDI::Functions::Gridded1d const &a_gridded1d );
0190         LUPI_HOST_DEVICE ~Gridded1d( );
0191 
0192         LUPI_HOST_DEVICE double evaluate( double a_x1 ) const ;
0193         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0194 };
0195 
0196 /*
0197 ============================================================
0198 ========================= Regions1d ========================
0199 ============================================================
0200 */
0201 class Regions1d : public Function1d_d1 {
0202 
0203     private:
0204         Vector<double> m_Xs;
0205         Vector<Function1d_d2 *> m_functions1d;
0206 
0207     public:
0208         LUPI_HOST_DEVICE Regions1d( );
0209         LUPI_HOST Regions1d( GIDI::Functions::Regions1d const &a_regions1d );
0210         LUPI_HOST_DEVICE ~Regions1d( );
0211 
0212         LUPI_HOST_DEVICE void append( Function1d_d2 *a_function1d );
0213         LUPI_HOST_DEVICE double evaluate( double a_x1 ) const ;
0214         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0215 };
0216 
0217 /*
0218 ============================================================
0219 ======================== Branching1d =======================
0220 ============================================================
0221 */
0222 class Branching1d : public Function1d_d2 {
0223 
0224     private:
0225         int m_initialStateIndex;
0226 
0227     public:
0228         LUPI_HOST_DEVICE Branching1d( );
0229         LUPI_HOST Branching1d( SetupInfo &a_setupInfo, GIDI::Functions::Branching1d const &a_branching1d );
0230         LUPI_HOST_DEVICE ~Branching1d( );
0231 
0232         LUPI_HOST_DEVICE int initialStateIndex( ) const { return( m_initialStateIndex ); }
0233 
0234         LUPI_HOST_DEVICE double evaluate( double a_x1 ) const ;
0235         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0236 };
0237 
0238 /*
0239 ============================================================
0240 ========== TerrellFissionNeutronMultiplicityModel ==========
0241 ============================================================
0242 */
0243 class TerrellFissionNeutronMultiplicityModel : public Function1d {
0244 
0245     private:
0246         double m_width;
0247         Function1d_d1 *m_multiplicity;
0248 
0249     public:
0250         LUPI_HOST_DEVICE TerrellFissionNeutronMultiplicityModel( );
0251         LUPI_HOST TerrellFissionNeutronMultiplicityModel( double a_width, Function1d_d1 *a_multiplicity );
0252         LUPI_HOST_DEVICE ~TerrellFissionNeutronMultiplicityModel( );
0253 
0254         template <typename RNG>
0255         LUPI_HOST_DEVICE int sampleBoundingInteger( double a_energy, RNG && a_rng ) const ;
0256         LUPI_HOST_DEVICE double evaluate( double a_energy ) const ;
0257         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0258 };
0259 
0260 /*
0261 ============================================================
0262 ======================== Function2d ========================
0263 ============================================================
0264 */
0265 class Function2d : public FunctionBase {
0266 
0267     protected:
0268         Function2dType m_type;
0269 
0270     public:
0271         LUPI_HOST_DEVICE Function2d( );
0272         LUPI_HOST Function2d( double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue = 0 );
0273         LUPI_HOST_DEVICE ~Function2d( );
0274 
0275         LUPI_HOST_DEVICE Function2dType type( ) const { return m_type; }
0276         LUPI_HOST_DEVICE String typeString( ) const ;
0277 
0278         LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate( double a_x2, double a_x1 ) const MCGIDI_TRUE_VIRTUAL;
0279         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0280 };
0281 
0282 /*
0283 ============================================================
0284 =========================== XYs2d ==========================
0285 ============================================================
0286 */
0287 class XYs2d : public Function2d {
0288 
0289     private:
0290         Vector<double> m_Xs;
0291         Vector<Function1d_d1 *> m_functions1d;
0292 
0293     public:
0294         LUPI_HOST_DEVICE XYs2d( );
0295         LUPI_HOST XYs2d( GIDI::Functions::XYs2d const &a_XYs2d );
0296         LUPI_HOST_DEVICE ~XYs2d( );
0297 
0298         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0299         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0300 };
0301 
0302 /*
0303 ============================================================
0304 ========================== others ==========================
0305 ============================================================
0306 */
0307 LUPI_HOST Function1d *parseMultiplicityFunction1d( SetupInfo &a_setupInfo, Transporting::MC const &a_settings, GIDI::Suite const &a_suite );
0308 LUPI_HOST Function1d_d1 *parseFunction1d_d1( Transporting::MC const &a_settings, GIDI::Suite const &a_suite );
0309 LUPI_HOST Function1d_d1 *parseFunction1d_d1( GIDI::Functions::Function1dForm const *form1d );
0310 LUPI_HOST Function1d_d2 *parseFunction1d_d2( GIDI::Functions::Function1dForm const *form1d );
0311 LUPI_HOST Function2d *parseFunction2d( Transporting::MC const &a_settings, GIDI::Suite const &a_suite );
0312 LUPI_HOST Function2d *parseFunction2d( GIDI::Functions::Function2dForm const *form2d );
0313 
0314 }           // End of namespace Functions.
0315 
0316 /*
0317 ============================================================
0318 ============================================================
0319 ================== namespace Probabilities ==================
0320 ============================================================
0321 ============================================================
0322 */
0323 namespace Probabilities {
0324 
0325 /*
0326 ============================================================
0327 ===================== ProbabilityBase ======================
0328 ============================================================
0329 */
0330 class ProbabilityBase : public Functions::FunctionBase {
0331 
0332     protected:
0333         Vector<double> m_Xs;
0334 
0335     public:
0336 
0337         LUPI_HOST_DEVICE ProbabilityBase( );
0338         LUPI_HOST ProbabilityBase( GIDI::Functions::FunctionForm const &a_probabilty );
0339         LUPI_HOST ProbabilityBase( GIDI::Functions::FunctionForm const &a_probabilty, Vector<double> const &a_Xs );
0340         LUPI_HOST_DEVICE ~ProbabilityBase( );
0341         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0342 };
0343 
0344 /*
0345 ============================================================
0346 ===================== ProbabilityBase1d ====================
0347 ============================================================
0348 */
0349 class ProbabilityBase1d : public ProbabilityBase {
0350 
0351     protected:
0352         ProbabilityBase1dType m_type;
0353 
0354     public:
0355         LUPI_HOST_DEVICE ProbabilityBase1d( );
0356         LUPI_HOST ProbabilityBase1d( GIDI::Functions::FunctionForm const &a_probabilty, Vector<double> const &a_Xs );
0357         LUPI_HOST_DEVICE ~ProbabilityBase1d( );
0358 
0359         LUPI_HOST_DEVICE ProbabilityBase1dType type( ) const { return m_type; }
0360         LUPI_HOST_DEVICE String typeString( ) const ;
0361 
0362         LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate( double a_x1 ) const MCGIDI_TRUE_VIRTUAL;
0363         template <typename RNG>
0364         LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double sample( double a_rngValue, RNG && a_rng ) const MCGIDI_TRUE_VIRTUAL;
0365         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0366 };
0367 
0368 /*
0369 ============================================================
0370 ======================= Xs_pdf_cdf1d =======================
0371 ============================================================
0372 */
0373 class Xs_pdf_cdf1d : public ProbabilityBase1d {
0374 
0375     private:
0376         Vector<double> m_pdf;
0377         Vector<double> m_cdf;
0378 
0379     public:
0380         LUPI_HOST_DEVICE Xs_pdf_cdf1d( );
0381         LUPI_HOST Xs_pdf_cdf1d( GIDI::Functions::Xs_pdf_cdf1d const &a_xs_pdf_cdf1d );
0382         LUPI_HOST_DEVICE ~Xs_pdf_cdf1d( );
0383 
0384         LUPI_HOST_DEVICE double evaluate( double a_x1 ) const ;
0385         template <typename RNG>
0386         LUPI_HOST_DEVICE double sample( double a_rngValue, RNG && a_rng ) const ;
0387         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0388 };
0389 
0390 /*
0391 ============================================================
0392 ===================== ProbabilityBase2d ====================
0393 ============================================================
0394 */
0395 class ProbabilityBase2d : public ProbabilityBase {
0396 
0397     protected:
0398         ProbabilityBase2dType m_type;
0399 
0400     public:
0401         LUPI_HOST_DEVICE ProbabilityBase2d( );
0402         LUPI_HOST ProbabilityBase2d( GIDI::Functions::FunctionForm const &a_probabilty );
0403         LUPI_HOST ProbabilityBase2d( GIDI::Functions::FunctionForm const &a_probabilty, Vector<double> const &a_Xs );
0404         LUPI_HOST_DEVICE ~ProbabilityBase2d( );
0405 
0406         LUPI_HOST_DEVICE ProbabilityBase2dType type( ) const { return m_type; }
0407         LUPI_HOST_DEVICE String typeString( ) const ;
0408 
0409         LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate( double a_x2, double a_x1 ) const MCGIDI_TRUE_VIRTUAL;
0410         template <typename RNG>
0411         LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double sample( double a_x2, double a_rngValue, RNG && a_rng ) const MCGIDI_TRUE_VIRTUAL;
0412         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0413 };
0414 
0415 /*
0416 ============================================================
0417 =================== ProbabilityBase2d_d1 ===================
0418 ============================================================
0419 */
0420 class ProbabilityBase2d_d1 : public ProbabilityBase2d {
0421 
0422     public:
0423         LUPI_HOST_DEVICE ProbabilityBase2d_d1( ) :
0424                 ProbabilityBase2d( ) { }
0425         LUPI_HOST ProbabilityBase2d_d1( GIDI::Functions::FunctionForm const &a_probabilty ) :
0426                 ProbabilityBase2d( a_probabilty ) { }
0427         LUPI_HOST ProbabilityBase2d_d1( GIDI::Functions::FunctionForm const &a_probabilty, Vector<double> const &a_Xs ) :
0428                 ProbabilityBase2d( a_probabilty, a_Xs ) { }
0429 
0430         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0431         template <typename RNG>
0432         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0433         template <typename RNG>
0434         LUPI_HOST_DEVICE double sample2dOf3d( double a_x2, double a_rngValue, RNG && a_rng, double *a_x1_1, double *a_x1_2 ) const ;
0435 };
0436 
0437 /*
0438 ============================================================
0439 =================== ProbabilityBase2d_d2 ===================
0440 ============================================================
0441 */
0442 class ProbabilityBase2d_d2 : public ProbabilityBase2d_d1 {
0443 
0444     public:
0445         LUPI_HOST_DEVICE ProbabilityBase2d_d2( ) :
0446                 ProbabilityBase2d_d1( ) { }
0447         LUPI_HOST ProbabilityBase2d_d2( GIDI::Functions::FunctionForm const &a_probabilty ) :
0448                 ProbabilityBase2d_d1( a_probabilty ) { }
0449         LUPI_HOST ProbabilityBase2d_d2( GIDI::Functions::FunctionForm const &a_probabilty, Vector<double> const &a_Xs ) :
0450                 ProbabilityBase2d_d1( a_probabilty, a_Xs ) { }
0451 
0452         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0453         template <typename RNG>
0454         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0455         template <typename RNG>
0456         LUPI_HOST_DEVICE double sample2dOf3d( double a_x2, double a_rngValue, RNG && a_rng, double *a_x1_1, double *a_x1_2 ) const ;
0457 };
0458 
0459 /*
0460 ============================================================
0461 ========================== XYs2d ===========================
0462 ============================================================
0463 */
0464 class XYs2d : public ProbabilityBase2d_d2 {
0465 
0466     private:
0467         Vector<ProbabilityBase1d *> m_probabilities;
0468 
0469     public:
0470         LUPI_HOST_DEVICE XYs2d( );
0471         LUPI_HOST XYs2d( GIDI::Functions::XYs2d const &a_XYs2d );
0472         LUPI_HOST_DEVICE ~XYs2d( );
0473 
0474         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0475         template <typename RNG>
0476         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0477         template <typename RNG>
0478         LUPI_HOST_DEVICE double sample2dOf3d( double a_x2, double a_rngValue, RNG && a_rng, double *a_x1_1, double *a_x1_2 ) const ;
0479         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0480 };
0481 
0482 /*
0483 ============================================================
0484 ======================== Regions2d =========================
0485 ============================================================
0486 */
0487 class Regions2d : public ProbabilityBase2d_d1 {
0488 
0489     private:
0490         Vector<ProbabilityBase2d_d2 *> m_probabilities;
0491 
0492     public:
0493         LUPI_HOST_DEVICE Regions2d( );
0494         LUPI_HOST Regions2d( GIDI::Functions::Regions2d const &a_regions2d );
0495         LUPI_HOST_DEVICE ~Regions2d( );
0496 
0497         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0498         template <typename RNG>
0499         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0500         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0501 };
0502 
0503 /*
0504 ============================================================
0505 ======================== Isotropic2d =======================
0506 ============================================================
0507 */
0508 class Isotropic2d : public ProbabilityBase2d_d2 {
0509 
0510     public:
0511         LUPI_HOST_DEVICE Isotropic2d( );
0512         LUPI_HOST Isotropic2d( GIDI::Functions::Isotropic2d const &a_isotropic2d );
0513         LUPI_HOST_DEVICE ~Isotropic2d( );
0514 
0515         LUPI_HOST_DEVICE double evaluate( LUPI_maybeUnused double a_x2, LUPI_maybeUnused double a_x1 ) const { return( 0.5 ); }
0516         template <typename RNG>
0517         LUPI_HOST_DEVICE double sample( LUPI_maybeUnused double a_x2, double a_rngValue, LUPI_maybeUnused RNG && a_rng ) const { return( 1. - 2. * a_rngValue ); }
0518         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode ) { 
0519             ProbabilityBase2d::serialize( a_buffer, a_mode ); }
0520 };
0521 
0522 /*
0523 ============================================================
0524 ====================== DiscreteGamma2d =====================
0525 ============================================================
0526 */
0527 class DiscreteGamma2d : public ProbabilityBase2d_d2 {
0528 
0529     private:
0530         double m_value;
0531 
0532     public:
0533         LUPI_HOST_DEVICE DiscreteGamma2d( );
0534         LUPI_HOST DiscreteGamma2d( GIDI::Functions::DiscreteGamma2d const &a_discreteGamma2d );
0535         LUPI_HOST_DEVICE ~DiscreteGamma2d( );
0536 
0537         LUPI_HOST_DEVICE double evaluate( LUPI_maybeUnused double a_x2, LUPI_maybeUnused double a_x1 ) const { return( m_value ); }        // FIXME This is wrong, should be something like 1 when domainMin <= a_x1 <= domainMax ), I think. I.e., should be a probability.
0538         template <typename RNG>
0539         LUPI_HOST_DEVICE double sample( LUPI_maybeUnused double a_x2, LUPI_maybeUnused double a_rngValue, LUPI_maybeUnused RNG && a_rng ) const { return( m_value ); }
0540         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0541 };
0542 
0543 /*
0544 ============================================================
0545 ====================== PrimaryGamma2d =====================
0546 ============================================================
0547 */
0548 class PrimaryGamma2d : public ProbabilityBase2d_d2 {
0549 
0550     private:
0551         double m_primaryEnergy;
0552         double m_massFactor;
0553         String m_finalState;
0554         int m_initialStateIndex;
0555 
0556     public:
0557         LUPI_HOST_DEVICE PrimaryGamma2d( );
0558         LUPI_HOST PrimaryGamma2d( GIDI::Functions::PrimaryGamma2d const &a_primaryGamma2d, SetupInfo *a_setupInfo );
0559         LUPI_HOST_DEVICE ~PrimaryGamma2d( );
0560 
0561         double primaryEnergy( ) const { return( m_primaryEnergy ); }                /**< Returns the value of the *m_primaryEnergy* member. */
0562         double massFactor( ) const { return( m_massFactor ); }                      /**< Returns the value of the *m_massFactor* member. */
0563         String const &finalState( ) const { return( m_finalState ); }               /**< Returns a const reference to the *m_finalState* member. */
0564         int initialStateIndex( ) const { return( m_initialStateIndex ); }           /**< Returns the value of the *m_initialStateIndex* member. */
0565 
0566         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0567         template <typename RNG>
0568         LUPI_HOST_DEVICE double sample( double a_x2, LUPI_maybeUnused double a_rngValue, LUPI_maybeUnused RNG && a_rng ) const { return( m_primaryEnergy + a_x2 * m_massFactor ); }
0569         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0570 };
0571 
0572 /*
0573 ============================================================
0574 ========================= Recoil2d =========================
0575 ============================================================
0576 */
0577 class Recoil2d: public ProbabilityBase2d_d2 {
0578 
0579     private:
0580         String m_xlink;
0581 
0582     public:
0583         LUPI_HOST_DEVICE Recoil2d( );
0584         LUPI_HOST Recoil2d( GIDI::Functions::Recoil2d const &a_recoil2d );
0585         LUPI_HOST_DEVICE ~Recoil2d( );
0586 
0587         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0588         template <typename RNG>
0589         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0590         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0591 };
0592 
0593 /*
0594 ============================================================
0595 ==================== NBodyPhaseSpace2d =====================
0596 ============================================================
0597 */
0598 class NBodyPhaseSpace2d : public ProbabilityBase2d_d2 {
0599 
0600     private:
0601         int m_numberOfProducts;
0602         double m_mass;
0603         double m_energy_in_COMFactor;
0604         double m_massFactor;
0605         double m_Q;
0606         ProbabilityBase1d *m_dist;
0607 
0608     public:
0609         LUPI_HOST_DEVICE NBodyPhaseSpace2d( );
0610         LUPI_HOST NBodyPhaseSpace2d( GIDI::Functions::NBodyPhaseSpace2d const &a_NBodyPhaseSpace2d, SetupInfo *a_setupInfo );
0611         LUPI_HOST_DEVICE ~NBodyPhaseSpace2d( );
0612 
0613         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0614         template <typename RNG>
0615         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0616         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0617 };
0618 
0619 /*
0620 ============================================================
0621 ====================== Evaporation2d =======================
0622 ============================================================
0623 */
0624 class Evaporation2d: public ProbabilityBase2d_d2 {
0625 
0626     private:
0627         double m_U;
0628         Functions::Function1d_d1 *m_theta;
0629 
0630     public:
0631         LUPI_HOST_DEVICE Evaporation2d( );
0632         LUPI_HOST Evaporation2d( GIDI::Functions::Evaporation2d const &a_generalEvaporation2d );
0633         LUPI_HOST_DEVICE ~Evaporation2d( );
0634 
0635         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0636         template <typename RNG>
0637         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0638         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0639 };
0640 
0641 /*
0642 ============================================================
0643 =================== GeneralEvaporation2d ===================
0644 ============================================================
0645 */
0646 class GeneralEvaporation2d: public ProbabilityBase2d_d2 {
0647 
0648     private:
0649         Functions::Function1d_d1 *m_theta;
0650         ProbabilityBase1d *m_g;
0651 
0652     public:
0653         LUPI_HOST_DEVICE GeneralEvaporation2d( );
0654         LUPI_HOST GeneralEvaporation2d( GIDI::Functions::GeneralEvaporation2d const &a_generalEvaporation2d );
0655         LUPI_HOST_DEVICE ~GeneralEvaporation2d( );
0656 
0657         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0658         template <typename RNG>
0659         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0660         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0661 };
0662 
0663 /*
0664 ============================================================
0665 ================= SimpleMaxwellianFission2d ================
0666 ============================================================
0667 */
0668 class SimpleMaxwellianFission2d: public ProbabilityBase2d_d2 {
0669 
0670     private:
0671         double m_U;
0672         Functions::Function1d_d1 *m_theta;
0673 
0674     public:
0675         LUPI_HOST_DEVICE SimpleMaxwellianFission2d( );
0676         LUPI_HOST SimpleMaxwellianFission2d( GIDI::Functions::SimpleMaxwellianFission2d const &a_simpleMaxwellianFission2d );
0677         LUPI_HOST_DEVICE ~SimpleMaxwellianFission2d( );
0678 
0679         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0680         template <typename RNG>
0681         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0682         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0683 };
0684 
0685 /*
0686 ============================================================
0687 ========================== Watt2d ==========================
0688 ============================================================
0689 */
0690 class Watt2d : public ProbabilityBase2d_d2 {
0691 
0692     private:
0693         double m_U;
0694         Functions::Function1d_d1 *m_a;
0695         Functions::Function1d_d1 *m_b;
0696 
0697     public:
0698         LUPI_HOST_DEVICE Watt2d( );
0699         LUPI_HOST Watt2d( GIDI::Functions::Watt2d const &a_Watt2d );
0700         LUPI_HOST_DEVICE ~Watt2d( );
0701 
0702         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0703         template <typename RNG>
0704         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0705         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0706 };
0707 
0708 /*
0709 ============================================================
0710 =================== WeightedFunctionals2d ==================
0711 ============================================================
0712 */
0713 class WeightedFunctionals2d: public ProbabilityBase2d {
0714 
0715     private:
0716       Vector<Functions::Function1d_d1 *> m_weight;
0717       Vector<ProbabilityBase2d_d1 *> m_energy;
0718 
0719     public:
0720         LUPI_HOST_DEVICE WeightedFunctionals2d( );
0721         LUPI_HOST WeightedFunctionals2d( GIDI::Functions::WeightedFunctionals2d const &a_weightedFunctionals2d );
0722         LUPI_HOST_DEVICE ~WeightedFunctionals2d( );
0723 
0724         LUPI_HOST_DEVICE double evaluate( double a_x2, double a_x1 ) const ;
0725         template <typename RNG>
0726         LUPI_HOST_DEVICE double sample( double a_x2, double a_rngValue, RNG && a_rng ) const ;
0727         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0728 };
0729 
0730 /*
0731 ============================================================
0732 ===================== ProbabilityBase3d ====================
0733 ============================================================
0734 */
0735 class ProbabilityBase3d : public ProbabilityBase {
0736 
0737     protected:
0738         ProbabilityBase3dType m_type;
0739 
0740     public:
0741         LUPI_HOST_DEVICE ProbabilityBase3d( );
0742         LUPI_HOST ProbabilityBase3d( GIDI::Functions::FunctionForm const &a_probabilty, Vector<double> const &a_Xs );
0743         LUPI_HOST_DEVICE ~ProbabilityBase3d( );
0744 
0745         LUPI_HOST_DEVICE ProbabilityBase3dType type( ) const { return m_type; }
0746         LUPI_HOST_DEVICE String typeString( ) const ;
0747 
0748         LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate( double a_x3, double a_x2, double a_x1 ) const MCGIDI_TRUE_VIRTUAL;
0749         template <typename RNG>
0750         LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double sample( double a_x3, double a_x2_1, double a_x2_2, double a_rngValue, RNG && a_rng ) const MCGIDI_TRUE_VIRTUAL;
0751         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0752 };
0753 
0754 /*
0755 ============================================================
0756 ========================== XYs3d ===========================
0757 ============================================================
0758 */
0759 class XYs3d : public ProbabilityBase3d {
0760 
0761     private:
0762         Vector<ProbabilityBase2d_d1 *> m_probabilities;
0763 
0764     public:
0765         LUPI_HOST_DEVICE XYs3d( );
0766         LUPI_HOST XYs3d( GIDI::Functions::XYs3d const &a_XYs3d );
0767         LUPI_HOST_DEVICE ~XYs3d( );
0768 
0769         LUPI_HOST_DEVICE double evaluate( double a_x3, double a_x2, double a_x1 ) const ;
0770         template <typename RNG>
0771         LUPI_HOST_DEVICE double sample( double a_x3, double a_x2_1, double a_x2_2, double a_rngValue, RNG && a_rng ) const ;
0772         LUPI_HOST_DEVICE void serialize( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode );
0773 };
0774 
0775 /*
0776 ============================================================
0777 ========================== others ==========================
0778 ============================================================
0779 */
0780 LUPI_HOST ProbabilityBase1d *parseProbability1d( Transporting::MC const &a_settings, GIDI::Suite const &a_suite );
0781 LUPI_HOST ProbabilityBase1d *parseProbability1d( GIDI::Functions::Function1dForm const *form1d );
0782 LUPI_HOST ProbabilityBase2d *parseProbability2d( Transporting::MC const &a_settings, GIDI::Suite const &a_suite, SetupInfo *a_setupInfo );
0783 LUPI_HOST ProbabilityBase2d *parseProbability2d( GIDI::Functions::Function2dForm const *form2d, SetupInfo *a_setupInfo );
0784 LUPI_HOST ProbabilityBase2d_d1 *parseProbability2d_d1( GIDI::Functions::Function2dForm const *form2d, SetupInfo *a_setupInfo );
0785 LUPI_HOST ProbabilityBase2d_d2 *parseProbability2d_d2( GIDI::Functions::Function2dForm const *form2d, SetupInfo *a_setupInfo );
0786 LUPI_HOST ProbabilityBase3d *parseProbability3d( Transporting::MC const &a_settings, GIDI::Suite const &a_suite );
0787 LUPI_HOST ProbabilityBase3d *parseProbability3d( GIDI::Functions::Function3dForm const *form3d );
0788 
0789 
0790 }           // End of namespace Probabilities.
0791 
0792 /*
0793 ============================================================
0794 ========================== others ==========================
0795 ============================================================
0796 */
0797 LUPI_HOST_DEVICE Interpolation GIDI2MCGIDI_interpolation( ptwXY_interpolation a_interpolation );
0798 
0799 LUPI_HOST_DEVICE Function1dType Function1dClass( Functions::Function1d *funct );
0800 LUPI_HOST_DEVICE Functions::Function1d *serializeFunction1d( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Functions::Function1d *a_function1d );
0801 LUPI_HOST_DEVICE Functions::Function1d_d1 *serializeFunction1d_d1( LUPI::DataBuffer &a_buffer, 
0802                 LUPI::DataBuffer::Mode a_mode, Functions::Function1d_d1 *a_function1d );
0803 LUPI_HOST_DEVICE Functions::Function1d_d2 *serializeFunction1d_d2( LUPI::DataBuffer &a_buffer, 
0804                 LUPI::DataBuffer::Mode a_mode, Functions::Function1d_d2 *a_function1d );
0805 
0806 LUPI_HOST_DEVICE Function2dType Function2dClass( Functions::Function2d *funct );
0807 LUPI_HOST_DEVICE Functions::Function2d *serializeFunction2d( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Functions::Function2d *a_function2d );
0808 
0809 LUPI_HOST_DEVICE ProbabilityBase1dType ProbabilityBase1dClass( Probabilities::ProbabilityBase1d *funct );
0810 LUPI_HOST_DEVICE Probabilities::ProbabilityBase1d *serializeProbability1d( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase1d *a_probability1d );
0811 
0812 LUPI_HOST_DEVICE ProbabilityBase2dType ProbabilityBase2dClass( Probabilities::ProbabilityBase2d *funct );
0813 LUPI_HOST_DEVICE Probabilities::ProbabilityBase2d *serializeProbability2d( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, 
0814                 Probabilities::ProbabilityBase2d *a_probability2d );
0815 LUPI_HOST_DEVICE Probabilities::ProbabilityBase2d_d1 *serializeProbability2d_d1( LUPI::DataBuffer &a_buffer, 
0816                 LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase2d_d1 *a_probability2d );
0817 LUPI_HOST_DEVICE Probabilities::ProbabilityBase2d_d2 *serializeProbability2d_d2( LUPI::DataBuffer &a_buffer, 
0818                 LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase2d_d2 *a_probability2d );
0819 
0820 LUPI_HOST_DEVICE ProbabilityBase3dType ProbabilityBase3dClass( Probabilities::ProbabilityBase3d *funct );
0821 LUPI_HOST_DEVICE Probabilities::ProbabilityBase3d *serializeProbability3d( LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase3d *a_probability3d );
0822 
0823 }           // End of namespace MCGIDI.
0824 
0825 #endif      // End of MCGIDI_functions_hpp_included