Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TwistTubsFlatSide Class Reference

#include <G4TwistTubsFlatSide.hh>

+ Inheritance diagram for G4TwistTubsFlatSide:

Public Member Functions

 G4TwistTubsFlatSide (const G4String &name, const G4RotationMatrix &rot, const G4ThreeVector &tlate, const G4ThreeVector &n, const EAxis axis1=kRho, const EAxis axis2=kPhi, G4double axis0min=-kInfinity, G4double axis1min=-kInfinity, G4double axis0max=kInfinity, G4double axis1max=kInfinity)
 
 G4TwistTubsFlatSide (const G4String &name, G4double EndInnerRadius[2], G4double EndOuterRadius[2], G4double DPhi, G4double EndPhi[2], G4double EndZ[2], G4int handedness)
 
 ~G4TwistTubsFlatSide () override
 
G4ThreeVector GetNormal (const G4ThreeVector &, G4bool isGlobal=false) override
 
G4int DistanceToSurface (const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector gxx[], G4double distance[], G4int areacode[], G4bool isvalid[], EValidate validate=kValidateWithTol) override
 
G4int DistanceToSurface (const G4ThreeVector &gp, G4ThreeVector gxx[], G4double distance[], G4int areacode[]) override
 
G4ThreeVector SurfacePoint (G4double, G4double, G4bool isGlobal=false) override
 
G4double GetBoundaryMin (G4double phi) override
 
G4double GetBoundaryMax (G4double phi) override
 
G4double GetSurfaceArea () override
 
void GetFacets (G4int m, G4int n, G4double xyz[][3], G4int faces[][4], G4int iside) override
 
 G4TwistTubsFlatSide (__void__ &)
 
- Public Member Functions inherited from G4VTwistSurface
 G4VTwistSurface (const G4String &name)
 
 G4VTwistSurface (const G4String &name, const G4RotationMatrix &rot, const G4ThreeVector &tlate, G4int handedness, const EAxis axis1, const EAxis axis2, G4double axis0min=-kInfinity, G4double axis1min=-kInfinity, G4double axis0max=kInfinity, G4double axis1max=kInfinity)
 
virtual ~G4VTwistSurface ()
 
virtual G4int AmIOnLeftSide (const G4ThreeVector &me, const G4ThreeVector &vec, G4bool withTol=true)
 
virtual G4double DistanceToBoundary (G4int areacode, G4ThreeVector &xx, const G4ThreeVector &p)
 
