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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /geometry/solids/specific/include/G4VTwistSurface.hh (Version 11.3.0) and /geometry/solids/specific/include/G4VTwistSurface.hh (Version 6.2.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 // G4VTwistSurface                                
 27 //                                                
 28 // Class description:                             
 29 //                                                
 30 // Abstract base class for boundary surface of    
 31                                                   
 32 // 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepbu    
 33 // 13-Nov-2003 - O.Link (Oliver.Link@cern.ch),    
 34 //               from original version in Jupi    
 35 // -------------------------------------------    
 36 #ifndef G4VTWISTSURFACE_HH                        
 37 #define G4VTWISTSURFACE_HH                        
 38                                                   
 39 #include <CLHEP/Units/SystemOfUnits.h>            
 40                                                   
 41 #include "G4VSolid.hh"                            
 42 #include "geomdefs.hh"                            
 43                                                   
 44 #include "G4RotationMatrix.hh"                    
 45                                                   
 46 #define G4VSURFACENXX 10                          
 47                                                   
 48 class G4VTwistSurface                             
 49 {                                                 
 50  public:                                          
 51                                                   
 52    enum EValidate { kDontValidate = 0, kValida    
 53                     kValidateWithoutTol = 2, k    
 54                                                   
 55    G4VTwistSurface (const G4String& name);        
 56    G4VTwistSurface (const G4String& name,         
 57                     const G4RotationMatrix& ro    
 58                     const G4ThreeVector&    tl    
 59                           G4int             ha    
 60                     const EAxis             ax    
 61                     const EAxis             ax    
 62                           G4double          ax    
 63                           G4double          ax    
 64                           G4double          ax    
 65                           G4double          ax    
 66                                                   
 67    virtual ~G4VTwistSurface() = default;          
 68                                                   
 69    virtual G4int     AmIOnLeftSide(const G4Thr    
 70                                    const G4Thr    
 71                                          G4boo    
 72                                                   
 73    virtual G4double  DistanceToBoundary(          
 74                                                   
 75                                         const     
 76                                                   
 77    virtual G4double  DistanceToIn(const G4Thre    
 78                                   const G4Thre    
 79                                         G4Thre    
 80    virtual G4double  DistanceToOut(const G4Thr    
 81                                    const G4Thr    
 82                                          G4Thr    
 83    virtual G4double  DistanceTo(const G4ThreeV    
 84                                       G4ThreeV    
 85                                                   
 86    virtual G4int     DistanceToSurface(const G    
 87                                        const G    
 88                                              G    
 89                                              G    
 90                                              G    
 91                                              G    
 92                                        EValida    
 93                                                   
 94    virtual G4int     DistanceToSurface(const G    
 95                                              G    
 96                                              G    
 97                                              G    
 98                                                   
 99    void              DebugPrint() const;          
100                                                   
101    virtual G4ThreeVector GetNormal(const G4Thr    
102                                                   
103    virtual G4String      GetName() const { ret    
104    virtual void          GetBoundaryParameters    
105                                                   
106                                                   
107                                                   
108    virtual G4ThreeVector GetBoundaryAtPZ(G4int    
109                                          const    
110                                                   
111    inline  G4double DistanceToPlaneWithV(const    
112                                          const    
113                                          const    
114                                          const    
115                                                   
116                                                   
117    inline  G4double DistanceToPlane(const G4Th    
118                                     const G4Th    
119                                     const G4Th    
120                                           G4Th    
121                                                   
122    inline  G4double DistanceToPlane(const G4Th    
123                                     const G4Th    
124                                     const G4Th    
125                                     const G4Th    
126                                           G4Th    
127                                           G4Th    
128                                                   
129    inline  G4double DistanceToLine (const G4Th    
130                                     const G4Th    
131                                     const G4Th    
132                                           G4Th    
133                                                   
134    inline G4bool IsAxis0    (G4int areacode) c    
135    inline G4bool IsAxis1    (G4int areacode) c    
136    inline G4bool IsOutside  (G4int areacode) c    
137    inline G4bool IsInside   (G4int areacode, G    
138    inline G4bool IsBoundary (G4int areacode, G    
139    inline G4bool IsCorner   (G4int areacode, G    
140    inline G4bool IsValidNorm() const { return     
141    G4bool IsSameBoundary (G4VTwistSurface* sur    
142                           G4VTwistSurface* sur    
143    inline G4int  GetAxisType(G4int areacode, G    
144                                                   
145    inline G4ThreeVector ComputeGlobalPoint        
146    inline G4ThreeVector ComputeLocalPoint         
147    inline G4ThreeVector ComputeGlobalDirection    
148    inline G4ThreeVector ComputeLocalDirection     
149                                                   
150    // set methods                                 
151                                                   
152    inline void SetAxis(G4int i, const EAxis ax    
153    inline void SetNeighbours(G4VTwistSurface*     
154                              G4VTwistSurface*     
155                                                   
156    virtual G4ThreeVector SurfacePoint(G4double    
157                                       G4bool i    
158    virtual G4double GetBoundaryMin(G4double) =    
159    virtual G4double GetBoundaryMax(G4double) =    
160    virtual G4double GetSurfaceArea() = 0 ;        
161    virtual void GetFacets(G4int m, G4int n, G4    
162                           G4int faces[][4], G4    
163    G4int GetNode( G4int i, G4int j, G4int m, G    
164    G4int GetFace( G4int i, G4int j, G4int m, G    
165    G4int GetEdgeVisibility( G4int i, G4int j,     
166                             G4int number, G4in    
167                                                   
168    G4VTwistSurface(__void__&);                    
169      // Fake default constructor for usage res    
170      // persistency for clients requiring prea    
171      // persistifiable objects.                   
172                                                   
173  protected:                                       
174                                                   
175    inline G4VTwistSurface** GetNeighbours() {     
176    inline G4int GetNeighbours(G4int areacode,     
177    inline G4ThreeVector GetCorner(G4int areaco    
178    void GetBoundaryAxis(G4int areacode, EAxis     
179    void GetBoundaryLimit(G4int areacode, G4dou    
180    virtual G4int GetAreaCode(const G4ThreeVect    
181                                                   
182    virtual void SetBoundary(const G4int&          
183                             const G4ThreeVecto    
184                             const G4ThreeVecto    
185                             const G4int&          
186      // areacode must be one of them:             
187      // sAxis0 & sAxisMin, sAxis0 & sAxisMax,     
188      // sAxis1 & sAxisMin, sAxis1 & sAxisMax.     
189      // boundarytype represents the shape of l    
190      // from the start point to end point of b    
191      // ex.                                       
192      // sAxisRho = linear line which start poi    
193      // sAxisPhi = part of circle which center    
194                                                   
195    void SetCorner(G4int areacode, G4double x,     
196                                                   
197  private:                                         
198                                                   
199    virtual void SetBoundaries() = 0;              
200    virtual void SetCorners()    = 0;              
201                                                   
202  // data members -----------------------------    
203                                                   
204  public:                                          
205                                                   
206    static const G4int sOutside ;                  
207    static const G4int sInside  ;                  
208    static const G4int sBoundary;                  
209    static const G4int sCorner;                    
210    static const G4int sC0Min1Min;                 
211    static const G4int sC0Max1Min;                 
212    static const G4int sC0Max1Max;                 
213    static const G4int sC0Min1Max;                 
214    static const G4int sAxisMin;                   
215    static const G4int sAxisMax;                   
216    static const G4int sAxisX;                     
217    static const G4int sAxisY;                     
218    static const G4int sAxisZ;                     
219    static const G4int sAxisRho;                   
220    static const G4int sAxisPhi;                   
221    static const G4int sAxis0;                     
222    static const G4int sAxis1;                     
223    static const G4int sSizeMask;                  
224    static const G4int sAxisMask;                  
225    static const G4int sAreaMask;                  
226                                                   
227  protected:                                       
228                                                   
229    class CurrentStatus                            
230    {                                              
231      public:                                      
232                                                   
233       CurrentStatus();                            
234       virtual ~CurrentStatus();                   
235                                                   
236       inline G4ThreeVector GetXX(G4int i)         
237       inline G4double      GetDistance(G4int i    
238       inline G4int         GetAreacode(G4int i    
239       inline G4int         GetNXX()               
240       inline G4bool        IsDone()               
241       inline G4bool        IsValid(G4int i)       
242                                                   
243       void SetCurrentStatus(G4int                 
244                             G4ThreeVector&        
245                             G4double&             
246                             G4int&                
247                             G4bool&               
248                             G4int                 
249                             EValidate             
250                       const G4ThreeVector* p,     
251                       const G4ThreeVector* v =    
252                                                   
253       void ResetfDone(EValidate validate,         
254                 const G4ThreeVector* p,           
255                 const G4ThreeVector* v = nullp    
256                                                   
257                                                   
258       void DebugPrint() const;                    
259                                                   
260      private:                                     
261                                                   
262       G4double             fDistance[G4VSURFAC    
263       G4ThreeVector        fXX[G4VSURFACENXX];    
264       G4int                fAreacode[G4VSURFAC    
265       G4bool               fIsValid[G4VSURFACE    
266       G4int                fNXX;                  
267       G4ThreeVector        fLastp;                
268       G4ThreeVector        fLastv;                
269       EValidate            fLastValidate;         
270       G4bool               fDone;                 
271    };                                             
272                                                   
273    class Boundary                                 
274    {                                              
275      public:                                      
276                                                   
277       Boundary() = default;                       
278       virtual ~Boundary() = default;              
279                                                   
280       void SetFields(const G4int&        areac    
281                      const G4ThreeVector& d,      
282                      const G4ThreeVector& x0,     
283                      const G4int&         boun    
284                                                   
285       G4bool IsEmpty() const;                     
286                                                   
287       G4bool GetBoundaryParameters(const G4int    
288                                          G4Thr    
289                                          G4Thr    
290                                          G4int    
291                                                   
292      private:                                     
293                                                   
294       G4int          fBoundaryAcode{-1};          
295       G4ThreeVector  fBoundaryDirection;          
296       G4ThreeVector  fBoundaryX0;                 
297       G4int          fBoundaryType{0};            
298    };                                             
299                                                   
300    EAxis               fAxis[2];                  
301    G4double            fAxisMin[2];               
302    G4double            fAxisMax[2];               
303    CurrentStatus       fCurStatWithV;             
304    CurrentStatus       fCurStat;                  
305    G4RotationMatrix    fRot;                      
306    G4ThreeVector       fTrans;                    
307    G4int               fHandedness;               
308    class G4SurfCurNormal                          
309    {                                              
310      public:                                      
311                                                   
312        G4ThreeVector p;                           
313        G4ThreeVector normal;                      
314    };                                             
315    G4SurfCurNormal     fCurrentNormal;            
316    G4bool              fIsValidNorm;              
317    G4double            kCarTolerance;             
318                                                   
319  private:                                         
320                                                   
321    G4VTwistSurface* fNeighbours[4]; // {0,1,2,    
322                                     //            
323    G4ThreeVector fCorners[4];     // corners o    
324    Boundary      fBoundaries[4];  // boundarie    
325    G4String      fName;                           
326                                                   
327    class G4SurfSideQuery                          
328    {                                              
329      public:                                      
330                                                   
331        G4ThreeVector me;                          
332        G4ThreeVector vec;                         
333        G4bool        withTol;                     
334        G4int         amIOnLeftSide;               
335    };                                             
336    G4SurfSideQuery fAmIOnLeftSide;                
337 };                                                
338                                                   
339 //============================================    
340 // inline functions                               
341 //============================================    
342                                                   
343 struct Intersection                               
344 {                                                 
345   G4double phi ;  // parameter phi                
346   G4double u ;    // parameter u                  
347   G4ThreeVector xx ;   // intersection point i    
348   G4double distance ;  // distance to intersec    
349   G4int areacode ;     // the areacode of the     
350   G4bool isvalid ;     // valid intersection ?    
351                                                   
352 };                                                
353                                                   
354 inline                                            
355 G4bool DistanceSort( const Intersection& a, co    
356 {                                                 
357   return a.distance < b.distance ;                
358 }                                                 
359                                                   
360 inline                                            
361 G4bool EqualIntersection( const Intersection&     
362 {                                                 
363   return ( ( a.xx - b.xx ).mag() < 1E-9*CLHEP:    
364 }                                                 
365                                                   
366 #include "G4VTwistSurface.icc"                    
367                                                   
368 #endif                                            
369