Geant4  10.02.p01
G4LogicalBorderSurface.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: G4LogicalBorderSurface.cc 87615 2014-12-12 15:23:11Z gcosmo $
28 //
29 // --------------------------------------------------------------------
30 // G4LogicalBorderSurface Implementation
31 // --------------------------------------------------------------------
32 //
33 // A Logical Surface class for surfaces defined by the boundary
34 // of two physical volumes.
35 //
36 // Created: 1997-06-26
37 // Author: John Apostolakis (John.Apostolakis@cern.ch)
38 //
39 // ----------------------------------------------------------------------
40 
42 #include "G4VPhysicalVolume.hh"
43 
45 
46 //
47 // Constructor & destructor
48 //
49 
52  G4VPhysicalVolume* vol1,
53  G4VPhysicalVolume* vol2,
54  G4SurfaceProperty* surfaceProperty)
55  : G4LogicalSurface(name, surfaceProperty),
56  Volume1(vol1), Volume2(vol2)
57 {
59  {
61  }
62 
63  // Store in the table of Surfaces
64  //
65  theBorderSurfaceTable->push_back(this);
66 }
67 
70  : G4LogicalSurface(right.GetName(), right.GetSurfaceProperty())
71 {
73  {
75  }
77  Volume1 = right.Volume1;
78  Volume2 = right.Volume2;
79  (*theBorderSurfaceTable) = (*right.theBorderSurfaceTable);
80 }
81 
83 {
84 // delete theBorderSurfaceTable; theBorderSurfaceTable=0;
85 }
86 
87 //
88 // Operators
89 //
90 
93 {
94  if (&right == this) return *this;
95 
97  SetName(right.GetName());
99  Volume1 = right.Volume1;
100  Volume2 = right.Volume2;
101  (*theBorderSurfaceTable) = (*right.theBorderSurfaceTable);
102 
103  return *this;
104 }
105 
106 G4int
108 {
109  return (this == (G4LogicalBorderSurface *) &right);
110 }
111 
112 G4int
114 {
115  return (this != (G4LogicalBorderSurface *) &right);
116 }
117 
118 //
119 // Methods
120 //
121 
123 {
125  {
127  }
128  return theBorderSurfaceTable;
129 }
130 
132 {
134  {
135  return theBorderSurfaceTable->size();
136  }
137  return 0;
138 }
139 
142  const G4VPhysicalVolume* vol2)
143 {
145  {
146  for (size_t i=0; i<theBorderSurfaceTable->size(); i++)
147  {
148  if( ((*theBorderSurfaceTable)[i]->GetVolume1() == vol1) &&
149  ((*theBorderSurfaceTable)[i]->GetVolume2() == vol2) )
150  return (*theBorderSurfaceTable)[i];
151  }
152  }
153  return 0;
154 }
155 
156 // Dump info for known surfaces
157 //
159 {
160  G4cout << "***** Surface Table : Nb of Surfaces = "
161  << GetNumberOfBorderSurfaces() << " *****" << G4endl;
162 
164  {
165  for (size_t i=0; i<theBorderSurfaceTable->size(); i++)
166  {
167  G4LogicalBorderSurface* pBorderSurface = (*theBorderSurfaceTable)[i];
168  G4cout << pBorderSurface->GetName() << " : " << G4endl
169  << " Border of volumes "
170  << pBorderSurface->GetVolume1()->GetName() << " and "
171  << pBorderSurface->GetVolume2()->GetName()
172  << G4endl;
173  }
174  }
175  G4cout << G4endl;
176 }
177 
179 {
181  {
182  G4LogicalBorderSurfaceTable::iterator pos;
183  for(pos=theBorderSurfaceTable->begin();
184  pos!=theBorderSurfaceTable->end(); pos++)
185  {
186  if (*pos) { delete *pos; }
187  }
188  theBorderSurfaceTable->clear();
189  }
190  return;
191 }
G4TransitionRadiationSurface * GetTransitionRadiationSurface() const
std::vector< G4LogicalBorderSurface * > G4LogicalBorderSurfaceTable
G4LogicalBorderSurface(const G4String &name, G4VPhysicalVolume *vol1, G4VPhysicalVolume *vol2, G4SurfaceProperty *surfaceProperty)
const G4VPhysicalVolume * GetVolume2() const
G4String name
Definition: TRTMaterials.hh:40
void SetName(const G4String &name)
int G4int
Definition: G4Types.hh:78
static G4LogicalBorderSurface * GetSurface(const G4VPhysicalVolume *vol1, const G4VPhysicalVolume *vol2)
static size_t GetNumberOfBorderSurfaces()
G4int operator!=(const G4LogicalBorderSurface &right) const
const G4String & GetName() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
static const G4LogicalBorderSurfaceTable * GetSurfaceTable()
G4LogicalBorderSurface & operator=(const G4LogicalBorderSurface &right)
void SetTransitionRadiationSurface(G4TransitionRadiationSurface *tRadSurf)
const G4VPhysicalVolume * GetVolume1() const
static G4LogicalBorderSurfaceTable * theBorderSurfaceTable
void SetSurfaceProperty(G4SurfaceProperty *ptrSurfaceProperty)
G4int operator==(const G4LogicalBorderSurface &right) const
#define G4endl
Definition: G4ios.hh:61
G4SurfaceProperty * GetSurfaceProperty() const
static const G4double pos