virtual G4double DistanceToIn (const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
 
virtual G4double DistanceToOut (const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
 
virtual G4double DistanceTo (const G4ThreeVector &gp, G4ThreeVector &gxx)
 
void DebugPrint () const
 
virtual G4String GetName () const
 
virtual void GetBoundaryParameters (const G4int &areacode, G4ThreeVector &d, G4ThreeVector &x0, G4int &boundarytype) const
 
virtual G4ThreeVector GetBoundaryAtPZ (G4int areacode, const G4ThreeVector &p) const
 
G4double DistanceToPlaneWithV (const G4ThreeVector &p, const G4ThreeVector &v, const G4ThreeVector &x0, const G4ThreeVector &n0, G4ThreeVector &xx)
 
G4double DistanceToPlane (const G4ThreeVector &p, const G4ThreeVector &x0, const G4ThreeVector &n0, G4ThreeVector &xx)
 
G4double DistanceToPlane (const G4ThreeVector &p, const G4ThreeVector &x0, const G4ThreeVector &t1, const G4ThreeVector &t2, G4ThreeVector &xx, G4ThreeVector &n)
 
G4double DistanceToLine (const G4ThreeVector &p, const G4ThreeVector &x0, const G4ThreeVector &d, G4ThreeVector &xx)
 
G4bool IsAxis0 (G4int areacode) const
 
G4bool IsAxis1 (G4int areacode) const
 
G4bool IsOutside (G4int areacode) const
 
G4bool IsInside (G4int areacode, G4bool testbitmode=false) const
 
G4bool IsBoundary (G4int areacode, G4bool testbitmode=false) const
 
G4bool IsCorner (G4int areacode, G4bool testbitmode=false) const
 
G4bool IsValidNorm () const
 
G4bool IsSameBoundary (G4VTwistSurface *surface1, G4int areacode1, G4VTwistSurface *surface2, G4int areacode2) const
 
G4int GetAxisType (G4int areacode, G4int whichaxis) const
 
G4ThreeVector ComputeGlobalPoint (const G4ThreeVector &lp) const
 
G4ThreeVector ComputeLocalPoint (const G4ThreeVector &gp) const
 
G4ThreeVector ComputeGlobalDirection (const G4ThreeVector &lp) const
 
G4ThreeVector ComputeLocalDirection (const G4ThreeVector &gp) const
 
void SetAxis (G4int i, const EAxis axis)
 
void SetNeighbours (G4VTwistSurface *ax0min, G4VTwistSurface *ax1min, G4VTwistSurface *ax0max, G4VTwistSurface *ax1max)
 
G4int GetNode (G4int i, G4int j, G4int m, G4int n, G4int iside)
 
G4int GetFace (G4int i, G4int j, G4int m, G4int n, G4int iside)
 
G4int GetEdgeVisibility (G4int i, G4int j, G4int m, G4int n, G4int number, G4int orientation)
 
 G4VTwistSurface (__void__ &)
 

Protected Member Functions

G4int GetAreaCode (const G4ThreeVector &xx, G4bool withTol=true) override
 
- Protected Member Functions inherited from G4VTwistSurface
G4VTwistSurface ** GetNeighbours ()
 
G4int GetNeighbours (G4int areacode, G4VTwistSurface *surfaces[])
 
G4ThreeVector GetCorner (G4int areacode) const
 
void GetBoundaryAxis (G4int areacode, EAxis axis[]) const
 
void GetBoundaryLimit (G4int areacode, G4double limit[]) const
 
virtual void SetBoundary (const G4int &axiscode, const G4ThreeVector &direction, const G4ThreeVector &x0, const G4int &boundarytype)
 
void SetCorner (G4int areacode, G4double x, G4double y, G4double z)
 

Additional Inherited Members

- Public Types inherited from G4VTwistSurface
enum  EValidate { kDontValidate = 0 , kValidateWithTol = 1 , kValidateWithoutTol = 2 , kUninitialized = 3 }
 
- Static Public Attributes inherited from G4VTwistSurface
static const G4int sOutside = 0x00000000
 
static const G4int sInside = 0x10000000
 
static const G4int sBoundary = 0x20000000
 
static const G4int sCorner = 0x40000000
 
static const G4int sC0Min1Min = 0x40000101
 
static const G4int sC0Max1Min = 0x40000201
 
static const G4int sC0Max1Max = 0x40000202
 
static const G4int sC0Min1Max = 0x40000102
 
static const G4int sAxisMin = 0x00000101
 
static const G4int sAxisMax = 0x00000202
 
static const G4int sAxisX = 0x00000404
 
static const G4int sAxisY = 0x00000808
 
static const G4int sAxisZ = 0x00000C0C
 
static const G4int sAxisRho = 0x00001010
 
static const G4int sAxisPhi = 0x00001414
 
static const G4int sAxis0 = 0x0000FF00
 
static const G4int sAxis1 = 0x000000FF
 
static const G4int sSizeMask = 0x00000303
 
static const G4int sAxisMask = 0x0000FCFC
 
static const G4int sAreaMask = 0XF0000000
 
- Protected Attributes inherited from G4VTwistSurface
EAxis fAxis [2]
 
G4double fAxisMin [2]
 
G4double fAxisMax [2]
 
CurrentStatus fCurStatWithV
 
CurrentStatus fCurStat
 
G4RotationMatrix fRot
 
G4ThreeVector fTrans
 
G4int fHandedness
 
G4SurfCurNormal fCurrentNormal
 
G4bool fIsValidNorm
 
G4double kCarTolerance
 

Detailed Description

Definition at line 41 of file G4TwistTubsFlatSide.hh.

Constructor & Destructor Documentation

◆ G4TwistTubsFlatSide() [1/3]

G4TwistTubsFlatSide::G4TwistTubsFlatSide ( const G4String & name,
const G4RotationMatrix & rot,
const G4ThreeVector & tlate,
const G4ThreeVector & n,
const EAxis axis1 = kRho,
const EAxis axis2 = kPhi,
G4double axis0min = -kInfinity,
G4double axis1min = -kInfinity,
G4double axis0max = kInfinity,
G4double axis1max = kInfinity )

Definition at line 39 of file G4TwistTubsFlatSide.cc.

49 : G4VTwistSurface(name, rot, tlate, 0, axis0, axis1,
50 axis0min, axis1min, axis0max, axis1max)
51{
52 if (axis0 == kPhi && axis1 == kRho)
53 {
54 G4Exception("G4TwistTubsFlatSide::G4TwistTubsFlatSide()",
55 "GeomSolids0002", FatalErrorInArgument,
56 "Should swap axis0 and axis1!");
57 }
58
59 G4ThreeVector normal = rot.inverse()*n;
60 fCurrentNormal.normal = normal.unit(); // in local coordinate system
61 fIsValidNorm = true;
62
63 SetCorners();
64 SetBoundaries();
65
66 fSurfaceArea = 1. ; // NOTE: not yet implemented!
67}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Hep3Vector unit() const
HepRotation inverse() const
G4VTwistSurface(const G4String &name)
G4SurfCurNormal fCurrentNormal
@ kPhi
Definition geomdefs.hh:60
@ kRho
Definition geomdefs.hh:58

◆ G4TwistTubsFlatSide() [2/3]

G4TwistTubsFlatSide::G4TwistTubsFlatSide ( const G4String & name,
G4double EndInnerRadius[2],
G4double EndOuterRadius[2],
G4double DPhi,
G4double EndPhi[2],
G4double EndZ[2],
G4int handedness )

Definition at line 69 of file G4TwistTubsFlatSide.cc.

76 : G4VTwistSurface(name)
77{
78 fHandedness = handedness; // +z = +ve, -z = -ve
79 fAxis[0] = kRho; // in local coordinate system
80 fAxis[1] = kPhi;
81 G4int i = (handedness < 0 ? 0 : 1);
82 fAxisMin[0] = EndInnerRadius[i]; // Inner-hype radius at z=0
83 fAxisMax[0] = EndOuterRadius[i]; // Outer-hype radius at z=0
84 fAxisMin[1] = -0.5*DPhi;
85 fAxisMax[1] = -fAxisMin[1];
86 fCurrentNormal.normal.set(0, 0, (fHandedness < 0 ? -1 : 1));
87 // Unit vector, in local coordinate system
88 fRot.rotateZ(EndPhi[i]);
89 fTrans.set(0, 0, EndZ[i]);
90 fIsValidNorm = true;
91
92 SetCorners();
93 SetBoundaries();
94
95 fSurfaceArea = 0.5*DPhi * (EndOuterRadius[i]*EndOuterRadius[i]
96 - EndInnerRadius[i]*EndInnerRadius[i] ) ;
97}
int G4int
Definition G4Types.hh:85
void set(double x, double y, double z)
HepRotation & rotateZ(double delta)
Definition Rotation.cc:87
G4RotationMatrix fRot
G4ThreeVector fTrans

◆ ~G4TwistTubsFlatSide()

G4TwistTubsFlatSide::~G4TwistTubsFlatSide ( )
overridedefault

◆ G4TwistTubsFlatSide() [3/3]

G4TwistTubsFlatSide::G4TwistTubsFlatSide ( __void__ & a)

Definition at line 102 of file G4TwistTubsFlatSide.cc.

103 : G4VTwistSurface(a)
104{
105}

Member Function Documentation

◆ DistanceToSurface() [1/2]

G4int G4TwistTubsFlatSide::DistanceToSurface ( const G4ThreeVector & gp,
const G4ThreeVector & gv,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[],
G4bool isvalid[],
EValidate validate = kValidateWithTol )
overridevirtual

Implements G4VTwistSurface.

Definition at line 131 of file G4TwistTubsFlatSide.cc.

138{
139 fCurStatWithV.ResetfDone(validate, &gp, &gv);
140
141 if (fCurStatWithV.IsDone())
142 {
143 for (G4int i=0; i<fCurStatWithV.GetNXX(); ++i)
144 {
145 gxx[i] = fCurStatWithV.GetXX(i);
146 distance[i] = fCurStatWithV.GetDistance(i);
147 areacode[i] = fCurStatWithV.GetAreacode(i);
148 isvalid[i] = fCurStatWithV.IsValid(i);
149 }
150 return fCurStatWithV.GetNXX();
151 }
152 else // initialize
153 {
154 for (G4int i=0; i<2; ++i)
155 {
156 distance[i] = kInfinity;
157 areacode[i] = sOutside;
158 isvalid[i] = false;
159 gxx[i].set(kInfinity, kInfinity, kInfinity);
160 }
161 }
162
165
166 //
167 // special case!
168 // if p is on surface, distance = 0.
169 //
170
171 if (std::fabs(p.z()) == 0.) // if p is on the plane
172 {
173 distance[0] = 0;
174 G4ThreeVector xx = p;
175 gxx[0] = ComputeGlobalPoint(xx);
176
177 if (validate == kValidateWithTol)
178 {
179 areacode[0] = GetAreaCode(xx);
180 if (!IsOutside(areacode[0]))
181 {
182 isvalid[0] = true;
183 }
184 }
185 else if (validate == kValidateWithoutTol)
186 {
187 areacode[0] = GetAreaCode(xx, false);
188 if (IsInside(areacode[0]))
189 {
190 isvalid[0] = true;
191 }
192 }
193 else // kDontValidate
194 {
195 areacode[0] = sInside;
196 isvalid[0] = true;
197 }
198 return 1;
199 }
200 //
201 // special case end
202 //
203
204 if (v.z() == 0)
205 {
206 fCurStatWithV.SetCurrentStatus(0, gxx[0], distance[0], areacode[0],
207 isvalid[0], 0, validate, &gp, &gv);
208 return 0;
209 }
210
211 distance[0] = - (p.z() / v.z());
212
213 G4ThreeVector xx = p + distance[0]*v;
214 gxx[0] = ComputeGlobalPoint(xx);
215
216 if (validate == kValidateWithTol)
217 {
218 areacode[0] = GetAreaCode(xx);
219 if (!IsOutside(areacode[0]))
220 {
221 if (distance[0] >= 0) isvalid[0] = true;
222 }
223 }
224 else if (validate == kValidateWithoutTol)
225 {
226 areacode[0] = GetAreaCode(xx, false);
227 if (IsInside(areacode[0]))
228 {
229 if (distance[0] >= 0) isvalid[0] = true;
230 }
231 }
232 else // kDontValidate
233 {
234 areacode[0] = sInside;
235 if (distance[0] >= 0) isvalid[0] = true;
236 }
237
238 fCurStatWithV.SetCurrentStatus(0, gxx[0], distance[0], areacode[0],
239 isvalid[0], 1, validate, &gp, &gv);
240
241#ifdef G4TWISTDEBUG
242 G4cerr << "ERROR - G4TwistTubsFlatSide::DistanceToSurface(p,v)" << G4endl;
243 G4cerr << " Name : " << GetName() << G4endl;
244 G4cerr << " xx : " << xx << G4endl;
245 G4cerr << " gxx[0] : " << gxx[0] << G4endl;
246 G4cerr << " dist[0] : " << distance[0] << G4endl;
247 G4cerr << " areacode[0] : " << areacode[0] << G4endl;
248 G4cerr << " isvalid[0] : " << isvalid[0] << G4endl;
249#endif
250 return 1;
251}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67
double z() const
G4int GetAreaCode(const G4ThreeVector &xx, G4bool withTol=true) override
G4double GetDistance(G4int i) const
void SetCurrentStatus(G4int i, G4ThreeVector &xx, G4double &dist, G4int &areacode, G4bool &isvalid, G4int nxx, EValidate validate, const G4ThreeVector *p, const G4ThreeVector *v=nullptr)
G4ThreeVector GetXX(G4int i) const
void ResetfDone(EValidate validate, const G4ThreeVector *p, const G4ThreeVector *v=nullptr)
static const G4int sOutside
G4ThreeVector ComputeLocalDirection(const G4ThreeVector &gp) const
G4bool IsInside(G4int areacode, G4bool testbitmode=false) const
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &gp) const
G4bool IsOutside(G4int areacode) const
static const G4int sInside
virtual G4String GetName() const
CurrentStatus fCurStatWithV
G4ThreeVector ComputeGlobalPoint(const G4ThreeVector &lp) const

◆ DistanceToSurface() [2/2]

G4int G4TwistTubsFlatSide::DistanceToSurface ( const G4ThreeVector & gp,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[] )
overridevirtual

Implements G4VTwistSurface.

Definition at line 256 of file G4TwistTubsFlatSide.cc.

260{
261 // Calculate distance to plane in local coordinate,
262 // then return distance and global intersection points.
263 //
264
266
267 if (fCurStat.IsDone())
268 {
269 for (G4int i=0; i<fCurStat.GetNXX(); ++i)
270 {
271 gxx[i] = fCurStat.GetXX(i);
272 distance[i] = fCurStat.GetDistance(i);
273 areacode[i] = fCurStat.GetAreacode(i);
274 }
275 return fCurStat.GetNXX();
276 }
277 else // initialize
278 {
279 for (auto i=0; i<2; ++i)
280 {
281 distance[i] = kInfinity;
282 areacode[i] = sOutside;
283 gxx[i].set(kInfinity, kInfinity, kInfinity);
284 }
285 }
286
288 G4ThreeVector xx;
289
290 // The plane is placed on origin with making its normal
291 // parallel to z-axis.
292 if (std::fabs(p.z()) <= 0.5 * kCarTolerance) // if p is on plane, return 1
293 {
294 distance[0] = 0;
295 xx = p;
296 }
297 else
298 {
299 distance[0] = std::fabs(p.z());
300 xx.set(p.x(), p.y(), 0);
301 }
302
303 gxx[0] = ComputeGlobalPoint(xx);
304 areacode[0] = sInside;
305 G4bool isvalid = true;
306 fCurStat.SetCurrentStatus(0, gxx[0], distance[0], areacode[0],
307 isvalid, 1, kDontValidate, &gp);
308 return 1;
309}
bool G4bool
Definition G4Types.hh:86
double x() const
double y() const
CurrentStatus fCurStat

◆ GetAreaCode()

G4int G4TwistTubsFlatSide::GetAreaCode ( const G4ThreeVector & xx,
G4bool withTol = true )
overrideprotectedvirtual

Implements G4VTwistSurface.

Definition at line 314 of file G4TwistTubsFlatSide.cc.

316{
317 const G4double rtol
319
320 G4int areacode = sInside;
321
322 if (fAxis[0] == kRho && fAxis[1] == kPhi)
323 {
324 G4int rhoaxis = 0;
325
326 G4ThreeVector dphimin; // direction of phi-minimum boundary
327 G4ThreeVector dphimax; // direction of phi-maximum boundary
328 dphimin = GetCorner(sC0Max1Min);
329 dphimax = GetCorner(sC0Max1Max);
330
331 if (withTol)
332 {
333 G4bool isoutside = false;
334
335 // test boundary of rho-axis
336
337 if (xx.getRho() <= fAxisMin[rhoaxis] + rtol)
338 {
339 areacode |= (sAxis0 & (sAxisRho|sAxisMin)) | sBoundary; // rho-min
340 if (xx.getRho() < fAxisMin[rhoaxis] - rtol) isoutside = true;
341
342 }
343 else if (xx.getRho() >= fAxisMax[rhoaxis] - rtol)
344 {
345 areacode |= (sAxis0 & (sAxisRho|sAxisMax)) | sBoundary; // rho-max
346 if (xx.getRho() > fAxisMax[rhoaxis] + rtol) isoutside = true;
347 }
348
349 // test boundary of phi-axis
350
351 if (AmIOnLeftSide(xx, dphimin) >= 0) // xx is on dphimin
352 {
353 areacode |= (sAxis1 & (sAxisPhi | sAxisMin));
354 if ((areacode & sBoundary) != 0) areacode |= sCorner; // xx is on corner.
355 else areacode |= sBoundary;
356
357 if (AmIOnLeftSide(xx, dphimin) > 0) isoutside = true;
358
359 }
360 else if (AmIOnLeftSide(xx, dphimax) <= 0) // xx is on dphimax
361 {
362 areacode |= (sAxis1 & (sAxisPhi | sAxisMax));
363 if ((areacode & sBoundary) != 0) areacode |= sCorner; // xx is on corner.
364 else areacode |= sBoundary;
365
366 if (AmIOnLeftSide(xx, dphimax) < 0) isoutside = true;
367 }
368
369 // if isoutside = true, clear inside bit.
370 // if not on boundary, add axis information.
371
372 if (isoutside)
373 {
374 G4int tmpareacode = areacode & (~sInside);
375 areacode = tmpareacode;
376 }
377 else if ((areacode & sBoundary) != sBoundary)
378 {
379 areacode |= (sAxis0 & sAxisRho) | (sAxis1 & sAxisPhi);
380 }
381
382 }
383 else
384 {
385 // out of boundary of rho-axis
386
387 if (xx.getRho() < fAxisMin[rhoaxis])
388 {
389 areacode |= (sAxis0 & (sAxisRho | sAxisMin)) | sBoundary;
390 }
391 else if (xx.getRho() > fAxisMax[rhoaxis])
392 {
393 areacode |= (sAxis0 & (sAxisRho | sAxisMax)) | sBoundary;
394 }
395
396 // out of boundary of phi-axis
397
398 if (AmIOnLeftSide(xx, dphimin, false) >= 0) // xx is leftside or
399 {
400 areacode |= (sAxis1 & (sAxisPhi | sAxisMin)) ; // boundary of dphimin
401 if ((areacode & sBoundary) != 0) areacode |= sCorner; // xx is on corner
402 else areacode |= sBoundary;
403
404 }
405 else if (AmIOnLeftSide(xx, dphimax, false) <= 0) // xx is rightside or
406 {
407 areacode |= (sAxis1 & (sAxisPhi | sAxisMax)); // boundary of dphimax
408 if ((areacode & sBoundary) != 0) areacode |= sCorner; // xx is on corner
409 else areacode |= sBoundary;
410
411 }
412
413 if ((areacode & sBoundary) != sBoundary) {
414 areacode |= (sAxis0 & sAxisRho) | (sAxis1 & sAxisPhi);
415 }
416
417 }
418 return areacode;
419 }
420 else
421 {
422 std::ostringstream message;
423 message << "Feature NOT implemented !" << G4endl
424 << " fAxis[0] = " << fAxis[0] << G4endl
425 << " fAxis[1] = " << fAxis[1];
426 G4Exception("G4TwistTubsFlatSide::GetAreaCode()", "GeomSolids0001",
427 FatalException, message);
428 }
429 return areacode;
430}
@ FatalException
double G4double
Definition G4Types.hh:83
double getRho() const
G4double GetRadialTolerance() const
static G4GeometryTolerance * GetInstance()
virtual G4int AmIOnLeftSide(const G4ThreeVector &me, const G4ThreeVector &vec, G4bool withTol=true)
static const G4int sAxisMax
static const G4int sAxis0
static const G4int sAxisPhi
static const G4int sAxisMin
static const G4int sC0Max1Max
static const G4int sAxis1
static const G4int sAxisRho
G4ThreeVector GetCorner(G4int areacode) const
static const G4int sBoundary
static const G4int sCorner
static const G4int sC0Max1Min

Referenced by DistanceToSurface().

◆ GetBoundaryMax()

G4double G4TwistTubsFlatSide::GetBoundaryMax ( G4double phi)
inlineoverridevirtual

Implements G4VTwistSurface.

Definition at line 125 of file G4TwistTubsFlatSide.hh.

126{
128 return std::atan2( dphimax.y(), dphimax.x() );
129}

Referenced by GetFacets().

◆ GetBoundaryMin()

G4double G4TwistTubsFlatSide::GetBoundaryMin ( G4double phi)
inlineoverridevirtual

Implements G4VTwistSurface.

Definition at line 118 of file G4TwistTubsFlatSide.hh.

119{
121 return std::atan2( dphimin.y(), dphimin.x() );
122}

Referenced by GetFacets().

◆ GetFacets()

void G4TwistTubsFlatSide::GetFacets ( G4int m,
G4int n,
G4double xyz[][3],
G4int faces[][4],
G4int iside )
overridevirtual

Implements G4VTwistSurface.

Definition at line 527 of file G4TwistTubsFlatSide.cc.

529{
530 G4ThreeVector p ;
531
532 G4double rmin = fAxisMin[0] ;
533 G4double rmax = fAxisMax[0] ;
534 G4double phimin, phimax ;
535
536 G4double r,phi ;
537 G4int nnode,nface ;
538
539 for ( G4int i = 0 ; i<n ; ++i )
540 {
541 r = rmin + i*(rmax-rmin)/(n-1) ;
542
543 phimin = GetBoundaryMin(r) ;
544 phimax = GetBoundaryMax(r) ;
545
546 for ( G4int j = 0 ; j<k ; ++j )
547 {
548 phi = phimin + j*(phimax-phimin)/(k-1) ;
549
550 nnode = GetNode(i,j,k,n,iside) ;
551 p = SurfacePoint(phi,r,true) ; // surface point in global coord.system
552
553 xyz[nnode][0] = p.x() ;
554 xyz[nnode][1] = p.y() ;
555 xyz[nnode][2] = p.z() ;
556
557 if ( i<n-1 && j<k-1 ) // conterclock wise filling
558 {
559 nface = GetFace(i,j,k,n,iside) ;
560
561 if (fHandedness < 0) // lower side
562 {
563 faces[nface][0] = GetEdgeVisibility(i,j,k,n,0,-1)
564 * ( GetNode(i ,j ,k,n,iside)+1) ;
565 faces[nface][1] = GetEdgeVisibility(i,j,k,n,1,-1)
566 * ( GetNode(i ,j+1,k,n,iside)+1) ;
567 faces[nface][2] = GetEdgeVisibility(i,j,k,n,2,-1)
568 * ( GetNode(i+1,j+1,k,n,iside)+1) ;
569 faces[nface][3] = GetEdgeVisibility(i,j,k,n,3,-1)
570 * ( GetNode(i+1,j ,k,n,iside)+1) ;
571 }
572 else // upper side
573 {
574 faces[nface][0] = GetEdgeVisibility(i,j,k,n,0,1)
575 * ( GetNode(i ,j ,k,n,iside)+1) ;
576 faces[nface][1] = GetEdgeVisibility(i,j,k,n,1,1)
577 * ( GetNode(i+1,j ,k,n,iside)+1) ;
578 faces[nface][2] = GetEdgeVisibility(i,j,k,n,2,1)
579 * ( GetNode(i+1,j+1,k,n,iside)+1) ;
580 faces[nface][3] = GetEdgeVisibility(i,j,k,n,3,1)
581 * ( GetNode(i ,j+1,k,n,iside)+1) ;
582 }
583 }
584 }
585 }
586}
G4double GetBoundaryMin(G4double phi) override
G4double GetBoundaryMax(G4double phi) override
G4ThreeVector SurfacePoint(G4double, G4double, G4bool isGlobal=false) override
G4int GetNode(G4int i, G4int j, G4int m, G4int n, G4int iside)
G4int GetFace(G4int i, G4int j, G4int m, G4int n, G4int iside)
G4int GetEdgeVisibility(G4int i, G4int j, G4int m, G4int n, G4int number, G4int orientation)

◆ GetNormal()

G4ThreeVector G4TwistTubsFlatSide::GetNormal ( const G4ThreeVector & ,
G4bool isGlobal = false )
overridevirtual

Implements G4VTwistSurface.

Definition at line 115 of file G4TwistTubsFlatSide.cc.

117{
118 if (isGlobal)
119 {
121 }
122 else
123 {
124 return fCurrentNormal.normal;
125 }
126}
G4ThreeVector ComputeGlobalDirection(const G4ThreeVector &lp) const

◆ GetSurfaceArea()

G4double G4TwistTubsFlatSide::GetSurfaceArea ( )
inlineoverridevirtual

Implements G4VTwistSurface.

Definition at line 84 of file G4TwistTubsFlatSide.hh.

84{ return fSurfaceArea ; }

◆ SurfacePoint()

G4ThreeVector G4TwistTubsFlatSide::SurfacePoint ( G4double phi,
G4double rho,
G4bool isGlobal = false )
inlineoverridevirtual

Implements G4VTwistSurface.

Definition at line 108 of file G4TwistTubsFlatSide.hh.

110{
111 G4ThreeVector SurfPoint (rho*std::cos(phi) , rho*std::sin(phi) , 0);
112
113 if (isGlobal) { return (fRot * SurfPoint + fTrans); }
114 return SurfPoint;
115}

Referenced by GetFacets().


The documentation for this class was generated from the following files: