Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UTet.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// G4UTet
27//
28// Class description:
29//
30// Wrapper class for G4Tet to make use of VecGeom Tet.
31
32// Author: Gabriele Cosmo (CERN), 01.11.2013
33// --------------------------------------------------------------------
34#ifndef G4UTET_HH
35#define G4UTET_HH
36
37#include "G4UAdapter.hh"
38
39#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
40
41#include <VecGeom/volumes/UnplacedTet.h>
42
43#include "G4Polyhedron.hh"
44
45/**
46 * @brief G4UTet is a wrapper class for G4Tet to make use of VecGeom Tet.
47 */
48
49class G4UTet : public G4UAdapter<vecgeom::UnplacedTet>
50{
51
52 using Shape_t = vecgeom::UnplacedTet;
53 using Base_t = G4UAdapter<vecgeom::UnplacedTet>;
54
55 public:
56
57 /**
58 * Constructs a tetrahedra, given its parameters.
59 * @param[in] pName The solid name.
60 * @param[in] anchor The anchor point.
61 * @param[in] p2 Point 2.
62 * @param[in] p3 Point 3.
63 * @param[in] p4 Point 4.
64 * @param[in] degeneracyFlag Flag indicating degeneracy of points.
65 */
66 G4UTet(const G4String& pName,
67 const G4ThreeVector& anchor,
68 const G4ThreeVector& p2,
69 const G4ThreeVector& p3,
70 const G4ThreeVector& p4,
71 G4bool* degeneracyFlag = nullptr);
72
73 /**
74 * Default destructor.
75 */
76 ~G4UTet() override = default;
77
78 /**
79 * Dispatch method for parameterisation replication mechanism and
80 * dimension computation.
81 */
82 void ComputeDimensions(G4VPVParameterisation* p,
83 const G4int n,
84 const G4VPhysicalVolume* pRep) override;
85
86 /**
87 * Makes a clone of the object for use in multi-treading.
88 * @returns A pointer to the new cloned allocated solid.
89 */
90 G4VSolid* Clone() const override;
91
92 /**
93 * Returns the type ID, "G4Tet" of the solid.
94 */
95 inline G4GeometryType GetEntityType() const override;
96
97 /**
98 * Returns true as the solid has only planar faces.
99 */
100 inline G4bool IsFaceted() const override;
101
102 /**
103 * Computes the bounding limits of the solid.
104 * @param[out] pMin The minimum bounding limit point.
105 * @param[out] pMax The maximum bounding limit point.
106 */
107 void SetBoundingLimits(const G4ThreeVector& pMin, const G4ThreeVector& pMax);
108 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
109
110 /**
111 * Calculates the minimum and maximum extent of the solid, when under the
112 * specified transform, and within the specified limits.
113 * @param[in] pAxis The axis along which compute the extent.
114 * @param[in] pVoxelLimit The limiting space dictated by voxels.
115 * @param[in] pTransform The internal transformation applied to the solid.
116 * @param[out] pMin The minimum extent value.
117 * @param[out] pMax The maximum extent value.
118 * @returns True if the solid is intersected by the extent region.
119 */
120 G4bool CalculateExtent(const EAxis pAxis,
121 const G4VoxelLimits& pVoxelLimit,
122 const G4AffineTransform& pTransform,
123 G4double& pMin, G4double& pMax) const override;
124
125 /**
126 * Returns a generated polyhedron as graphical representations.
127 */
128 G4Polyhedron* CreatePolyhedron() const override;
129
130 /**
131 * Modifier and accessors, for the four vertices of the shape.
132 */
133 void SetVertices(const G4ThreeVector& anchor,
134 const G4ThreeVector& p1,
135 const G4ThreeVector& p2,
136 const G4ThreeVector& p3,
137 G4bool* degeneracyFlag = nullptr);
138 void GetVertices(G4ThreeVector& anchor,
139 G4ThreeVector& p1,
140 G4ThreeVector& p2,
141 G4ThreeVector& p3) const;
142 std::vector<G4ThreeVector> GetVertices() const;
143
144 /**
145 * Checks if the tetrahedron is degenerate. A tetrahedron is considered
146 * as degenerate in case its minimal height is less than the degeneracy
147 * tolerance
148 * @returns true if the tetrahedron is degenerate.
149 */
150 G4bool CheckDegeneracy(const G4ThreeVector& p0,
151 const G4ThreeVector& p1,
152 const G4ThreeVector& p2,
153 const G4ThreeVector& p3) const;
154
155 /**
156 * Copy constructor and assignment operator.
157 */
158 G4UTet(const G4UTet& rhs);
159 G4UTet& operator=(const G4UTet& rhs);
160
161 private:
162
163 G4ThreeVector fBmin, fBmax; // bounding box
164};
165
166// --------------------------------------------------------------------
167// Inline methods
168// --------------------------------------------------------------------
169
170inline G4GeometryType G4UTet::GetEntityType() const
171{
172 return "G4Tet";
173}
174
175inline G4bool G4UTet::IsFaceted() const
176{
177 return true;
178}
179
180#endif // G4GEOM_USE_USOLIDS
181
182#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