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

#include <G4GDMLWriteDefine.hh>

+ Inheritance diagram for G4GDMLWriteDefine:

Public Member Functions

G4ThreeVector GetAngles (const G4RotationMatrix &)
 
void ScaleWrite (xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &scl)
 
void RotationWrite (xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &rot)
 
void PositionWrite (xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &pos)
 
void FirstrotationWrite (xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &rot)
 
void FirstpositionWrite (xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &pos)
 
void AddPosition (const G4String &name, const G4ThreeVector &pos)
 
virtual void DefineWrite (xercesc::DOMElement *)
 
- Public Member Functions inherited from G4GDMLWrite
G4Transform3D Write (const G4String &filename, const G4LogicalVolume *const topLog, const G4String &schemaPath, const G4int depth, G4bool storeReferences=true)
 
void AddModule (const G4VPhysicalVolume *const topVol)
 
void AddModule (const G4int depth)
 
void AddAuxiliary (G4GDMLAuxStructType myaux)
 
void SetOutputFileOverwrite (G4bool flag)
 
virtual void MaterialsWrite (xercesc::DOMElement *)=0
 
virtual void SolidsWrite (xercesc::DOMElement *)=0
 
virtual void StructureWrite (xercesc::DOMElement *)=0
 
virtual G4Transform3D TraverseVolumeTree (const G4LogicalVolume *const, const G4int)=0
 
virtual void SurfacesWrite ()=0
 
virtual void SetupWrite (xercesc::DOMElement *, const G4LogicalVolume *const)=0
 
virtual void ExtensionWrite (xercesc::DOMElement *)
 
virtual void UserinfoWrite (xercesc::DOMElement *)
 
virtual void AddExtension (xercesc::DOMElement *, const G4LogicalVolume *const)
 
G4String GenerateName (const G4String &, const void *const)
 

Protected Member Functions

 G4GDMLWriteDefine ()
 
virtual ~G4GDMLWriteDefine ()
 
void Scale_vectorWrite (xercesc::DOMElement *, const G4String &, const G4String &, const G4ThreeVector &)
 
void Rotation_vectorWrite (xercesc::DOMElement *, const G4String &, const G4String &, const G4ThreeVector &)
 
void Position_vectorWrite (xercesc::DOMElement *, const G4String &, const G4String &, const G4ThreeVector &)
 
- Protected Member Functions inherited from G4GDMLWrite
 G4GDMLWrite ()
 
virtual ~G4GDMLWrite ()
 
VolumeMapType & VolumeMap ()
 
xercesc::DOMAttr * NewAttribute (const G4String &, const G4String &)
 
xercesc::DOMAttr * NewAttribute (const G4String &, const G4double &)
 
xercesc::DOMElement * NewElement (const G4String &)
 
G4String Modularize (const G4VPhysicalVolume *const topvol, const G4int depth)
 
void AddAuxInfo (G4GDMLAuxListType *auxInfoList, xercesc::DOMElement *element)
 
G4bool FileExists (const G4String &) const
 
PhysVolumeMapType & PvolumeMap ()
 
DepthMapType & DepthMap ()
 

Protected Attributes

xercesc::DOMElement * defineElement = nullptr
 
- Protected Attributes inherited from G4GDMLWrite
G4String SchemaLocation
 
xercesc::DOMDocument * doc = nullptr
 
xercesc::DOMElement * extElement = nullptr
 
xercesc::DOMElement * userinfoElement = nullptr
 
G4GDMLAuxListType auxList
 
G4bool overwriteOutputFile = false
 

Static Protected Attributes

static const G4double kRelativePrecision = DBL_EPSILON
 
static const G4double kAngularPrecision = DBL_EPSILON
 
static const G4double kLinearPrecision = DBL_EPSILON
 
- Static Protected Attributes inherited from G4GDMLWrite
static G4bool addPointerToName = true
 

Additional Inherited Members

- Static Public Member Functions inherited from G4GDMLWrite
static void SetAddPointerToName (G4bool)
 

Detailed Description

Definition at line 43 of file G4GDMLWriteDefine.hh.

Constructor & Destructor Documentation

◆ G4GDMLWriteDefine()

G4GDMLWriteDefine::G4GDMLWriteDefine ( )
protected

Definition at line 39 of file G4GDMLWriteDefine.cc.

40 : G4GDMLWrite()
41{
42}

◆ ~G4GDMLWriteDefine()

G4GDMLWriteDefine::~G4GDMLWriteDefine ( )
protectedvirtual

