Warning, /eic-spack/packages/geant4/G4LogicalSkinSurface.patch is written in an unsupported language. File is not indexed.
0001 diff --git a/source/geometry/volumes/include/G4LogicalSkinSurface.hh b/source/geometry/volumes/include/G4LogicalSkinSurface.hh
0002 index 87bda6e3d3..263c1db155 100644
0003 --- a/source/geometry/volumes/include/G4LogicalSkinSurface.hh
0004 +++ b/source/geometry/volumes/include/G4LogicalSkinSurface.hh
0005 @@ -35,14 +35,14 @@
0006 #ifndef G4LogicalSkinSurface_hh
0007 #define G4LogicalSkinSurface_hh 1
0008
0009 -#include <vector>
0010 +#include <map>
0011
0012 #include "G4LogicalSurface.hh"
0013
0014 class G4LogicalVolume;
0015 class G4LogicalSkinSurface;
0016
0017 -using G4LogicalSkinSurfaceTable = std::vector<G4LogicalSkinSurface*>;
0018 +using G4LogicalSkinSurfaceTable = std::map<const G4LogicalVolume*, G4LogicalSkinSurface*>;
0019
0020 class G4LogicalSkinSurface : public G4LogicalSurface
0021 {
0022 diff --git a/source/geometry/volumes/src/G4LogicalSkinSurface.cc b/source/geometry/volumes/src/G4LogicalSkinSurface.cc
0023 index 086d068a54..e36ebeccb3 100644
0024 --- a/source/geometry/volumes/src/G4LogicalSkinSurface.cc
0025 +++ b/source/geometry/volumes/src/G4LogicalSkinSurface.cc
0026 @@ -51,7 +51,7 @@ G4LogicalSkinSurface::G4LogicalSkinSurface(const G4String& name,
0027 }
0028 // Store in the table of Surfaces
0029 //
0030 - theSkinSurfaceTable->push_back(this);
0031 + theSkinSurfaceTable->insert(std::make_pair(logicalVolume, this));
0032 }
0033
0034 // --------------------------------------------------------------------
0035 @@ -99,10 +99,8 @@ G4LogicalSkinSurface::GetSurface(const G4LogicalVolume* vol)
0036 {
0037 if (theSkinSurfaceTable != nullptr)
0038 {
0039 - for(auto pos : *theSkinSurfaceTable)
0040 - {
0041 - if (pos->GetLogicalVolume() == vol) { return pos; }
0042 - }
0043 + auto pos = theSkinSurfaceTable->find(vol);
0044 + if(pos != theSkinSurfaceTable->cend()) return pos->second;
0045 }
0046 return nullptr;
0047 }
0048 @@ -117,11 +115,12 @@ void G4LogicalSkinSurface::DumpInfo()
0049
0050 if (theSkinSurfaceTable != nullptr)
0051 {
0052 - for(auto pos : *theSkinSurfaceTable)
0053 + for(const auto & pos : *theSkinSurfaceTable)
0054 {
0055 - G4cout << pos->GetName() << " : " << G4endl
0056 + G4LogicalSkinSurface* pSurf = pos.second;
0057 + G4cout << pSurf->GetName() << " : " << G4endl
0058 << " Skin of logical volume "
0059 - << pos->GetLogicalVolume()->GetName()
0060 + << pSurf->GetLogicalVolume()->GetName()
0061 << G4endl;
0062 }
0063 }
0064 @@ -135,7 +134,7 @@ void G4LogicalSkinSurface::CleanSurfaceTable()
0065 {
0066 for(auto pos : *theSkinSurfaceTable)
0067 {
0068 - if (pos != nullptr) { delete pos; }
0069 + delete pos.second;
0070 }
0071 theSkinSurfaceTable->clear();
0072 }
0073 diff --git a/source/persistency/gdml/src/G4GDMLWriteStructure.cc b/source/persistency/gdml/src/G4GDMLWriteStructure.cc
0074 index 252e4f1bf1..4a09d895ab 100644
0075 --- a/source/persistency/gdml/src/G4GDMLWriteStructure.cc
0076 +++ b/source/persistency/gdml/src/G4GDMLWriteStructure.cc
0077 @@ -437,13 +437,10 @@ const G4LogicalSkinSurface* G4GDMLWriteStructure::GetSkinSurface(
0078 {
0079 const G4LogicalSkinSurfaceTable* stable =
0080 G4LogicalSkinSurface::GetSurfaceTable();
0081 - for(auto pos = stable->cbegin(); pos != stable->cend(); ++pos)
0082 + auto pos = stable->find(lvol);
0083 + if(pos != stable->cend())
0084 {
0085 - if(lvol == (*pos)->GetLogicalVolume())
0086 - {
0087 - surf = *pos;
0088 - break;
0089 - }
0090 + surf = pos->second;
0091 }
0092 }
0093 return surf;