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: G4BREPSolid.icc,v 1.9 2006/10/20 14:23:19 gcosmo Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
29 | // |
---|
30 | // -------------------------------------------------------------------- |
---|
31 | // GEANT 4 inline definitions file |
---|
32 | // |
---|
33 | // G4BREPSolid.icc |
---|
34 | // |
---|
35 | // Implementation of inline methods of G4BREPSolid |
---|
36 | // -------------------------------------------------------------------- |
---|
37 | |
---|
38 | inline G4double G4BREPSolid::IntersectionDistance() const |
---|
39 | { |
---|
40 | return intersectionDistance; |
---|
41 | } |
---|
42 | |
---|
43 | inline void G4BREPSolid::IntersectionDistance(G4double d) const |
---|
44 | { |
---|
45 | ((G4BREPSolid*)this)->intersectionDistance=d; |
---|
46 | } |
---|
47 | |
---|
48 | inline G4Surface* G4BREPSolid::GetSurface(G4int nr) const |
---|
49 | { |
---|
50 | return SurfaceVec[nr]; |
---|
51 | } |
---|
52 | |
---|
53 | inline void G4BREPSolid::Active(G4int x) const |
---|
54 | { |
---|
55 | ((G4BREPSolid*)this)->active=x; |
---|
56 | } |
---|
57 | |
---|
58 | inline G4int G4BREPSolid::Active() const |
---|
59 | { |
---|
60 | return active; |
---|
61 | } |
---|
62 | |
---|
63 | inline G4double G4BREPSolid::GetShortestDistance() const |
---|
64 | { |
---|
65 | return ShortestDistance; |
---|
66 | } |
---|
67 | |
---|
68 | inline G4int G4BREPSolid::GetId() const |
---|
69 | { |
---|
70 | return Id; |
---|
71 | } |
---|
72 | |
---|
73 | inline void G4BREPSolid::SetId(G4int n) |
---|
74 | { |
---|
75 | Id = n; |
---|
76 | } |
---|
77 | |
---|
78 | inline const G4String& G4BREPSolid::GetName() const |
---|
79 | { |
---|
80 | return solidname; |
---|
81 | } |
---|
82 | |
---|
83 | inline void G4BREPSolid::SetName(const G4String& name) |
---|
84 | { |
---|
85 | solidname = name; |
---|
86 | } |
---|
87 | |
---|
88 | inline G4int G4BREPSolid::GetNumberOfSolids() const |
---|
89 | { |
---|
90 | return NumberOfSolids; |
---|
91 | } |
---|
92 | |
---|
93 | inline G4int G4BREPSolid::GetNumberOfFaces() const |
---|
94 | { |
---|
95 | return nb_of_surfaces; |
---|
96 | } |
---|
97 | |
---|
98 | inline const G4Axis2Placement3D* G4BREPSolid::GetPlace() const |
---|
99 | { |
---|
100 | return place; |
---|
101 | } |
---|
102 | |
---|
103 | inline const G4BoundingBox3D* G4BREPSolid::GetBBox() const |
---|
104 | { |
---|
105 | return bbox; |
---|
106 | } |
---|
107 | |
---|
108 | inline G4int G4BREPSolid::StartInside() const |
---|
109 | { |
---|
110 | return startInside; |
---|
111 | } |
---|
112 | |
---|
113 | inline void G4BREPSolid::StartInside(G4int si) const |
---|
114 | { |
---|
115 | ((G4BREPSolid*)this)->startInside=si; |
---|
116 | } |
---|
117 | |
---|
118 | inline void G4BREPSolid::QuickSort( register G4Surface** SrfVec, |
---|
119 | register G4int left, |
---|
120 | register G4int right) const |
---|
121 | { |
---|
122 | register G4int i=left; |
---|
123 | register G4int j=right; |
---|
124 | register G4Surface* elem1; |
---|
125 | register G4Surface* elem2 = SrfVec[(left+right)/2]; |
---|
126 | register G4double tmpdistance; |
---|
127 | do |
---|
128 | { |
---|
129 | tmpdistance = elem2->GetDistance(); |
---|
130 | while ( SrfVec[i]->GetDistance() < tmpdistance && i < right ) i++; |
---|
131 | while (tmpdistance < SrfVec[j]->GetDistance() && j > left ) j--; |
---|
132 | if(i<=j) |
---|
133 | { |
---|
134 | elem1 = SrfVec[i]; |
---|
135 | SrfVec[i] = SrfVec[j]; |
---|
136 | SrfVec[j] = elem1; |
---|
137 | i++;j--; |
---|
138 | } |
---|
139 | } while (i<=j); |
---|
140 | |
---|
141 | if( left < j ) QuickSort(SrfVec,left, j ); |
---|
142 | if( i < right ) QuickSort(SrfVec,i, right); |
---|
143 | } |
---|
144 | |
---|
145 | inline G4int G4BREPSolid::GetCubVolStatistics() const |
---|
146 | { |
---|
147 | return fStatistics; |
---|
148 | } |
---|
149 | |
---|
150 | inline G4double G4BREPSolid::GetCubVolEpsilon() const |
---|
151 | { |
---|
152 | return fCubVolEpsilon; |
---|
153 | } |
---|
154 | |
---|
155 | inline void G4BREPSolid::SetCubVolStatistics(G4int st) |
---|
156 | { |
---|
157 | fCubicVolume=0.; |
---|
158 | fStatistics=st; |
---|
159 | } |
---|
160 | |
---|
161 | inline void G4BREPSolid::SetCubVolEpsilon(G4double ep) |
---|
162 | { |
---|
163 | fCubicVolume=0.; |
---|
164 | fCubVolEpsilon=ep; |
---|
165 | } |
---|
166 | |
---|
167 | inline G4int G4BREPSolid::GetAreaStatistics() const |
---|
168 | { |
---|
169 | return fStatistics; |
---|
170 | } |
---|
171 | |
---|
172 | inline G4double G4BREPSolid::GetAreaAccuracy() const |
---|
173 | { |
---|
174 | return fAreaAccuracy; |
---|
175 | } |
---|
176 | |
---|
177 | inline void G4BREPSolid::SetAreaStatistics(G4int st) |
---|
178 | { |
---|
179 | fSurfaceArea=0.; |
---|
180 | fStatistics=st; |
---|
181 | } |
---|
182 | |
---|
183 | inline void G4BREPSolid::SetAreaAccuracy(G4double ep) |
---|
184 | { |
---|
185 | fSurfaceArea=0.; |
---|
186 | fAreaAccuracy=ep; |
---|
187 | } |
---|
188 | |
---|
189 | inline G4double G4BREPSolid::GetCubicVolume() |
---|
190 | { |
---|
191 | if(fCubicVolume != 0.) {;} |
---|
192 | else { fCubicVolume = EstimateCubicVolume(fStatistics,fCubVolEpsilon); } |
---|
193 | return fCubicVolume; |
---|
194 | } |
---|
195 | |
---|
196 | inline G4double G4BREPSolid::GetSurfaceArea() |
---|
197 | { |
---|
198 | if(fSurfaceArea != 0.) {;} |
---|
199 | else { fSurfaceArea = EstimateSurfaceArea(fStatistics,fAreaAccuracy); } |
---|
200 | return fSurfaceArea; |
---|
201 | } |
---|