Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ 4 : /* */ 5 : /* Copyright 2017 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #pragma once 10 : 11 : #include "MultiIndex.h" 12 : #include "mytrim/ion.h" 13 : 14 : /** 15 : * Implements a discrete PDF for sampling 16 : * PKAs 17 : */ 18 : class DiscretePKAPDFBase 19 : { 20 : public: 21 : /// default constructor 22 0 : DiscretePKAPDFBase() {} 23 : 24 : /// constructor setting all necessary values 25 : DiscretePKAPDFBase(const std::vector<unsigned int> & ZAID, const std::vector<Real> & energies); 26 : 27 : /// Uses the discrete probabilities for sampling the initial pka state 28 : virtual void drawSample(std::vector<MyTRIM_NS::IonBase> & initial_state) const = 0; 29 : 30 : /// accessor for getting the magnitude of this DiscretePKAPDF 31 : Real getMagnitude() const { return _magnitude; } 32 : 33 : protected: 34 : /// NOTE: we pass by value here because we modify probabilities in the function for convenience 35 : virtual void precomputeCDF(MultiIndex<Real> probabilities) = 0; 36 : 37 : /// this method computes the magnitude but we cannot implement this in the base class 38 : virtual void computeMagnitude(MultiIndex<Real> probabilities) = 0; 39 : 40 : ///@{ helper function to draw a sample from a marginal probability function, returns "bin" id 41 : unsigned int sampleHelper(const MultiIndex<Real> & marginal_pdf) const; 42 : unsigned int sampleHelper(const MultiIndex<Real> & marginal_pdf, 43 : const std::vector<unsigned int> indices) const; 44 : unsigned int sampleHelper(const std::vector<Real> & marginal_pdf) const; 45 : ///@} 46 : 47 : /// magnitude for correct scaling with potential other DiscretePKAPDFBase objects 48 : Real _magnitude; 49 : 50 : /// vector storing the Z,A values in ZAID form 51 : std::vector<unsigned int> _zaids; 52 : 53 : /// number of zaids 54 : unsigned int _nZA; 55 : 56 : /// the energy group boundaries 57 : std::vector<Real> _energies; 58 : 59 : /// number of energy groups 60 : unsigned int _ng; 61 : };