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.icc,v 1.8 2009/01/22 11:02:07 gcosmo Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // class G4GDMLParser inline methods |
---|
32 | // |
---|
33 | // ------------------------------------------------------------------------- |
---|
34 | |
---|
35 | inline |
---|
36 | void G4GDMLParser::Read(const G4String& filename, G4bool validate) |
---|
37 | { |
---|
38 | reader->Read(filename,validate,false); |
---|
39 | } |
---|
40 | |
---|
41 | inline |
---|
42 | void G4GDMLParser::ReadModule(const G4String& filename, G4bool validate) |
---|
43 | { |
---|
44 | reader->Read(filename,validate,true); |
---|
45 | } |
---|
46 | |
---|
47 | inline |
---|
48 | void G4GDMLParser::Write(const G4String& filename, |
---|
49 | const G4VPhysicalVolume* const pvol, |
---|
50 | G4bool refs, |
---|
51 | const G4String& schemaLocation) |
---|
52 | { |
---|
53 | const G4int depth = 0; |
---|
54 | G4LogicalVolume* lvol = 0; |
---|
55 | |
---|
56 | if (!pvol) |
---|
57 | { |
---|
58 | G4VPhysicalVolume* worldPV = GetWorldVolume(); |
---|
59 | if (!worldPV) |
---|
60 | { |
---|
61 | G4Exception("G4DMLParser::Write()", "InvalidSetup", FatalException, |
---|
62 | "Detector-Construction needs to be registered first!"); |
---|
63 | } |
---|
64 | lvol = worldPV->GetLogicalVolume(); |
---|
65 | } |
---|
66 | else |
---|
67 | { |
---|
68 | lvol = pvol->GetLogicalVolume(); |
---|
69 | } |
---|
70 | writer->Write(filename,lvol,schemaLocation,depth,refs); |
---|
71 | } |
---|
72 | |
---|
73 | inline |
---|
74 | G4LogicalVolume* G4GDMLParser::ParseST(const G4String& filename, |
---|
75 | G4Material* medium, |
---|
76 | G4Material* solid) |
---|
77 | { |
---|
78 | G4STRead reader; |
---|
79 | return reader.Read(filename, medium, solid); |
---|
80 | } |
---|
81 | |
---|
82 | // |
---|
83 | // Methods for Reader |
---|
84 | // |
---|
85 | |
---|
86 | inline |
---|
87 | G4double G4GDMLParser::GetConstant(const G4String& name) |
---|
88 | { |
---|
89 | return reader->GetConstant(name); |
---|
90 | } |
---|
91 | |
---|
92 | inline |
---|
93 | G4double G4GDMLParser::GetVariable(const G4String& name) |
---|
94 | { |
---|
95 | return reader->GetVariable(name); |
---|
96 | } |
---|
97 | |
---|
98 | inline |
---|
99 | G4double G4GDMLParser::GetQuantity(const G4String& name) |
---|
100 | { |
---|
101 | return reader->GetQuantity(name); |
---|
102 | } |
---|
103 | |
---|
104 | inline |
---|
105 | G4ThreeVector G4GDMLParser::GetPosition(const G4String& name) |
---|
106 | { |
---|
107 | return reader->GetPosition(name); |
---|
108 | } |
---|
109 | |
---|
110 | inline |
---|
111 | G4ThreeVector G4GDMLParser::GetRotation(const G4String& name) |
---|
112 | { |
---|
113 | return reader->GetRotation(name); |
---|
114 | } |
---|
115 | |
---|
116 | inline |
---|
117 | G4ThreeVector G4GDMLParser::GetScale(const G4String& name) |
---|
118 | { |
---|
119 | return reader->GetScale(name); |
---|
120 | } |
---|
121 | |
---|
122 | inline |
---|
123 | G4GDMLMatrix G4GDMLParser::GetMatrix(const G4String& name) |
---|
124 | { |
---|
125 | return reader->GetMatrix(name); |
---|
126 | } |
---|
127 | |
---|
128 | inline |
---|
129 | G4LogicalVolume* G4GDMLParser::GetVolume(const G4String& name) |
---|
130 | { |
---|
131 | return reader->GetVolume(name); |
---|
132 | } |
---|
133 | |
---|
134 | inline |
---|
135 | G4VPhysicalVolume* G4GDMLParser::GetWorldVolume(const G4String& setupName) |
---|
136 | { |
---|
137 | return reader->GetWorldVolume(setupName); |
---|
138 | } |
---|
139 | |
---|
140 | inline |
---|
141 | G4GDMLAuxListType |
---|
142 | G4GDMLParser::GetVolumeAuxiliaryInformation(const G4LogicalVolume* const logvol) |
---|
143 | { |
---|
144 | return reader->GetVolumeAuxiliaryInformation(logvol); |
---|
145 | } |
---|
146 | |
---|
147 | inline |
---|
148 | void G4GDMLParser::StripNamePointers() const |
---|
149 | { |
---|
150 | reader->StripNames(); |
---|
151 | } |
---|
152 | |
---|
153 | inline void G4GDMLParser::SetOverlapCheck(G4bool flag) |
---|
154 | { |
---|
155 | reader->OverlapCheck(flag); |
---|
156 | } |
---|
157 | |
---|
158 | // |
---|
159 | // Methods for Writer |
---|
160 | // |
---|
161 | |
---|
162 | inline |
---|
163 | void G4GDMLParser::AddModule(const G4VPhysicalVolume* const physvol) |
---|
164 | { |
---|
165 | writer->AddModule(physvol); |
---|
166 | } |
---|
167 | |
---|
168 | inline |
---|
169 | void G4GDMLParser::AddModule(const G4int depth) |
---|
170 | { |
---|
171 | writer->AddModule(depth); |
---|
172 | } |
---|
173 | |
---|
174 | inline |
---|
175 | void G4GDMLParser::SetAddPointerToName(G4bool set) |
---|
176 | { |
---|
177 | writer->SetAddPointerToName(set); |
---|
178 | } |
---|