File indexing completed on 2025-01-18 09:58:55
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 inline void G4PhysicsTable::clearAndDestroy()
0032 {
0033 G4PhysicsVector* a = nullptr;
0034 while(!empty())
0035 {
0036 a = G4PhysCollection::back();
0037 G4PhysCollection::pop_back();
0038 delete a;
0039 }
0040 G4PhysCollection::clear();
0041 vecFlag.clear();
0042 }
0043
0044 inline G4PhysicsVector*& G4PhysicsTable::operator()(std::size_t i)
0045 {
0046 return (*this)[i];
0047 }
0048
0049 inline G4PhysicsVector* const& G4PhysicsTable::operator()(std::size_t i) const
0050 {
0051 return (*this)[i];
0052 }
0053
0054 inline void G4PhysicsTable::push_back(G4PhysicsVector* pvec)
0055 {
0056 G4PhysCollection::push_back(pvec);
0057 vecFlag.push_back(true);
0058 }
0059
0060 inline void G4PhysicsTable::insert(G4PhysicsVector* pvec)
0061 {
0062 G4PhysCollection::push_back(pvec);
0063 vecFlag.push_back(true);
0064 }
0065
0066 inline void G4PhysicsTable::insertAt(std::size_t idx, G4PhysicsVector* pvec)
0067 {
0068 if(idx > entries())
0069 {
0070 G4ExceptionDescription ed;
0071 ed << "Sprcified index (" << idx
0072 << ") is larger than the size of the vector (" << entries() << ").";
0073 G4Exception("G4PhysicsTable::insertAt()", "Global_PhysTbl0001",
0074 FatalException, ed);
0075 }
0076
0077 auto itr = cbegin();
0078 for(std::size_t i = 0; i < idx; ++i)
0079 {
0080 ++itr;
0081 }
0082 G4PhysCollection::insert(itr, pvec);
0083
0084 auto itrF = vecFlag.cbegin();
0085 for(std::size_t j = 0; j < idx; ++j)
0086 {
0087 ++itrF;
0088 }
0089 vecFlag.insert(itrF, true);
0090 }
0091
0092 inline std::size_t G4PhysicsTable::entries() const
0093 {
0094 return G4PhysCollection::size();
0095 }
0096
0097 inline std::size_t G4PhysicsTable::length() const
0098 {
0099 return G4PhysCollection::size();
0100 }
0101
0102 inline G4bool G4PhysicsTable::isEmpty() const
0103 {
0104 return G4PhysCollection::empty();
0105 }
0106
0107 inline G4bool G4PhysicsTable::GetFlag(std::size_t i) const
0108 {
0109 return vecFlag[i];
0110 }
0111
0112 inline void G4PhysicsTable::ClearFlag(std::size_t i) { vecFlag[i] = false; }