Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 //
27 // $Id: G4LogicalSkinSurface.cc 87615 2014-12-12 15:23:11Z gcosmo $
28 //
29 // --------------------------------------------------------------------
30 // G4LogicalSkinSurface Implementation
31 // --------------------------------------------------------------------
32 //
33 // A Logical Surface class for the surface surrounding a single
34 // logical volume.
35 //
36 // Created: 1997-06-26
37 // Author: John Apostolakis (John.Apostolakis@cern.ch)
38 //
39 // ----------------------------------------------------------------------
40 
41 #include "G4LogicalSkinSurface.hh"
42 #include "G4LogicalVolume.hh"
43 
44 G4LogicalSkinSurfaceTable *G4LogicalSkinSurface::theSkinSurfaceTable = 0;
45 
46 //
47 // Constructors & destructor
48 //
49 
51  G4LogicalVolume* logicalVolume,
52  G4SurfaceProperty* surfaceProperty)
53  : G4LogicalSurface(name, surfaceProperty),
54  LogVolume(logicalVolume)
55 {
56  if (!theSkinSurfaceTable)
57  {
58  theSkinSurfaceTable = new G4LogicalSkinSurfaceTable;
59  }
60  // Store in the table of Surfaces
61  //
62  theSkinSurfaceTable->push_back(this);
63 }
64 
66  : G4LogicalSurface(right.GetName(), right.GetSurfaceProperty())
67 {
68  if (!theSkinSurfaceTable)
69  {
70  theSkinSurfaceTable = new G4LogicalSkinSurfaceTable;
71  }
73  LogVolume = right.LogVolume;
74  (*theSkinSurfaceTable) = (*right.theSkinSurfaceTable);
75 }
76 
78 {
79 // delete theSkinSurfaceTable; theSkinSurfaceTable = 0;
80 }
81 
82 //
83 // Operators
84 //
85 
87 G4LogicalSkinSurface::operator=(const G4LogicalSkinSurface& right)
88 {
89  if (&right == this) return *this;
90 
92  SetName(right.GetName());
94  LogVolume = right.LogVolume;
95  (*theSkinSurfaceTable) = (*right.theSkinSurfaceTable);
96 
97  return *this;
98 }
99 
100 G4int
102 {
103  return (this == (G4LogicalSkinSurface *) &right);
104 }
105 
106 G4int
108 {
109  return (this != (G4LogicalSkinSurface *) &right);
110 }
111 
112 //
113 // Methods
114 //
115 
117 {
118  if (!theSkinSurfaceTable)
119  {
120  theSkinSurfaceTable = new G4LogicalSkinSurfaceTable;
121  }
122  return theSkinSurfaceTable;
123 }
124 
126 {
127  if (theSkinSurfaceTable)
128  {
129  return theSkinSurfaceTable->size();
130  }
131  return 0;
132 }
133 
136 {
137  if (theSkinSurfaceTable)
138  {
139  for (size_t i=0; i<theSkinSurfaceTable->size(); i++)
140  {
141  if((*theSkinSurfaceTable)[i]->GetLogicalVolume() == vol)
142  return (*theSkinSurfaceTable)[i];
143  }
144  }
145  return 0;
146 }
147 
148 // Dump info for known surfaces
149 //
151 {
152  G4cout << "***** Skin Surface Table : Nb of Surfaces = "
153  << GetNumberOfSkinSurfaces() << " *****" << G4endl;
154 
155  if (theSkinSurfaceTable)
156  {
157  for (size_t i=0; i<theSkinSurfaceTable->size(); i++)
158  {
159  G4LogicalSkinSurface* pSkinSurface = (*theSkinSurfaceTable)[i];
160  G4cout << pSkinSurface->GetName() << " : " << G4endl
161  << " Skin of logical volume "
162  << pSkinSurface->GetLogicalVolume()->GetName()
163  << G4endl;
164  }
165  }
166  G4cout << G4endl;
167 }
168 
170 {
171  if (theSkinSurfaceTable)
172  {
173  G4LogicalSkinSurfaceTable::iterator pos;
174  for(pos=theSkinSurfaceTable->begin();
175  pos!=theSkinSurfaceTable->end(); pos++)
176  {
177  if (*pos) { delete *pos; }
178  }
179  theSkinSurfaceTable->clear();
180  }
181  return;
182 }
const XML_Char * name
Definition: expat.h:151
G4TransitionRadiationSurface * GetTransitionRadiationSurface() const
const G4LogicalVolume * GetLogicalVolume() const
G4int operator!=(const G4LogicalSkinSurface &right) const
void SetName(const G4String &name)
int G4int
Definition: G4Types.hh:78
static size_t GetNumberOfSkinSurfaces()
G4LogicalSkinSurface(const G4String &name, G4LogicalVolume *vol, G4SurfaceProperty *surfaceProperty)
static const G4LogicalSkinSurfaceTable * GetSurfaceTable()
const G4String & GetName() const
G4GLOB_DLL std::ostream G4cout
void SetTransitionRadiationSurface(G4TransitionRadiationSurface *tRadSurf)
void SetSurfaceProperty(G4SurfaceProperty *ptrSurfaceProperty)
G4int operator==(const G4LogicalSkinSurface &right) const
#define G4endl
Definition: G4ios.hh:61
G4SurfaceProperty * GetSurfaceProperty() const
const G4String & GetName() const
std::vector< G4LogicalSkinSurface * > G4LogicalSkinSurfaceTable
static const G4double pos
static G4LogicalSkinSurface * GetSurface(const G4LogicalVolume *vol)