Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UTessellatedSolid.hh
Go to the documentation of this file.
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// G4UTesselladedSolid
27//
28// Class description:
29//
30// Wrapper class for G4TessellatedSolid to make use of VecGeom TessellatedSolid.
31
32// Author: Gabriele Cosmo (CERN), 11.01.2018
33// --------------------------------------------------------------------
34#ifndef G4UTESSELLATEDSOLID_HH
35#define G4UTESSELLATEDSOLID_HH
36
37#include "G4UAdapter.hh"
38
39#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
40
41#include <VecGeom/volumes/UnplacedTessellated.h>
42
43#include "G4Polyhedron.hh"
44#include "G4VFacet.hh"
45
46/**
47 * @brief G4UTessellatedSolid is a wrapper class for G4TessellatedSolid
48 * to make use of VecGeom TessellatedSolid.
49 */
50
51class G4UTessellatedSolid : public G4UAdapter<vecgeom::UnplacedTessellated>
52{
53 using Shape_t = vecgeom::UnplacedTessellated;
54 using Base_t = G4UAdapter<vecgeom::UnplacedTessellated>;
55
56 public:
57
58 /**
59 * Default Constructor.
60 */
61 G4UTessellatedSolid();
62
63 /**
64 * Constructor with solid's name.
65 * @param[in] name The name of the solid.
66 */
67 G4UTessellatedSolid(const G4String& pName);
68
69 /**
70 * Destructor. Clearing all allocated facets and data.
71 */
72 ~G4UTessellatedSolid() override;
73
74 /**
75 * Methods for adding or retrieving a facet given an index.
76 */
77 G4bool AddFacet(G4VFacet* aFacet);
78 G4VFacet* GetFacet(G4int i) const;
79
80 /**
81 * Returns the total number of facets.
82 */
83 G4int GetNumberOfFacets() const;
84
85 /**
86 * Returns the type ID, "G4TessellatedSolid" of the solid.
87 */
88 inline G4GeometryType GetEntityType() const override;
89
90 /**
91 * Returns true as the solid has only planar faces.
92 */
93 inline G4bool IsFaceted() const override;
94
95 /**
96 * Modifier and accessor to close/finalise the solid.
97 */
98 void SetSolidClosed(const G4bool t);
99 G4bool GetSolidClosed() const;
100
101 /**
102 * Allowing to tune the maximum number of voxels to use for optimisation.
103 */
104 void SetMaxVoxels(G4int);
105
106 /**
107 * Accessors.
108 */
109 G4double GetMinXExtent() const;
110 G4double GetMaxXExtent() const;
111 G4double GetMinYExtent() const;
112 G4double GetMaxYExtent() const;
113 G4double GetMinZExtent() const;
114 G4double GetMaxZExtent() const;
115
116 /**
117 * Loggers reporting the total allocated memory.
118 */
119 G4int AllocatedMemoryWithoutVoxels();
120 G4int AllocatedMemory();
121 void DisplayAllocatedMemory();
122
123 /**
124 * Computes the bounding limits of the solid.
125 * @param[out] pMin The minimum bounding limit point.
126 * @param[out] pMax The maximum bounding limit point.
127 */
128 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
129
130 /**
131 * Calculates the minimum and maximum extent of the solid, when under the
132 * specified transform, and within the specified limits.
133 * @param[in] pAxis The axis along which compute the extent.
134 * @param[in] pVoxelLimit The limiting space dictated by voxels.
135 * @param[in] pTransform The internal transformation applied to the solid.
136 * @param[out] pMin The minimum extent value.
137 * @param[out] pMax The maximum extent value.
138 * @returns True if the solid is intersected by the extent region.
139 */
140 G4bool CalculateExtent(const EAxis pAxis,
141 const G4VoxelLimits& pVoxelLimit,
142 const G4AffineTransform& pTransform,
143 G4double& pMin, G4double& pMax) const override;
144
145 /**
146 * Returns a generated polyhedron as graphical representations.
147 */
148 G4Polyhedron* CreatePolyhedron() const override;
149
150 /**
151 * Copy constructor and assignment operator.
152 */
153 G4UTessellatedSolid( const G4UTessellatedSolid& source );
154 G4UTessellatedSolid& operator=(const G4UTessellatedSolid& source);
155
156 private:
157
158 std::vector<G4VFacet*> fFacets;
159 std::vector<G4ThreeVector> fVertexList;
160};
161
162// --------------------------------------------------------------------
163// Inline methods
164// --------------------------------------------------------------------
165
166inline G4GeometryType G4UTessellatedSolid::GetEntityType() const
167{
168 return "G4TessellatedSolid";
169}
170
171inline G4bool G4UTessellatedSolid::IsFaceted() const
172{
173 return true;
174}
175
176#endif // G4GEOM_USE_USOLIDS
177
178#endif
G4PVDivision & operator=(const G4PVDivision &)=delete
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4String G4GeometryType
Definition G4VSolid.hh:70
EAxis
Definition geomdefs.hh:54