Geant4-11
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
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;
110 inline G4ThreeVector GetScale(const G4String& name) const;
111 inline G4GDMLMatrix GetMatrix(const G4String& name) const;
112 inline G4LogicalVolume* GetVolume(const G4String& name) const;
114 inline G4VPhysicalVolume*
115 GetWorldVolume(const G4String& setupName = "Default") const;
116 inline G4GDMLAuxListType
118 inline const G4GDMLAuxMapType* GetAuxMap() const;
119 inline const G4GDMLAuxListType* GetAuxList() const;
121 inline void StripNamePointers() const;
122 inline void SetStripFlag(G4bool);
126 inline void SetSDExport(G4bool);
128
129 inline G4int GetMaxExportLevel() const; // Manage max number of levels
130 inline void SetMaxExportLevel(G4int); // to export
131
132 inline void Clear(); // Clears the evaluator
133
134 // Methods for Writer
135
136 inline void AddModule(const G4VPhysicalVolume* const physvol);
137 inline void AddModule(const G4int depth);
138 inline void SetAddPointerToName(G4bool set);
140 const G4LogicalVolume* const lvol);
142
143 private:
144
145 void ImportRegions();
146 void ExportRegions(G4bool storeReferences = true);
147
148 private:
149
153 G4GDMLAuxListType *rlist = nullptr, *ullist = nullptr;
155 G4bool urcode = false, uwcode = false, strip = false, rexp = false;
156};
157
158#include "G4GDMLParser.icc"
159
160#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
G4GDMLWriteStructure * writer
G4LogicalVolume * ParseST(const G4String &name, G4Material *medium, G4Material *solid)
void AddVolumeAuxiliary(G4GDMLAuxStructType myaux, const G4LogicalVolume *const lvol)
G4GDMLMessenger * messenger
void StripNamePointers() const
void ImportRegions()
Definition: G4GDMLParser.cc:94
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
G4GDMLAuxListType * rlist
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
void ExportRegions(G4bool storeReferences=true)
G4GDMLReadStructure * reader
G4int GetMaxExportLevel() const
G4GDMLAuxListType * ullist
void SetStripFlag(G4bool)
G4GDMLEvaluator eval
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)
G4VPhysicalVolume * GetPhysVolume(const G4String &name) const
G4GDMLMatrix GetMatrix(const G4String &name) const
G4ThreeVector GetPosition(const G4String &name) const
void SetReverseSearch(G4bool)
void AddModule(const G4int depth)
void AddAuxiliary(G4GDMLAuxStructType myaux)
void SetRegionExport(G4bool)
const char * name(G4int ptype)