source: trunk/source/geometry/volumes/src/G4LogicalBorderSurface.cc@ 1351

Last change on this file since 1351 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 5.4 KB
Line 
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,v 1.17 2008/08/19 15:31:52 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30// --------------------------------------------------------------------
31// G4LogicalBorderSurface Implementation
32// --------------------------------------------------------------------
33//
34// A Logical Surface class for surfaces defined by the boundary
35// of two physical volumes.
36//
37// Created: 1997-06-26
38// Author: John Apostolakis (John.Apostolakis@cern.ch)
39//
40// ----------------------------------------------------------------------
41
42#include "G4LogicalBorderSurface.hh"
43#include "G4VPhysicalVolume.hh"
44
45G4LogicalBorderSurfaceTable G4LogicalBorderSurface::theBorderSurfaceTable;
46
47//
48// Constructor & destructor
49//
50
51G4LogicalBorderSurface::G4LogicalBorderSurface(const G4String& name,
52 G4VPhysicalVolume* vol1,
53 G4VPhysicalVolume* vol2,
54 G4SurfaceProperty* surfaceProperty)
55 : G4LogicalSurface(name, surfaceProperty),
56 Volume1(vol1), Volume2(vol2)
57{
58 // Store in the table of Surfaces
59 //
60 theBorderSurfaceTable.push_back(this);
61}
62
63G4LogicalBorderSurface::
64G4LogicalBorderSurface(const G4LogicalBorderSurface& right)
65 : G4LogicalSurface(right.GetName(), right.GetSurfaceProperty())
66{
67 SetTransitionRadiationSurface(right.GetTransitionRadiationSurface());
68 Volume1 = right.Volume1;
69 Volume2 = right.Volume2;
70 theBorderSurfaceTable = right.theBorderSurfaceTable;
71}
72
73G4LogicalBorderSurface::~G4LogicalBorderSurface()
74{
75}
76
77//
78// Operators
79//
80
81const G4LogicalBorderSurface&
82G4LogicalBorderSurface::operator=(const G4LogicalBorderSurface &right)
83{
84 if (&right == this) return *this;
85 if (&right)
86 {
87 SetSurfaceProperty(right.GetSurfaceProperty());
88 SetName(right.GetName());
89 SetTransitionRadiationSurface(right.GetTransitionRadiationSurface());
90 Volume1 = right.Volume1;
91 Volume2 = right.Volume2;
92 theBorderSurfaceTable = right.theBorderSurfaceTable;
93 }
94 return *this;
95}
96
97G4int
98G4LogicalBorderSurface::operator==(const G4LogicalBorderSurface &right) const
99{
100 return (this == (G4LogicalBorderSurface *) &right);
101}
102
103G4int
104G4LogicalBorderSurface::operator!=(const G4LogicalBorderSurface &right) const
105{
106 return (this != (G4LogicalBorderSurface *) &right);
107}
108
109//
110// Methods
111//
112
113const G4LogicalBorderSurfaceTable* G4LogicalBorderSurface::GetSurfaceTable()
114{
115 return &theBorderSurfaceTable;
116}
117
118size_t G4LogicalBorderSurface::GetNumberOfBorderSurfaces()
119{
120 return theBorderSurfaceTable.size();
121}
122
123G4LogicalBorderSurface*
124G4LogicalBorderSurface::GetSurface(const G4VPhysicalVolume* vol1,
125 const G4VPhysicalVolume* vol2)
126{
127 for (size_t i=0; i<theBorderSurfaceTable.size(); i++)
128 {
129 if( (theBorderSurfaceTable[i]->GetVolume1() == vol1) &&
130 (theBorderSurfaceTable[i]->GetVolume2() == vol2) )
131 return theBorderSurfaceTable[i];
132 }
133 return NULL;
134}
135
136// Dump info for known surfaces
137//
138void G4LogicalBorderSurface::DumpInfo()
139{
140 G4cout << "***** Surface Table : Nb of Surfaces = "
141 << GetNumberOfBorderSurfaces() << " *****" << G4endl;
142
143 for (size_t i=0; i<theBorderSurfaceTable.size(); i++)
144 {
145 G4LogicalBorderSurface* pBorderSurface = theBorderSurfaceTable[i];
146 G4cout << pBorderSurface->GetName() << " : " << G4endl
147 << " Border of volumes "
148 << pBorderSurface->GetVolume1()->GetName() << " and "
149 << pBorderSurface->GetVolume2()->GetName()
150 << G4endl;
151 }
152 G4cout << G4endl;
153}
154
155void G4LogicalBorderSurface::CleanSurfaceTable()
156{
157 G4LogicalBorderSurfaceTable::iterator pos;
158 for(pos=theBorderSurfaceTable.begin();
159 pos!=theBorderSurfaceTable.end(); pos++)
160 {
161 if (*pos) delete *pos;
162 }
163 theBorderSurfaceTable.clear();
164}
Note: See TracBrowser for help on using the repository browser.