Definition at line 45 of file G4GDMLWriteDefine.cc.

46{
47}

Member Function Documentation

◆ AddPosition()

void G4GDMLWriteDefine::AddPosition ( const G4String & name,
const G4ThreeVector & pos )
inline

Definition at line 73 of file G4GDMLWriteDefine.hh.

74 {
75 Position_vectorWrite(defineElement, "position", name, pos);
76 }
xercesc::DOMElement * defineElement
void Position_vectorWrite(xercesc::DOMElement *, const G4String &, const G4String &, const G4ThreeVector &)

Referenced by G4GDMLWriteSolids::TessellatedWrite(), and G4GDMLWriteSolids::TetWrite().

◆ DefineWrite()

void G4GDMLWriteDefine::DefineWrite ( xercesc::DOMElement * element)
virtual

Implements G4GDMLWrite.

Definition at line 137 of file G4GDMLWriteDefine.cc.

138{
139#ifdef G4VERBOSE
140 G4cout << "G4GDML: Writing definitions..." << G4endl;
141#endif
142 defineElement = NewElement("define");
143 element->appendChild(defineElement);
144}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
xercesc::DOMElement * NewElement(const G4String &)

◆ FirstpositionWrite()

void G4GDMLWriteDefine::FirstpositionWrite ( xercesc::DOMElement * element,
const G4String & name,
const G4ThreeVector & pos )
inline

Definition at line 68 of file G4GDMLWriteDefine.hh.

70 {
71 Position_vectorWrite(element, "firstposition", name, pos);
72 }

Referenced by G4GDMLWriteSolids::BooleanWrite().

◆ FirstrotationWrite()

void G4GDMLWriteDefine::FirstrotationWrite ( xercesc::DOMElement * element,
const G4String & name,
const G4ThreeVector & rot )
inline

Definition at line 63 of file G4GDMLWriteDefine.hh.

65 {
66 Rotation_vectorWrite(element, "firstrotation", name, rot);
67 }
void Rotation_vectorWrite(xercesc::DOMElement *, const G4String &, const G4String &, const G4ThreeVector &)

Referenced by G4GDMLWriteSolids::BooleanWrite().

◆ GetAngles()

G4ThreeVector G4GDMLWriteDefine::GetAngles ( const G4RotationMatrix & mtx)

Definition at line 50 of file G4GDMLWriteDefine.cc.

51{
52 G4double x, y, z;
53 G4RotationMatrix mat = mtx;
54 mat.rectify(); // Rectify matrix from possible roundoff errors
55
56 // Direction of rotation given by left-hand rule; clockwise rotation
57
58 static const G4double kMatrixPrecision = 10E-10;
59 const G4double cosb = std::sqrt(mtx.xx() * mtx.xx() + mtx.yx() * mtx.yx());
60
61 if(cosb > kMatrixPrecision)
62 {
63 x = std::atan2(mtx.zy(), mtx.zz());
64 y = std::atan2(-mtx.zx(), cosb);
65 z = std::atan2(mtx.yx(), mtx.xx());
66 }
67 else
68 {
69 x = std::atan2(-mtx.yz(), mtx.yy());
70 y = std::atan2(-mtx.zx(), cosb);
71 z = 0.0;
72 }
73
74 return G4ThreeVector(x, y, z);
75}
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
double zz() const
double yz() const
double zx() const
double yx() const
double zy() const
double xx() const
double yy() const

Referenced by G4GDMLWriteStructure::AssemblyWrite(), G4GDMLWriteSolids::BooleanWrite(), G4GDMLWriteSolids::MultiUnionWrite(), G4GDMLWriteParamvol::ParametersWrite(), G4GDMLWriteStructure::PhysvolWrite(), and G4GDMLWriteStructure::TraverseVolumeTree().

◆ Position_vectorWrite()

void G4GDMLWriteDefine::Position_vectorWrite ( xercesc::DOMElement * element,
const G4String & tag,
const G4String & name,
const G4ThreeVector & pos )
protected

Definition at line 118 of file G4GDMLWriteDefine.cc.

