Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:19

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4VCSGfaceted
0027 //
0028 // Class description:
0029 //
0030 //   Virtual class defining CSG-like type shape that is built entirely
0031 //   of G4CSGface faces.
0032 
0033 // Author: David C. Williams (davidw@scipp.ucsc.edu)
0034 // --------------------------------------------------------------------
0035 #ifndef G4VCSGFACETED_HH
0036 #define G4VCSGFACETED_HH
0037 
0038 #include "G4VSolid.hh"
0039 
0040 class G4VCSGface;
0041 class G4VisExtent;
0042 
0043 class G4VCSGfaceted : public G4VSolid 
0044 {
0045   public:
0046 
0047     G4VCSGfaceted( const G4String& name );
0048     virtual ~G4VCSGfaceted();
0049   
0050     G4VCSGfaceted( const G4VCSGfaceted& source );
0051     G4VCSGfaceted& operator=( const G4VCSGfaceted& source );
0052   
0053     G4bool CalculateExtent( const EAxis pAxis,
0054                             const G4VoxelLimits& pVoxelLimit,
0055                             const G4AffineTransform& pTransform,
0056                                   G4double& pmin, G4double& pmax) const override;
0057   
0058     EInside Inside( const G4ThreeVector& p ) const override;
0059 
0060     G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
0061 
0062     G4double DistanceToIn( const G4ThreeVector& p,
0063                            const G4ThreeVector& v ) const override;
0064     G4double DistanceToIn( const G4ThreeVector& p ) const override;
0065     G4double DistanceToOut( const G4ThreeVector& p,
0066                             const G4ThreeVector& v,
0067                             const G4bool calcNorm = false,
0068                                   G4bool* validNorm = nullptr,
0069                                   G4ThreeVector* n = nullptr ) const override;
0070     G4double DistanceToOut( const G4ThreeVector& p ) const override;
0071 
0072     G4GeometryType GetEntityType() const override;
0073 
0074     std::ostream& StreamInfo(std::ostream& os) const override;
0075 
0076     G4Polyhedron* CreatePolyhedron() const override = 0;
0077 
0078     void DescribeYourselfTo( G4VGraphicsScene& scene ) const override;
0079 
0080     G4VisExtent GetExtent() const override;
0081 
0082     G4Polyhedron* GetPolyhedron () const override;
0083 
0084     G4int GetCubVolStatistics() const;
0085     G4double GetCubVolEpsilon() const;
0086     void SetCubVolStatistics(G4int st);
0087     void SetCubVolEpsilon(G4double ep);
0088     G4int GetAreaStatistics() const;
0089     G4double GetAreaAccuracy() const;
0090     void SetAreaStatistics(G4int st);
0091     void SetAreaAccuracy(G4double ep);
0092 
0093     G4double GetCubicVolume() override;
0094       // Returns an estimation of the geometrical cubic volume of the
0095       // solid. Caches the computed value once computed the first time.
0096     G4double GetSurfaceArea() override;
0097       // Returns an estimation of the geometrical surface area of the
0098       // solid. Caches the computed value once computed the first time.
0099 
0100     G4VCSGfaceted(__void__&);
0101       // Fake default constructor for usage restricted to direct object
0102       // persistency for clients requiring preallocation of memory for
0103       // persistifiable objects.
0104 
0105   protected:
0106 
0107     G4int numFace = 0;
0108     G4VCSGface **faces = nullptr;
0109     G4double fCubicVolume = 0.0;
0110     G4double fSurfaceArea = 0.0;
0111     mutable G4bool fRebuildPolyhedron = false;
0112     mutable G4Polyhedron* fpPolyhedron = nullptr;
0113 
0114     virtual G4double DistanceTo( const G4ThreeVector& p,
0115                                  const G4bool outgoing ) const;
0116 
0117     G4ThreeVector GetPointOnSurfaceGeneric()const;
0118       // Returns a random point located on the surface of the solid 
0119       // in case of generic Polycone or generic Polyhedra.
0120 
0121     void CopyStuff( const G4VCSGfaceted& source );
0122     void DeleteStuff();
0123 
0124   private:
0125 
0126     G4int    fStatistics;
0127     G4double fCubVolEpsilon;
0128     G4double fAreaAccuracy;
0129       // Statistics, error accuracy for volume estimation.
0130 };
0131 
0132 #endif