Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Mesh Class Reference

#include <G4Mesh.hh>

Classes

struct  ThreeDRectangleParameters
 

Public Types

enum  MeshType {
  invalid , rectangle , nested3DRectangular , cylinder ,
  sphere , tetrahedron
}
 

Public Member Functions

 G4Mesh (G4VPhysicalVolume *containerVolume, const G4Transform3D &)
 
virtual ~G4Mesh ()
 
const std::map< G4int, G4String > & GetEnumMap () const
 
G4VPhysicalVolumeGetContainerVolume () const
 
G4VPhysicalVolumeGetParameterisedVolume () const
 
MeshType GetMeshType () const
 
G4int GetMeshDepth () const
 
const G4Transform3DGetTransform () const
 
const ThreeDRectangleParametersGetThreeDRectParameters () const
 

Detailed Description

Definition at line 47 of file G4Mesh.hh.

Member Enumeration Documentation

◆ MeshType

Enumerator
invalid 
rectangle 
nested3DRectangular 
cylinder 
sphere 
tetrahedron 

Definition at line 51 of file G4Mesh.hh.

51 {
53 , rectangle
55 , cylinder
56 , sphere
58 };
@ invalid
Definition: G4Mesh.hh:52
@ rectangle
Definition: G4Mesh.hh:53
@ nested3DRectangular
Definition: G4Mesh.hh:54
@ sphere
Definition: G4Mesh.hh:56
@ cylinder
Definition: G4Mesh.hh:55
@ tetrahedron
Definition: G4Mesh.hh:57

Constructor & Destructor Documentation

◆ G4Mesh()

G4Mesh::G4Mesh ( G4VPhysicalVolume containerVolume,
const G4Transform3D transform 
)

Definition at line 79 of file G4Mesh.cc.

80: fpContainerVolume(containerVolume)
81, fpParameterisedVolume(nullptr)
82, fMeshType(invalid)
83, fMeshDepth(0)
84, fTransform(transform)
85{
86 if (fpContainerVolume == nullptr) return;
87
88 G4VPhysicalVolume* pv0 = fpContainerVolume;
89 G4VPhysicalVolume* pv1 = nullptr;
90 G4VPhysicalVolume* pv2 = nullptr;
91 G4VPhysicalVolume* pv3 = nullptr;
93 G4LogicalVolume* lv1 = nullptr;
94 G4LogicalVolume* lv2 = nullptr;
95
96 // Check if this is a container for a parameterisation.
97 // A simple parameterisation may only be one level.
98 // Nested parameterisations may be 2- or 3-level.
99 G4bool isContainer = false;
100 if (lv0->GetNoDaughters()) {
101 fMeshDepth++;
102 pv1 = lv0->GetDaughter(0);
103 lv1 = pv1->GetLogicalVolume();
104 if (dynamic_cast<G4PVParameterised*>(pv1)) {
105 isContainer = true;
106 fpParameterisedVolume = pv1;
107 } else if (lv1->GetNoDaughters()) {
108 fMeshDepth++;
109 pv2 = lv1->GetDaughter(0);
110 lv2 = pv2->GetLogicalVolume();
111 if (dynamic_cast<G4PVParameterised*>(pv2) &&
112 dynamic_cast<G4VNestedParameterisation*>(pv2->GetParameterisation())) {
113 isContainer = true;
114 fpParameterisedVolume = pv2;
115 } else if (lv2->GetNoDaughters()) {
116 fMeshDepth++;
117 pv3 = lv2->GetDaughter(0);
118 if (dynamic_cast<G4PVParameterised*>(pv3) &&
119 dynamic_cast<G4VNestedParameterisation*>(pv3->GetParameterisation())) {
120 isContainer = true;
121 fpParameterisedVolume = pv3;
122 }
123 }
124 }
125 }
126
127 if (isContainer) {
128
129 // Get type
130 G4VSolid* pEndSol = fpParameterisedVolume->GetLogicalVolume()->GetSolid ();
131 if (dynamic_cast<G4Box*>(pEndSol)) {
132 fMeshType = rectangle;
133 auto pBox = static_cast<G4Box*>(pEndSol);
134 f3DRPs.fHalfX = pBox->GetXHalfLength();
135 f3DRPs.fHalfY = pBox->GetYHalfLength();
136 f3DRPs.fHalfZ = pBox->GetZHalfLength();
137 } else if (dynamic_cast<G4Tet*>(pEndSol)) {
138 fMeshType = tetrahedron;
139 } else if (dynamic_cast<G4Tubs*>(pEndSol)) {
140 fMeshType = cylinder;
141 } else if (dynamic_cast<G4Sphere*>(pEndSol)) {
142 fMeshType = sphere;
143 }
144
145 // Special case for rectangular nested paramaterisation - extra information
146 if (fMeshDepth == 3 && fMeshType == rectangle) {
147 auto nestedParam3 = dynamic_cast<G4VNestedParameterisation*>(pv3);
148 if (nestedParam3) {
149 fMeshType = nested3DRectangular;
151 (f3DRPs.fAxis1,f3DRPs.fNreplica1,f3DRPs.fWidth1,f3DRPs.fOffset1,f3DRPs.fConsuming1);
153 (f3DRPs.fAxis2,f3DRPs.fNreplica2,f3DRPs.fWidth2,f3DRPs.fOffset2,f3DRPs.fConsuming2);
155 (f3DRPs.fAxis3,f3DRPs.fNreplica3,f3DRPs.fWidth3,f3DRPs.fOffset3,f3DRPs.fConsuming3);
156 }
157 }
158 }
159}
bool G4bool
Definition: G4Types.hh:86
Definition: G4Box.hh:56
G4VSolid * GetSolid() const
std::size_t GetNoDaughters() const
G4VPhysicalVolume * GetDaughter(const std::size_t i) const
Definition: G4Tet.hh:56
Definition: G4Tubs.hh:75
G4LogicalVolume * GetLogicalVolume() const
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
virtual G4VPVParameterisation * GetParameterisation() const =0

◆ ~G4Mesh()

G4Mesh::~G4Mesh ( )
virtual

Definition at line 161 of file G4Mesh.cc.

161{}

Member Function Documentation

◆ GetContainerVolume()

◆ GetEnumMap()

const std::map< G4int, G4String > & G4Mesh::GetEnumMap ( ) const
inline

Definition at line 72 of file G4Mesh.hh.

72{return fEnumMap;}

Referenced by operator<<().

◆ GetMeshDepth()

◆ GetMeshType()

◆ GetParameterisedVolume()

G4VPhysicalVolume * G4Mesh::GetParameterisedVolume ( ) const
inline

Definition at line 74 of file G4Mesh.hh.

74{return fpParameterisedVolume;}

Referenced by G4PhysicalVolumeModel::DescribeAndDescend().

◆ GetThreeDRectParameters()

const ThreeDRectangleParameters & G4Mesh::GetThreeDRectParameters ( ) const
inline

Definition at line 78 of file G4Mesh.hh.

78{return f3DRPs;}

Referenced by G4VSceneHandler::Draw3DRectMeshAsDots(), and G4VSceneHandler::Draw3DRectMeshAsSurfaces().

◆ GetTransform()


The documentation for this class was generated from the following files: