[818] | 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 | // |
---|
[1228] | 27 | // $Id: G4GDMLParser.hh,v 1.58 2009/04/15 13:29:30 gcosmo Exp $ |
---|
| 28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
[818] | 29 | // |
---|
| 30 | // |
---|
| 31 | // class G4GDMLParser |
---|
| 32 | // |
---|
| 33 | // Class description: |
---|
| 34 | // |
---|
[850] | 35 | // GDML main parser. |
---|
| 36 | |
---|
[818] | 37 | // History: |
---|
| 38 | // - Created. Zoltan Torzsok, November 2007 |
---|
| 39 | // ------------------------------------------------------------------------- |
---|
[850] | 40 | |
---|
[818] | 41 | #ifndef _G4GDMLPARSER_INCLUDED_ |
---|
| 42 | #define _G4GDMLPARSER_INCLUDED_ |
---|
| 43 | |
---|
[850] | 44 | #include "G4GDMLReadStructure.hh" |
---|
| 45 | #include "G4GDMLWriteStructure.hh" |
---|
| 46 | #include "G4STRead.hh" |
---|
[818] | 47 | |
---|
[921] | 48 | #define G4GDML_DEFAULT_SCHEMALOCATION G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd") |
---|
[850] | 49 | |
---|
| 50 | class G4GDMLParser |
---|
| 51 | { |
---|
| 52 | public: // with description |
---|
| 53 | |
---|
[921] | 54 | G4GDMLParser(); |
---|
| 55 | G4GDMLParser(G4GDMLReadStructure*); |
---|
[1228] | 56 | G4GDMLParser(G4GDMLReadStructure*, G4GDMLWriteStructure*); |
---|
[921] | 57 | ~G4GDMLParser(); |
---|
[850] | 58 | // |
---|
[921] | 59 | // Parser constructors & destructor |
---|
[850] | 60 | |
---|
| 61 | inline void Read(const G4String& filename, G4bool Validate=true); |
---|
| 62 | // |
---|
| 63 | // Imports geometry with world-volume, specified by the GDML filename |
---|
| 64 | // in input. Validation against schema is activated by default. |
---|
| 65 | |
---|
| 66 | inline void ReadModule(const G4String& filename, G4bool Validate=true); |
---|
| 67 | // |
---|
| 68 | // Imports a single GDML module, specified by the GDML filename |
---|
| 69 | // in input. Validation against schema is activated by default. |
---|
| 70 | |
---|
| 71 | inline void Write(const G4String& filename, |
---|
| 72 | const G4VPhysicalVolume* const pvol = 0, |
---|
| 73 | G4bool storeReferences = true, |
---|
| 74 | const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION); |
---|
| 75 | // |
---|
| 76 | // Exports on a GDML file, specified by 'filename' a geometry tree |
---|
| 77 | // starting from 'pvol' as top volume. Uniqueness of stored entities |
---|
| 78 | // is guaranteed by storing pointer-references by default. |
---|
| 79 | // Alternative path for the schema location can be specified; by default |
---|
| 80 | // the URL to the GDML web site is used. |
---|
| 81 | |
---|
| 82 | inline G4LogicalVolume* ParseST(const G4String& name, |
---|
| 83 | G4Material* medium, |
---|
| 84 | G4Material* solid); |
---|
| 85 | // |
---|
| 86 | // Imports a tessellated geometry stored as STEP-Tools files |
---|
| 87 | // 'name.geom' and 'name.tree'. It returns a pointer of a generated |
---|
| 88 | // mother volume with 'medium' material associated, including the |
---|
| 89 | // imported tessellated geometry with 'solid' material associated. |
---|
| 90 | |
---|
| 91 | // Methods for Reader |
---|
| 92 | // |
---|
| 93 | inline G4double GetConstant(const G4String& name); |
---|
| 94 | inline G4double GetVariable(const G4String& name); |
---|
| 95 | inline G4double GetQuantity(const G4String& name); |
---|
| 96 | inline G4ThreeVector GetPosition(const G4String& name); |
---|
| 97 | inline G4ThreeVector GetRotation(const G4String& name); |
---|
| 98 | inline G4ThreeVector GetScale(const G4String& name); |
---|
| 99 | inline G4GDMLMatrix GetMatrix(const G4String& name); |
---|
| 100 | inline G4LogicalVolume* GetVolume(const G4String& name); |
---|
| 101 | inline G4VPhysicalVolume* GetWorldVolume(const G4String& setupName="Default"); |
---|
| 102 | inline G4GDMLAuxListType GetVolumeAuxiliaryInformation(const G4LogicalVolume* const logvol); |
---|
[921] | 103 | inline void StripNamePointers() const; |
---|
| 104 | inline void SetOverlapCheck(G4bool); |
---|
[850] | 105 | |
---|
| 106 | // Methods for Writer |
---|
| 107 | // |
---|
| 108 | inline void AddModule(const G4VPhysicalVolume* const physvol); |
---|
| 109 | inline void AddModule(const G4int depth); |
---|
| 110 | inline void SetAddPointerToName(G4bool set); |
---|
| 111 | |
---|
| 112 | private: |
---|
| 113 | |
---|
[921] | 114 | G4GDMLReadStructure* reader; |
---|
| 115 | G4GDMLWriteStructure* writer; |
---|
[1228] | 116 | G4bool urcode, uwcode; |
---|
[850] | 117 | |
---|
[818] | 118 | }; |
---|
| 119 | |
---|
[850] | 120 | #include "G4GDMLParser.icc" |
---|
| 121 | |
---|
[818] | 122 | #endif |
---|