Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:55

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4PhysicsTable inline methods implementation
0027 //
0028 // Author: G.Cosmo, 2 December 1995 - First implementation based on object model
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; }