Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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$
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;
45 
46 //
47 // Constructors & destructor
48 //
49 
51  G4LogicalVolume* logicalVolume,
52  G4SurfaceProperty* surfaceProperty)
53  : G4LogicalSurface(name, surfaceProperty),
54  LogVolume(logicalVolume)
55 {
56  // Store in the table of Surfaces
57  //
58  theSkinSurfaceTable.push_back(this);
59 }
60 
62  : G4LogicalSurface(right.GetName(), right.GetSurfaceProperty())
63 {
65  LogVolume = right.LogVolume;
66  theSkinSurfaceTable = right.theSkinSurfaceTable;
67 }
68 
70 {
71 }
72 
73 //
74 // Operators
75 //
76 
78 G4LogicalSkinSurface::operator=(const G4LogicalSkinSurface& right)
79 {
80  if (&right == this) return *this;
81  if (&right)
82  {
84  SetName(right.GetName());
86  LogVolume = right.LogVolume;
87  theSkinSurfaceTable = right.theSkinSurfaceTable;
88  }
89  return *this;
90 }
91 
92 G4int
94 {
95  return (this == (G4LogicalSkinSurface *) &right);
96 }
97 
98 G4int
100 {
101  return (this != (G4LogicalSkinSurface *) &right);
102 }
103 
104 //
105 // Methods
106 //
107 
109 {
110  return &theSkinSurfaceTable;
111 }
112 
114 {
115  return theSkinSurfaceTable.size();
116 }
117 
120 {
121  for (size_t i=0; i<theSkinSurfaceTable.size(); i++)
122  {
123  if(theSkinSurfaceTable[i]->GetLogicalVolume() == vol)
124  return theSkinSurfaceTable[i];
125  }
126  return NULL;
127 }
128 
129 // Dump info for known surfaces
130 //
132 {
133  G4cout << "***** Skin Surface Table : Nb of Surfaces = "
134  << GetNumberOfSkinSurfaces() << " *****" << G4endl;
135 
136  for (size_t i=0; i<theSkinSurfaceTable.size(); i++)
137  {
138  G4LogicalSkinSurface* pSkinSurface = theSkinSurfaceTable[i];
139  G4cout << pSkinSurface->GetName() << " : " << G4endl
140  << " Skin of logical volume "
141  << pSkinSurface->GetLogicalVolume()->GetName()
142  << G4endl;
143  }
144  G4cout << G4endl;
145 }
146 
148 {
149  G4LogicalSkinSurfaceTable::iterator pos;
150  for(pos=theSkinSurfaceTable.begin(); pos!=theSkinSurfaceTable.end(); pos++)
151  {
152  if (*pos) delete *pos;
153  }
154  theSkinSurfaceTable.clear();
155 }