Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:59:36

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 // G4UTesselladedSolid
0027 //
0028 // Class description:
0029 //
0030 // Wrapper class for G4TessellatedSolid to make use of VecGeom TessellatedSolid.
0031 
0032 // 11.01.18 G.Cosmo, CERN
0033 // --------------------------------------------------------------------
0034 #ifndef G4UTESSELLATEDSOLID_HH
0035 #define G4UTESSELLATEDSOLID_HH
0036 
0037 #include "G4UAdapter.hh"
0038 
0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
0040 
0041 #include <VecGeom/volumes/UnplacedTessellated.h>
0042 
0043 #include "G4Polyhedron.hh"
0044 #include "G4VFacet.hh"
0045 
0046 class G4UTessellatedSolid : public G4UAdapter<vecgeom::UnplacedTessellated>
0047 {
0048   using Shape_t = vecgeom::UnplacedTessellated;
0049   using Base_t  = G4UAdapter<vecgeom::UnplacedTessellated>;
0050 
0051   public:
0052 
0053     G4UTessellatedSolid();
0054     G4UTessellatedSolid(const G4String& pName);
0055    ~G4UTessellatedSolid() override;
0056 
0057     G4bool AddFacet(G4VFacet* aFacet);
0058     G4VFacet* GetFacet(G4int i) const;
0059 
0060     G4int GetNumberOfFacets() const;
0061 
0062     inline G4GeometryType GetEntityType() const override;
0063 
0064     inline G4bool IsFaceted() const override;
0065 
0066     void SetSolidClosed(const G4bool t);
0067     G4bool GetSolidClosed() const;
0068 
0069     void SetMaxVoxels(G4int);
0070 
0071     G4double GetMinXExtent() const;
0072     G4double GetMaxXExtent() const;
0073     G4double GetMinYExtent() const;
0074     G4double GetMaxYExtent() const;
0075     G4double GetMinZExtent() const;
0076     G4double GetMaxZExtent() const;
0077     G4int AllocatedMemoryWithoutVoxels();
0078     G4int AllocatedMemory();
0079     void DisplayAllocatedMemory();
0080 
0081     G4UTessellatedSolid( const G4UTessellatedSolid& source );
0082     G4UTessellatedSolid& operator=(const G4UTessellatedSolid& source);
0083       // Copy constructor and assignment operator.
0084 
0085     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0086     G4bool CalculateExtent(const EAxis pAxis,
0087                            const G4VoxelLimits& pVoxelLimit,
0088                            const G4AffineTransform& pTransform,
0089                                  G4double& pMin, G4double& pMax) const override;  
0090 
0091     G4Polyhedron* CreatePolyhedron() const override;
0092 
0093   private:
0094 
0095     std::vector<G4VFacet*> fFacets;
0096     std::vector<G4ThreeVector> fVertexList;
0097 };
0098 
0099 // --------------------------------------------------------------------
0100 // Inline methods
0101 // --------------------------------------------------------------------
0102 
0103 inline G4GeometryType G4UTessellatedSolid::GetEntityType() const
0104 {
0105   return "G4TessellatedSolid";
0106 }
0107 
0108 inline G4bool G4UTessellatedSolid::IsFaceted() const
0109 {
0110   return true;
0111 }
0112 
0113 #endif  // G4GEOM_USE_USOLIDS
0114 
0115 #endif