Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:05

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 // G4SmartVoxelNode inline implementation
0027 //
0028 // --------------------------------------------------------------------
0029 
0030 extern G4GEOM_DLL G4Allocator<G4SmartVoxelNode>*& aNodeAllocator();
0031 
0032 // --------------------------------------------------------------------
0033 inline
0034 void* G4SmartVoxelNode::operator new(std::size_t)
0035 {
0036   if(aNodeAllocator() == nullptr)
0037   {
0038     aNodeAllocator() = new G4Allocator<G4SmartVoxelNode>;
0039   }
0040   return (void*) aNodeAllocator()->MallocSingle();
0041 }
0042 
0043 // --------------------------------------------------------------------
0044 inline
0045 void G4SmartVoxelNode::operator delete(void* aNode)
0046 {
0047   aNodeAllocator()->FreeSingle((G4SmartVoxelNode*) aNode);
0048 }
0049 
0050 // --------------------------------------------------------------------
0051 inline
0052 G4int G4SmartVoxelNode::GetVolume(G4int pVolumeNo) const
0053 {
0054   return fcontents[pVolumeNo];
0055 }
0056 
0057 // --------------------------------------------------------------------
0058 inline
0059 void G4SmartVoxelNode::Insert(G4int pVolumeNo)
0060 {
0061   fcontents.push_back(pVolumeNo);
0062 }
0063 
0064 // --------------------------------------------------------------------
0065 inline
0066 std::size_t G4SmartVoxelNode::GetNoContained() const
0067 {
0068   return fcontents.size();
0069 }
0070 
0071 // --------------------------------------------------------------------
0072 inline
0073 std::size_t G4SmartVoxelNode::GetCapacity() const
0074 {
0075   return fcontents.capacity();
0076 }
0077 
0078 // --------------------------------------------------------------------
0079 inline
0080 void G4SmartVoxelNode::Reserve(G4int noSlices)
0081 {
0082   fcontents.reserve(noSlices);
0083 }
0084 
0085 // --------------------------------------------------------------------
0086 inline
0087 void G4SmartVoxelNode::Shrink()
0088 {
0089   G4SliceVector(fcontents).swap(fcontents);
0090 }
0091 
0092 // --------------------------------------------------------------------
0093 inline
0094 G4int G4SmartVoxelNode::GetMaxEquivalentSliceNo() const
0095 {
0096   return fmaxEquivalent;
0097 }
0098 
0099 // --------------------------------------------------------------------
0100 inline
0101 void G4SmartVoxelNode::SetMaxEquivalentSliceNo(G4int pMax)
0102 {
0103   fmaxEquivalent = pMax;
0104 }
0105 
0106 // --------------------------------------------------------------------
0107 inline
0108 G4int G4SmartVoxelNode::GetMinEquivalentSliceNo() const
0109 {
0110   return fminEquivalent;
0111 }
0112 
0113 // --------------------------------------------------------------------
0114 inline
0115 void G4SmartVoxelNode::SetMinEquivalentSliceNo(G4int pMin)
0116 {
0117   fminEquivalent = pMin;
0118 }