View | Details | Raw Unified | Return to problem 2598
Collapse All | Expand All

(-)a/source/geometry/volumes/include/G4LogicalSkinSurface.hh (-2 / +2 lines)
Lines 35-48 Link Here
35
#ifndef G4LogicalSkinSurface_hh
35
#ifndef G4LogicalSkinSurface_hh
36
#define G4LogicalSkinSurface_hh 1
36
#define G4LogicalSkinSurface_hh 1
37
37
38
#include <vector>
38
#include <map>
39
39
40
#include "G4LogicalSurface.hh"
40
#include "G4LogicalSurface.hh"
41
41
42
class G4LogicalVolume;
42
class G4LogicalVolume;
43
class G4LogicalSkinSurface;
43
class G4LogicalSkinSurface;
44
44
45
using G4LogicalSkinSurfaceTable = std::vector<G4LogicalSkinSurface*>;
45
using G4LogicalSkinSurfaceTable = std::map<const G4LogicalVolume*, G4LogicalSkinSurface*>;
46
46
47
class G4LogicalSkinSurface : public G4LogicalSurface 
47
class G4LogicalSkinSurface : public G4LogicalSurface 
48
{
48
{
(-)a/source/geometry/volumes/src/G4LogicalSkinSurface.cc (-9 / +8 lines)
Lines 51-57 G4LogicalSkinSurface::G4LogicalSkinSurface(const G4String& name, Link Here
51
  }
51
  }
52
  // Store in the table of Surfaces
52
  // Store in the table of Surfaces
53
  //
53
  //
54
  theSkinSurfaceTable->push_back(this);
54
  theSkinSurfaceTable->insert(std::make_pair(logicalVolume, this));
55
}
55
}
56
56
57
// --------------------------------------------------------------------
57
// --------------------------------------------------------------------
Lines 99-108 G4LogicalSkinSurface::GetSurface(const G4LogicalVolume* vol) Link Here
99
{
99
{
100
  if (theSkinSurfaceTable != nullptr)
100
  if (theSkinSurfaceTable != nullptr)
101
  {
101
  {
102
    for(auto pos : *theSkinSurfaceTable)
102
    auto pos = theSkinSurfaceTable->find(vol);
103
    {
103
    if(pos != theSkinSurfaceTable->cend()) return pos->second;
104
      if (pos->GetLogicalVolume() == vol)  { return pos; }
105
    }
106
  }
104
  }
107
  return nullptr;
105
  return nullptr;
108
}
106
}
Lines 117-127 void G4LogicalSkinSurface::DumpInfo() Link Here
117
115
118
  if (theSkinSurfaceTable != nullptr)
116
  if (theSkinSurfaceTable != nullptr)
119
  {
117
  {
120
    for(auto pos : *theSkinSurfaceTable)
118
    for(const auto & pos : *theSkinSurfaceTable)
121
    {
119
    {
122
      G4cout << pos->GetName() << " : " << G4endl
120
      G4LogicalSkinSurface* pSurf = pos.second;
121
      G4cout << pSurf->GetName() << " : " << G4endl
123
             << " Skin of logical volume "
122
             << " Skin of logical volume "
124
             << pos->GetLogicalVolume()->GetName()
123
             << pSurf->GetLogicalVolume()->GetName()
125
             << G4endl;
124
             << G4endl;
126
    }
125
    }
127
  }
126
  }
Lines 135-141 void G4LogicalSkinSurface::CleanSurfaceTable() Link Here
135
  {
134
  {
136
    for(auto pos : *theSkinSurfaceTable)
135
    for(auto pos : *theSkinSurfaceTable)
137
    {
136
    {
138
      if (pos != nullptr) { delete pos; }
137
      delete pos.second;
139
    }
138
    }
140
    theSkinSurfaceTable->clear();
139
    theSkinSurfaceTable->clear();
141
  }
140
  }
(-)a/source/persistency/gdml/src/G4GDMLWriteStructure.cc (-6 / +3 lines)
Lines 437-449 const G4LogicalSkinSurface* G4GDMLWriteStructure::GetSkinSurface( Link Here
437
  {
437
  {
438
    const G4LogicalSkinSurfaceTable* stable =
438
    const G4LogicalSkinSurfaceTable* stable =
439
      G4LogicalSkinSurface::GetSurfaceTable();
439
      G4LogicalSkinSurface::GetSurfaceTable();
440
    for(auto pos = stable->cbegin(); pos != stable->cend(); ++pos)
440
    auto pos = stable->find(lvol);
441
    if(pos != stable->cend())
441
    {
442
    {
442
      if(lvol == (*pos)->GetLogicalVolume())
443
      surf = pos->second;
443
      {
444
        surf = *pos;
445
        break;
446
      }
447
    }
444
    }
448
  }
445
  }
449
  return surf;
446
  return surf;

Return to problem 2598