Changeset 850 for trunk/source/persistency/gdml/include
- Timestamp:
- Sep 10, 2008, 5:40:37 PM (16 years ago)
- Location:
- trunk/source/persistency/gdml/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/persistency/gdml/include/G4GDMLEvaluator.hh
r818 r850 25 25 // 26 26 // 27 // $Id: G4GDMLEvaluator.hh,v 1.1 0 2007/11/28 10:27:18 ztorzsokExp $28 // GEANT4 tag $Name: geant4-09-01-patch-02$27 // $Id: G4GDMLEvaluator.hh,v 1.16 2008/07/16 15:46:33 gcosmo Exp $ 28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // … … 43 43 44 44 #include <CLHEP/Evaluator/Evaluator.h> 45 #include <vector> 45 46 46 #include "G4Types.hh" 47 #include "G4String.hh" 48 #include "G4Box.hh" 47 #include "globals.hh" 49 48 50 class G4GDMLEvaluator { 49 class G4GDMLEvaluator 50 { 51 52 public: 53 54 G4GDMLEvaluator(); 55 56 void DefineConstant(const G4String&, G4double); 57 void DefineVariable(const G4String&, G4double); 58 void DefineMatrix(const G4String&, G4int, std::vector<G4double>); 59 void SetVariable(const G4String&, G4double); 60 G4bool IsVariable(const G4String&) const; 61 G4String SolveBrackets(const G4String&); 62 G4double Evaluate(const G4String&); 63 G4int EvaluateInteger(const G4String&); 64 G4double GetConstant(const G4String&); 65 G4double GetVariable(const G4String&); 66 67 private: 68 51 69 HepTool::Evaluator eval; 52 70 std::vector<G4String> variableList; 53 public:54 G4GDMLEvaluator();55 56 void defineConstant(const G4String&,G4double);57 void defineVariable(const G4String&,G4double);58 void setVariable(const G4String&,G4double);59 void checkVariable(const G4String&);60 61 G4double Evaluate(const G4String&);62 G4int EvaluateInteger(const G4String&);63 71 }; 64 72 -
trunk/source/persistency/gdml/include/G4GDMLParser.hh
r818 r850 25 25 // 26 26 // 27 // $Id: G4GDMLParser.hh,v 1. 10 2007/11/30 11:58:46 ztorzsokExp $28 // GEANT4 tag $Name: geant4-09-01-patch-02$27 // $Id: G4GDMLParser.hh,v 1.53 2008/08/21 12:17:09 gcosmo Exp $ 28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // … … 33 33 // Class description: 34 34 // 35 // GDML main parser. 36 35 37 // History: 36 38 // - Created. Zoltan Torzsok, November 2007 37 39 // ------------------------------------------------------------------------- 38 40 39 41 #ifndef _G4GDMLPARSER_INCLUDED_ 40 42 #define _G4GDMLPARSER_INCLUDED_ 41 43 42 #include "G4GDMLStructure.hh" 44 #include "G4GDMLReadStructure.hh" 45 #include "G4GDMLWriteStructure.hh" 46 #include "G4STRead.hh" 43 47 44 class G4GDMLParser { 45 G4GDMLStructure structure; 46 public: 47 void Read(const G4String& fileName) { structure.Parse(fileName); } 48 G4VPhysicalVolume* GetWorldVolume(const G4String& setupName="Default") { return structure.getTopVolume(setupName); } 48 #define G4GDML_DEFAULT_SCHEMALOCATION G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/GDML_2_10_0/src/GDMLSchema/gdml.xsd") 49 50 class G4GDMLParser 51 { 52 public: // with description 53 54 G4GDMLParser() { xercesc::XMLPlatformUtils::Initialize(); } 55 ~G4GDMLParser() { xercesc::XMLPlatformUtils::Terminate(); } 56 // 57 // Parser constructor & destructor 58 59 inline void Read(const G4String& filename, G4bool Validate=true); 60 // 61 // Imports geometry with world-volume, specified by the GDML filename 62 // in input. Validation against schema is activated by default. 63 64 inline void ReadModule(const G4String& filename, G4bool Validate=true); 65 // 66 // Imports a single GDML module, specified by the GDML filename 67 // in input. Validation against schema is activated by default. 68 69 inline void Write(const G4String& filename, 70 const G4VPhysicalVolume* const pvol = 0, 71 G4bool storeReferences = true, 72 const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION); 73 // 74 // Exports on a GDML file, specified by 'filename' a geometry tree 75 // starting from 'pvol' as top volume. Uniqueness of stored entities 76 // is guaranteed by storing pointer-references by default. 77 // Alternative path for the schema location can be specified; by default 78 // the URL to the GDML web site is used. 79 80 inline G4LogicalVolume* ParseST(const G4String& name, 81 G4Material* medium, 82 G4Material* solid); 83 // 84 // Imports a tessellated geometry stored as STEP-Tools files 85 // 'name.geom' and 'name.tree'. It returns a pointer of a generated 86 // mother volume with 'medium' material associated, including the 87 // imported tessellated geometry with 'solid' material associated. 88 89 // Methods for Reader 90 // 91 inline G4double GetConstant(const G4String& name); 92 inline G4double GetVariable(const G4String& name); 93 inline G4double GetQuantity(const G4String& name); 94 inline G4ThreeVector GetPosition(const G4String& name); 95 inline G4ThreeVector GetRotation(const G4String& name); 96 inline G4ThreeVector GetScale(const G4String& name); 97 inline G4GDMLMatrix GetMatrix(const G4String& name); 98 inline G4LogicalVolume* GetVolume(const G4String& name); 99 inline G4VPhysicalVolume* GetWorldVolume(const G4String& setupName="Default"); 100 inline G4GDMLAuxListType GetVolumeAuxiliaryInformation(const G4LogicalVolume* const logvol); 101 102 // Methods for Writer 103 // 104 inline void AddModule(const G4VPhysicalVolume* const physvol); 105 inline void AddModule(const G4int depth); 106 inline void SetAddPointerToName(G4bool set); 107 108 private: 109 110 G4GDMLReadStructure reader; 111 G4GDMLWriteStructure writer; 112 49 113 }; 50 114 115 #include "G4GDMLParser.icc" 116 51 117 #endif
Note: See TracChangeset
for help on using the changeset viewer.