Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
27 // $Id: G4GDMLParser.hh 68053 2013-03-13 14:39:51Z gcosmo $
28 //
29 //
30 // class G4GDMLParser
31 //
32 // Class description:
33 //
34 // GDML main parser.
35 
36 // History:
37 // - Created. Zoltan Torzsok, November 2007
38 // -------------------------------------------------------------------------
39 
40 #ifndef _G4GDMLPARSER_INCLUDED_
41 #define _G4GDMLPARSER_INCLUDED_
42 
43 #include "G4GDMLReadStructure.hh"
44 #include "G4GDMLWriteStructure.hh"
45 #include "G4STRead.hh"
46 #include "G4GDMLMessenger.hh"
47 
49 #include "G4Navigator.hh"
50 
51 
52 #define G4GDML_DEFAULT_SCHEMALOCATION G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd")
53 
55 {
56  public: // with description
57 
58  G4GDMLParser();
61  ~G4GDMLParser();
62  //
63  // Parser constructors & destructor
64 
65  inline void Read(const G4String& filename, G4bool Validate=true);
66  //
67  // Imports geometry with world-volume, specified by the GDML filename
68  // in input. Validation against schema is activated by default.
69 
70  inline void ReadModule(const G4String& filename, G4bool Validate=true);
71  //
72  // Imports a single GDML module, specified by the GDML filename
73  // in input. Validation against schema is activated by default.
74 
75  inline void Write(const G4String& filename,
76  const G4VPhysicalVolume* pvol = 0,
77  G4bool storeReferences = true,
78  const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
79  //
80  // Exports on a GDML file, specified by 'filename' a geometry tree
81  // starting from 'pvol' as top volume. Uniqueness of stored entities
82  // is guaranteed by storing pointer-references by default.
83  // Alternative path for the schema location can be specified; by default
84  // the URL to the GDML web site is used.
85 
86  inline void Write(const G4String& filename,
87  const G4LogicalVolume* lvol,
88  G4bool storeReferences = true,
89  const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
90  //
91  // Exports on a GDML file, specified by 'filename' a geometry tree
92  // starting from 'pvol' as top volume. Uniqueness of stored entities
93  // is guaranteed by storing pointer-references by default.
94  // Alternative path for the schema location can be specified; by default
95  // the URL to the GDML web site is used. Same as method above except
96  // that the logical volume must be provided here.
97 
98  inline G4LogicalVolume* ParseST(const G4String& name,
99  G4Material* medium,
100  G4Material* solid);
101  //
102  // Imports a tessellated geometry stored as STEP-Tools files
103  // 'name.geom' and 'name.tree'. It returns a pointer of a generated
104  // mother volume with 'medium' material associated, including the
105  // imported tessellated geometry with 'solid' material associated.
106 
107  // Methods for Reader
108  //
109  inline G4bool IsValid(const G4String& name) const;
110  inline G4double GetConstant(const G4String& name) const;
111  inline G4double GetVariable(const G4String& name) const;
112  inline G4double GetQuantity(const G4String& name) const;
113  inline G4ThreeVector GetPosition(const G4String& name) const;
114  inline G4ThreeVector GetRotation(const G4String& name) const;
115  inline G4ThreeVector GetScale(const G4String& name) const;
116  inline G4GDMLMatrix GetMatrix(const G4String& name) const;
117  inline G4LogicalVolume* GetVolume(const G4String& name) const;
118  inline G4VPhysicalVolume* GetWorldVolume(const G4String& setupName="Default") const;
120  inline const G4GDMLAuxMapType* GetAuxMap() const;
121  inline void StripNamePointers() const;
122  inline void SetStripFlag(G4bool);
123  inline void SetOverlapCheck(G4bool);
124  inline void Clear(); // Clears the evaluator
125 
126  // Methods for Writer
127  //
128  inline void AddModule(const G4VPhysicalVolume* const physvol);
129  inline void AddModule(const G4int depth);
130  inline void SetAddPointerToName(G4bool set);
131 
132  private:
133 
134  G4GDMLReadStructure* reader;
135  G4GDMLWriteStructure* writer;
136  G4GDMLMessenger* messenger;
137  G4bool urcode, uwcode, strip;
138 
139 };
140 
141 #include "G4GDMLParser.icc"
142 
143 #endif
G4LogicalVolume * GetVolume(const G4String &name) const
G4GDMLAuxListType GetVolumeAuxiliaryInformation(G4LogicalVolume *logvol) const
#define G4GDML_DEFAULT_SCHEMALOCATION
Definition: G4GDMLParser.hh:52
G4double GetVariable(const G4String &name) const
void AddModule(const G4VPhysicalVolume *const physvol)
G4VPhysicalVolume * GetWorldVolume(const G4String &setupName="Default") const
const XML_Char * name
void SetAddPointerToName(G4bool set)
int G4int
Definition: G4Types.hh:78
void SetOverlapCheck(G4bool)
G4double GetConstant(const G4String &name) const
G4bool IsValid(const G4String &name) const
bool G4bool
Definition: G4Types.hh:79
void Write(const G4String &filename, const G4VPhysicalVolume *pvol=0, G4bool storeReferences=true, const G4String &SchemaLocation=G4GDML_DEFAULT_SCHEMALOCATION)
G4LogicalVolume * ParseST(const G4String &name, G4Material *medium, G4Material *solid)
G4ThreeVector GetRotation(const G4String &name) const
G4ThreeVector GetScale(const G4String &name) const
std::vector< G4GDMLAuxPairType > G4GDMLAuxListType
G4GDMLMatrix GetMatrix(const G4String &name) const
const G4GDMLAuxMapType * GetAuxMap() const
void Read(const G4String &filename, G4bool Validate=true)
G4double GetQuantity(const G4String &name) const
void SetStripFlag(G4bool)
void ReadModule(const G4String &filename, G4bool Validate=true)
double G4double
Definition: G4Types.hh:76
std::map< G4LogicalVolume *, G4GDMLAuxListType > G4GDMLAuxMapType
G4ThreeVector GetPosition(const G4String &name) const
void StripNamePointers() const