source: trunk/source/persistency/gdml/include/G4GDMLParser.hh @ 1348

Last change on this file since 1348 was 1347, checked in by garnier, 14 years ago

geant4 tag 9.4

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