Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GDMLParser.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// G4GDMLParser
27//
28// Class description:
29//
30// GDML main parser.
31
32// Author: Zoltan Torzsok, November 2007
33// --------------------------------------------------------------------
34#ifndef G4GDMLPARSER_HH
35#define G4GDMLPARSER_HH 1
36
39#include "G4STRead.hh"
40#include "G4GDMLMessenger.hh"
41#include "G4GDMLEvaluator.hh"
42
44#include "G4Navigator.hh"
45#include "G4Threading.hh"
46
47#define G4GDML_DEFAULT_SCHEMALOCATION \
48 G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/" \
49 "schema/gdml.xsd")
50
52{
53 public:
54
59 //
60 // Parser constructors & destructor
61
62 inline void Read(const G4String& filename, G4bool Validate = true);
63 //
64 // Imports geometry with world-volume, specified by the GDML filename
65 // in input. Validation against schema is activated by default.
66
67 inline void ReadModule(const G4String& filename, G4bool Validate = true);
68 //
69 // Imports a single GDML module, specified by the GDML filename
70 // in input. Validation against schema is activated by default.
71
72 inline void Write( const G4String& filename,
73 const G4VPhysicalVolume* pvol = 0,
74 G4bool storeReferences = true,
75 const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
76 //
77 // Exports on a GDML file, specified by 'filename' a geometry tree
78 // starting from 'pvol' as top volume. Uniqueness of stored entities
79 // is guaranteed by storing pointer-references by default.
80 // Alternative path for the schema location can be specified; by default
81 // the URL to the GDML web site is used.
82
83 inline void Write( const G4String& filename, const G4LogicalVolume* lvol,
84 G4bool storeReferences = true,
85 const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
86 //
87 // Exports on a GDML file, specified by 'filename' a geometry tree
88 // starting from 'pvol' as top volume. Uniqueness of stored entities
89 // is guaranteed by storing pointer-references by default.
90 // Alternative path for the schema location can be specified; by default
91 // the URL to the GDML web site is used. Same as method above except
92 // that the logical volume must be provided here.
93
94 inline G4LogicalVolume* ParseST(const G4String& name, G4Material* medium,
95 G4Material* solid);
96 //
97 // Imports a tessellated geometry stored as STEP-Tools files
98 // 'name.geom' and 'name.tree'. It returns a pointer of a generated
99 // mother volume with 'medium' material associated, including the
100 // imported tessellated geometry with 'solid' material associated.
101
102 // Methods for Reader
103
104 inline G4bool IsValid(const G4String& name) const;
105 inline G4double GetConstant(const G4String& name) const;
106 inline G4double GetVariable(const G4String& name) const;
107 inline G4double GetQuantity(const G4String& name) const;
108 inline G4ThreeVector GetPosition(const G4String& name) const;
109 inline G4ThreeVector GetRotation(const G4String& name) const;
110 inline G4ThreeVector GetScale(const G4String& name) const;
111 inline G4GDMLMatrix GetMatrix(const G4String& name) const;
112 inline G4LogicalVolume* GetVolume(const G4String& name) const;
113 inline G4VPhysicalVolume*
114 GetWorldVolume(const G4String& setupName = "Default") const;
115 inline G4GDMLAuxListType
117 inline const G4GDMLAuxMapType* GetAuxMap() const;
118 inline const G4GDMLAuxListType* GetAuxList() const;
120 inline void StripNamePointers() const;
121 inline void SetStripFlag(G4bool);
125 inline void SetSDExport(G4bool);
126
127 inline G4int GetMaxExportLevel() const; // Manage max number of levels
128 inline void SetMaxExportLevel(G4int); // to export
129
130 inline void Clear(); // Clears the evaluator
131
132 // Methods for Writer
133
134 inline void AddModule(const G4VPhysicalVolume* const physvol);
135 inline void AddModule(const G4int depth);
136 inline void SetAddPointerToName(G4bool set);
138 const G4LogicalVolume* const lvol);
140
141 private:
142
143 void ImportRegions();
144 void ExportRegions(G4bool storeReferences = true);
145
146 private:
147
148 G4GDMLEvaluator eval;
149 G4GDMLReadStructure* reader = nullptr;
150 G4GDMLWriteStructure* writer = nullptr;
151 G4GDMLAuxListType *rlist = nullptr, *ullist = nullptr;
152 G4GDMLMessenger* messenger = nullptr;
153 G4bool urcode = false, uwcode = false, strip = false, rexp = false;
154};
155
156#include "G4GDMLParser.icc"
157
158#endif
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
#define G4GDML_DEFAULT_SCHEMALOCATION
Definition: G4GDMLParser.hh:47
std::map< G4LogicalVolume *, G4GDMLAuxListType > G4GDMLAuxMapType
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4LogicalVolume * ParseST(const G4String &name, G4Material *medium, G4Material *solid)
void AddVolumeAuxiliary(G4GDMLAuxStructType myaux, const G4LogicalVolume *const lvol)
void StripNamePointers() const
G4GDMLAuxListType GetVolumeAuxiliaryInformation(G4LogicalVolume *lvol) const
void AddModule(const G4VPhysicalVolume *const physvol)
void SetOverlapCheck(G4bool)
G4VPhysicalVolume * GetWorldVolume(const G4String &setupName="Default") const
G4LogicalVolume * GetVolume(const G4String &name) const
void Read(const G4String &filename, G4bool Validate=true)
const G4GDMLAuxListType * GetAuxList() const
G4ThreeVector GetScale(const G4String &name) const
void SetSDExport(G4bool)
void Write(const G4String &filename, const G4LogicalVolume *lvol, G4bool storeReferences=true, const G4String &SchemaLocation=G4GDML_DEFAULT_SCHEMALOCATION)
G4bool IsValid(const G4String &name) const
void SetEnergyCutsExport(G4bool)
G4ThreeVector GetRotation(const G4String &name) const
G4double GetConstant(const G4String &name) const
void ReadModule(const G4String &filename, G4bool Validate=true)
G4double GetQuantity(const G4String &name) const
G4int GetMaxExportLevel() const
void SetStripFlag(G4bool)
G4double GetVariable(const G4String &name) const
void SetAddPointerToName(G4bool set)
const G4GDMLAuxMapType * GetAuxMap() const
void Write(const G4String &filename, const G4VPhysicalVolume *pvol=0, G4bool storeReferences=true, const G4String &SchemaLocation=G4GDML_DEFAULT_SCHEMALOCATION)
void SetOutputFileOverwrite(G4bool flag)
void SetMaxExportLevel(G4int)
G4GDMLMatrix GetMatrix(const G4String &name) const
G4ThreeVector GetPosition(const G4String &name) const
void AddModule(const G4int depth)
void AddAuxiliary(G4GDMLAuxStructType myaux)
void SetRegionExport(G4bool)