Geant4 11.2.2
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#ifndef G4GDML_DEFAULT_SCHEMALOCATION
48#define G4GDML_DEFAULT_SCHEMALOCATION \
49 G4String("http://cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd")
50#endif
51
52#ifndef G4GDML_DEFAULT_WRITE_SCHEMALOCATION
53#define G4GDML_DEFAULT_WRITE_SCHEMALOCATION \
54 G4String("http://cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd")
55#endif
56
58{
59 public:
60
65 //
66 // Parser constructors & destructor
67
68 inline void Read(const G4String& filename, G4bool Validate = false);
69 //
70 // Imports geometry with world-volume, specified by the GDML filename
71 // in input. Validation against schema is activated by default.
72 // Schema validation is disabled, as XercesC currently does not support https.
73
74 inline void ReadModule(const G4String& filename, G4bool Validate = false);
75 //
76 // Imports a single GDML module, specified by the GDML filename
77 // in input. Validation against schema is activated by default.
78 // Schema validation is disabled, as XercesC currently does not support https.
79
80 inline void Write( const G4String& filename,
81 const G4VPhysicalVolume* pvol = 0,
82 G4bool storeReferences = true,
83 const G4String& SchemaLocation = G4GDML_DEFAULT_WRITE_SCHEMALOCATION);
84 //
85 // Exports on a GDML file, specified by 'filename' a geometry tree
86 // starting from 'pvol' as top volume. Uniqueness of stored entities
87 // is guaranteed by storing pointer-references by default.
88 // Alternative path for the schema location can be specified; by default
89 // the URL to the GDML web site is used.
90
91 inline void Write( const G4String& filename, const G4LogicalVolume* lvol,
92 G4bool storeReferences = true,
93 const G4String& SchemaLocation = G4GDML_DEFAULT_WRITE_SCHEMALOCATION);
94 //
95 // Exports on a GDML file, specified by 'filename' a geometry tree
96 // starting from 'pvol' as top volume. Uniqueness of stored entities
97 // is guaranteed by storing pointer-references by default.
98 // Alternative path for the schema location can be specified; by default
99 // the URL to the GDML web site is used. Same as method above except
100 // that the logical volume must be provided here.
101
102 inline G4LogicalVolume* ParseST(const G4String& name, G4Material* medium,
103 G4Material* solid);
104 //
105 // Imports a tessellated geometry stored as STEP-Tools files
106 // 'name.geom' and 'name.tree'. It returns a pointer of a generated
107 // mother volume with 'medium' material associated, including the
108 // imported tessellated geometry with 'solid' material associated.
109
110 // Methods for Reader
111
112 inline G4bool IsValid(const G4String& name) const;
113 inline G4double GetConstant(const G4String& name) const;
114 inline G4double GetVariable(const G4String& name) const;
115 inline G4double GetQuantity(const G4String& name) const;
116 inline G4ThreeVector GetPosition(const G4String& name) const;
117 inline G4ThreeVector GetRotation(const G4String& name) const;
118 inline G4ThreeVector GetScale(const G4String& name) const;
119 inline G4GDMLMatrix GetMatrix(const G4String& name) const;
120 inline G4LogicalVolume* GetVolume(const G4String& name) const;
121 inline G4VPhysicalVolume* GetPhysVolume(const G4String& name) const;
122 inline G4VPhysicalVolume*
123 GetWorldVolume(const G4String& setupName = "Default") const;
124 inline G4GDMLAuxListType
126 inline const G4GDMLAuxMapType* GetAuxMap() const;
127 inline const G4GDMLAuxListType* GetAuxList() const;
129 inline void StripNamePointers() const;
130 inline void SetStripFlag(G4bool);
134 inline void SetSDExport(G4bool);
136 inline void SetImportSchema(const G4String& path_and_filename);
137
138 inline G4int GetMaxExportLevel() const; // Manage max number of levels
139 inline void SetMaxExportLevel(G4int); // to export
140
141 inline void Clear(); // Clears the evaluator
142
143 // Methods for Writer
144
145 inline void AddModule(const G4VPhysicalVolume* const physvol);
146 inline void AddModule(const G4int depth);
147 inline void SetAddPointerToName(G4bool set);
149 const G4LogicalVolume* const lvol);
151
152 private:
153
154 void ImportRegions();
155 void ExportRegions(G4bool storeReferences = true);
156
157 private:
158
159 G4GDMLEvaluator eval;
160 G4GDMLReadStructure* reader = nullptr;
161 G4GDMLWriteStructure* writer = nullptr;
162 G4GDMLAuxListType *rlist = nullptr, *ullist = nullptr;
163 G4GDMLMessenger* messenger = nullptr;
164 G4bool urcode = false, uwcode = false, strip = false, rexp = false;
165};
166
167#include "G4GDMLParser.icc"
168
169#endif
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
#define G4GDML_DEFAULT_WRITE_SCHEMALOCATION
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 ReadModule(const G4String &filename, G4bool Validate=false)
void AddModule(const G4VPhysicalVolume *const physvol)
void SetOverlapCheck(G4bool)
G4VPhysicalVolume * GetWorldVolume(const G4String &setupName="Default") const
G4LogicalVolume * GetVolume(const G4String &name) const
const G4GDMLAuxListType * GetAuxList() const
G4ThreeVector GetScale(const G4String &name) const
void SetSDExport(G4bool)
G4bool IsValid(const G4String &name) const
void SetEnergyCutsExport(G4bool)
G4ThreeVector GetRotation(const G4String &name) const
G4double GetConstant(const G4String &name) const
G4double GetQuantity(const G4String &name) const
void Read(const G4String &filename, G4bool Validate=false)
void SetImportSchema(const G4String &path_and_filename)
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_WRITE_SCHEMALOCATION)
void SetOutputFileOverwrite(G4bool flag)
void SetMaxExportLevel(G4int)
G4VPhysicalVolume * GetPhysVolume(const G4String &name) const
G4GDMLMatrix GetMatrix(const G4String &name) const
G4ThreeVector GetPosition(const G4String &name) const
void Write(const G4String &filename, const G4LogicalVolume *lvol, G4bool storeReferences=true, const G4String &SchemaLocation=G4GDML_DEFAULT_WRITE_SCHEMALOCATION)
void SetReverseSearch(G4bool)
void AddModule(const G4int depth)
void AddAuxiliary(G4GDMLAuxStructType myaux)
void SetRegionExport(G4bool)