122{
123 const G4double x = (std::fabs(pos.x()) < kLinearPrecision) ? 0.0 : pos.x();
124 const G4double y = (std::fabs(pos.y()) < kLinearPrecision) ? 0.0 : pos.y();
125 const G4double z = (std::fabs(pos.z()) < kLinearPrecision) ? 0.0 : pos.z();
126
127 xercesc::DOMElement* positionElement = NewElement(tag);
128 positionElement->setAttributeNode(NewAttribute("name", name));
129 positionElement->setAttributeNode(NewAttribute("x", x / mm));
130 positionElement->setAttributeNode(NewAttribute("y", y / mm));
131 positionElement->setAttributeNode(NewAttribute("z", z / mm));
132 positionElement->setAttributeNode(NewAttribute("unit", "mm"));
133 element->appendChild(positionElement);
134}
static const G4double kLinearPrecision
xercesc::DOMAttr * NewAttribute(const G4String &, const G4String &)

Referenced by AddPosition(), FirstpositionWrite(), and PositionWrite().

◆ PositionWrite()

void G4GDMLWriteDefine::PositionWrite ( xercesc::DOMElement * element,
const G4String & name,
const G4ThreeVector & pos )
inline

◆ Rotation_vectorWrite()

void G4GDMLWriteDefine::Rotation_vectorWrite ( xercesc::DOMElement * element,
const G4String & tag,
const G4String & name,
const G4ThreeVector & rot )
protected

Definition at line 99 of file G4GDMLWriteDefine.cc.

103{
104 const G4double x = (std::fabs(rot.x()) < kAngularPrecision) ? 0.0 : rot.x();
105 const G4double y = (std::fabs(rot.y()) < kAngularPrecision) ? 0.0 : rot.y();
106 const G4double z = (std::fabs(rot.z()) < kAngularPrecision) ? 0.0 : rot.z();
107
108 xercesc::DOMElement* rotationElement = NewElement(tag);
109 rotationElement->setAttributeNode(NewAttribute("name", name));
110 rotationElement->setAttributeNode(NewAttribute("x", x / degree));
111 rotationElement->setAttributeNode(NewAttribute("y", y / degree));
112 rotationElement->setAttributeNode(NewAttribute("z", z / degree));
113 rotationElement->setAttributeNode(NewAttribute("unit", "deg"));
114 element->appendChild(rotationElement);
115}
double z() const
double x() const
double y() const
static const G4double kAngularPrecision

Referenced by FirstrotationWrite(), and RotationWrite().

◆ RotationWrite()

void G4GDMLWriteDefine::RotationWrite ( xercesc::DOMElement * element,
const G4String & name,
const G4ThreeVector & rot )
inline

◆ Scale_vectorWrite()

void G4GDMLWriteDefine::Scale_vectorWrite ( xercesc::DOMElement * element,
const G4String & tag,
const G4String & name,
const G4ThreeVector & scl )
protected

Definition at line 78 of file G4GDMLWriteDefine.cc.

82{
83 const G4double x =
84 (std::fabs(scl.x() - 1.0) < kRelativePrecision) ? 1.0 : scl.x();
85 const G4double y =
86 (std::fabs(scl.y() - 1.0) < kRelativePrecision) ? 1.0 : scl.y();
87 const G4double z =
88 (std::fabs(scl.z() - 1.0) < kRelativePrecision) ? 1.0 : scl.z();
89
90 xercesc::DOMElement* scaleElement = NewElement(tag);
91 scaleElement->setAttributeNode(NewAttribute("name", name));
92 scaleElement->setAttributeNode(NewAttribute("x", x));
93 scaleElement->setAttributeNode(NewAttribute("y", y));
94 scaleElement->setAttributeNode(NewAttribute("z", z));
95 element->appendChild(scaleElement);
96}
static const G4double kRelativePrecision

Referenced by ScaleWrite().

◆ ScaleWrite()

void G4GDMLWriteDefine::ScaleWrite ( xercesc::DOMElement * element,
const G4String & name,
const G4ThreeVector & scl )
inline

Definition at line 48 of file G4GDMLWriteDefine.hh.

50 {
51 Scale_vectorWrite(element, "scale", name, scl);
52 }
void Scale_vectorWrite(xercesc::DOMElement *, const G4String &, const G4String &, const G4ThreeVector &)

Referenced by G4GDMLWriteStructure::PhysvolWrite(), G4GDMLWriteSolids::ScaledWrite(), and G4GDMLWriteStructure::TraverseVolumeTree().

Member Data Documentation

◆ defineElement

xercesc::DOMElement* G4GDMLWriteDefine::defineElement = nullptr
protected

◆ kAngularPrecision

◆ kLinearPrecision

◆ kRelativePrecision

const G4double G4GDMLWriteDefine::kRelativePrecision = DBL_EPSILON
staticprotected

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