Warning, file /include/Geant4/G4FermiFragmentPoolAN.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #ifndef G4FERMIFRAGMENTPOOLAN_HH
0032 #define G4FERMIFRAGMENTPOOLAN_HH
0033
0034 #include "G4FermiDataTypes.hh"
0035 #include "G4VFermiFragmentAN.hh"
0036 #include "globals.hh"
0037
0038 class G4FermiFragmentPoolAN
0039 {
0040 private:
0041 using Container = std::vector<const G4VFermiFragmentAN*>;
0042
0043 public:
0044 class DefaultPoolANSource : private std::vector<G4VFermiFragmentAN*>
0045 {
0046 private:
0047 using PoolANContainer = std::vector<G4VFermiFragmentAN*>;
0048
0049 public:
0050 DefaultPoolANSource();
0051
0052 void Initialize();
0053
0054 using PoolANContainer::begin;
0055 using PoolANContainer::cbegin;
0056 using PoolANContainer::cend;
0057 using PoolANContainer::end;
0058 };
0059
0060 class IteratorRange
0061 {
0062 public:
0063 using const_iterator = Container::const_iterator;
0064
0065 IteratorRange(const_iterator begin, const_iterator end) : begin_(begin), end_(end) {}
0066
0067 const_iterator begin() const { return begin_; }
0068 const_iterator end() const { return end_; }
0069
0070 private:
0071 const_iterator begin_;
0072 const_iterator end_;
0073 };
0074
0075 std::size_t Count(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber) const;
0076
0077 std::size_t Count(G4FermiNucleiData nuclei) const
0078 {
0079 return Count(nuclei.atomicMass, nuclei.chargeNumber);
0080 }
0081
0082 IteratorRange GetFragments(G4FermiAtomicMass atomicMass,
0083 G4FermiChargeNumber chargeNumber) const;
0084
0085 IteratorRange GetFragments(G4FermiNucleiData nuclei) const
0086 {
0087 return GetFragments(nuclei.atomicMass, nuclei.chargeNumber);
0088 }
0089
0090 template<typename DataSource>
0091 void Initialize(const DataSource& dataSource)
0092 {
0093 Initialize(dataSource.begin(), dataSource.end());
0094 }
0095
0096 template<typename Iter>
0097 void Initialize(Iter begin, Iter end)
0098 {
0099 fragments_.clear();
0100 static_assert(
0101 std::is_same_v<std::remove_const_t<typename Iter::value_type>, G4VFermiFragmentAN*>,
0102 "invalid iterator");
0103 for (auto it = begin; it != end; ++it) {
0104 AddFragment(**it);
0105 }
0106 }
0107
0108 void AddFragment(const G4VFermiFragmentAN& fragment);
0109
0110 static G4FermiFragmentPoolAN& Instance()
0111 {
0112 static G4FermiFragmentPoolAN pool;
0113 return pool;
0114 }
0115
0116 private:
0117 G4FermiFragmentPoolAN();
0118
0119 static inline const Container EmptyContainer_ = {};
0120
0121 std::vector<Container> fragments_;
0122 };
0123
0124 #endif