Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4LogicalSkinSurface.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// Class G4LogicalSkinSurface Implementation
27//
28// Author: John Apostolakis (CERN), 16 June 1997
29// --------------------------------------------------------------------
30
32#include "G4LogicalVolume.hh"
33#include "G4GeometryManager.hh"
34
35G4LogicalSkinSurfaceTable *G4LogicalSkinSurface::theSkinSurfaceTable = nullptr;
36
37// --------------------------------------------------------------------
38// Constructor
39//
41 G4LogicalVolume* logicalVolume,
42 G4SurfaceProperty* surfaceProperty)
43 : G4LogicalSurface(name, surfaceProperty),
44 LogVolume(logicalVolume)
45{
46 if (theSkinSurfaceTable == nullptr)
47 {
48 theSkinSurfaceTable = new G4LogicalSkinSurfaceTable;
49 }
50 // Store in the table of Surfaces
51 //
52 theSkinSurfaceTable->insert(std::make_pair(logicalVolume, this));
53}
54
55// --------------------------------------------------------------------
58{
59 return (this == (G4LogicalSkinSurface *) &right);
60}
61
62// --------------------------------------------------------------------
65{
66 return (this != (G4LogicalSkinSurface *) &right);
67}
68
69// --------------------------------------------------------------------
71{
72 if (theSkinSurfaceTable == nullptr)
73 {
74 theSkinSurfaceTable = new G4LogicalSkinSurfaceTable;
75 }
76 return theSkinSurfaceTable;
77}
78
79// --------------------------------------------------------------------
81{
82 if (theSkinSurfaceTable != nullptr)
83 {
84 return theSkinSurfaceTable->size();
85 }
86 return 0;
87}
88
89// --------------------------------------------------------------------
92{
93 if (theSkinSurfaceTable != nullptr)
94 {
95 auto pos = theSkinSurfaceTable->find(vol);
96 if(pos != theSkinSurfaceTable->cend()) { return pos->second; }
97 }
98 return nullptr;
99}
100
101// --------------------------------------------------------------------
102// Dump info for known surfaces
103//
105{
106 G4cout << "***** Skin Surface Table : Nb of Surfaces = "
107 << GetNumberOfSkinSurfaces() << " *****" << G4endl;
108
109 if (theSkinSurfaceTable != nullptr)
110 {
111 for(const auto & pos : *theSkinSurfaceTable)
112 {
113 G4LogicalSkinSurface* pSurf = pos.second;
114 G4cout << pSurf->GetName() << " : " << G4endl
115 << " Skin of logical volume "
116 << pSurf->GetLogicalVolume()->GetName()
117 << G4endl;
118 }
119 }
120 G4cout << G4endl;
121}
122
123// --------------------------------------------------------------------
125{
126 if (theSkinSurfaceTable == nullptr) { return; }
127
128 // Do nothing if geometry is closed
129 if (G4GeometryManager::GetInstance()->IsGeometryClosed())
130 {
131 G4cout << "WARNING - Attempt to clear the skin surface store"
132 << " while geometry closed !" << G4endl;
133 return;
134 }
135
136 for (const auto& pos : *theSkinSurfaceTable)
137 {
138 delete pos.second;
139 }
140 theSkinSurfaceTable->clear();
141}
std::map< const G4LogicalVolume *, G4LogicalSkinSurface * > G4LogicalSkinSurfaceTable
bool G4bool
Definition G4Types.hh:86
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4GeometryManager * GetInstance()
G4LogicalSkinSurface is a Logical Surface class for the surface surrounding a single logical volume.
static G4LogicalSkinSurface * GetSurface(const G4LogicalVolume *vol)
G4bool operator==(const G4LogicalSkinSurface &right) const
const G4LogicalVolume * GetLogicalVolume() const
G4LogicalSkinSurface(const G4String &name, G4LogicalVolume *vol, G4SurfaceProperty *surfaceProperty)
static const G4LogicalSkinSurfaceTable * GetSurfaceTable()
static std::size_t GetNumberOfSkinSurfaces()
G4bool operator!=(const G4LogicalSkinSurface &right) const
const G4String & GetName() const
G4LogicalSurface(const G4LogicalSurface &)=delete
G4LogicalVolume represents a leaf node or unpositioned subtree in the geometry hierarchy....
const G4String & GetName() const