Geant4  10.03
G4GDMLParser.icc
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.icc 96673 2016-04-29 12:08:20Z gcosmo $
28 //
29 //
30 // class G4GDMLParser inline methods
31 //
32 // -------------------------------------------------------------------------
33 
34 inline
35 void G4GDMLParser::Read(const G4String& filename, G4bool validate)
36 {
37  reader->Read(filename,validate,false,strip);
38  ImportRegions();
39 }
40 
41 inline
42 void G4GDMLParser::ReadModule(const G4String& filename, G4bool validate)
43 {
44  reader->Read(filename,validate,true);
45  ImportRegions();
46 }
47 
48 inline
49 void G4GDMLParser::Write(const G4String& filename,
50  const G4VPhysicalVolume* pvol,
51  G4bool refs,
52  const G4String& schemaLocation)
53 {
54  const G4int depth = 0;
55  G4LogicalVolume* lvol = 0;
56 
57  if (!pvol)
58  {
59  lvol = G4TransportationManager::GetTransportationManager()->
60  GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume();
61  }
62  else
63  {
64  lvol = pvol->GetLogicalVolume();
65  }
66 
67  if (rexp) { ExportRegions(refs); }
68  writer->Write(filename,lvol,schemaLocation,depth,refs);
69 }
70 
71 inline
72 void G4GDMLParser::Write(const G4String& filename,
73  const G4LogicalVolume* lvol,
74  G4bool refs,
75  const G4String& schemaLocation)
76 {
77  const G4int depth = 0;
78 
79  if (!lvol)
80  {
81  lvol = G4TransportationManager::GetTransportationManager()->
82  GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume();
83  }
84  if (rexp) { ExportRegions(refs); }
85  writer->Write(filename,lvol,schemaLocation,depth,refs);
86 }
87 
88 inline
89 G4LogicalVolume* G4GDMLParser::ParseST(const G4String& filename,
90  G4Material* medium,
91  G4Material* solid)
92 {
93  G4STRead STreader;
94  return STreader.Read(filename, medium, solid);
95 }
96 
97 //
98 // Methods for Reader
99 //
100 
101 inline G4bool G4GDMLParser::IsValid(const G4String& name) const
102 {
103  return reader->IsValidID(name);
104 }
105 
106 inline
107 G4double G4GDMLParser::GetConstant(const G4String& name) const
108 {
109  return reader->GetConstant(name);
110 }
111 
112 inline
113 G4double G4GDMLParser::GetVariable(const G4String& name) const
114 {
115  return reader->GetVariable(name);
116 }
117 
118 inline
119 G4double G4GDMLParser::GetQuantity(const G4String& name) const
120 {
121  return reader->GetQuantity(name);
122 }
123 
124 inline
125 G4ThreeVector G4GDMLParser::GetPosition(const G4String& name) const
126 {
127  return reader->GetPosition(name);
128 }
129 
130 inline
131 G4ThreeVector G4GDMLParser::GetRotation(const G4String& name) const
132 {
133  return reader->GetRotation(name);
134 }
135 
136 inline
137 G4ThreeVector G4GDMLParser::GetScale(const G4String& name) const
138 {
139  return reader->GetScale(name);
140 }
141 
142 inline
143 G4GDMLMatrix G4GDMLParser::GetMatrix(const G4String& name) const
144 {
145  return reader->GetMatrix(name);
146 }
147 
148 inline
149 G4LogicalVolume* G4GDMLParser::GetVolume(const G4String& name) const
150 {
151  return reader->GetVolume(name);
152 }
153 
154 inline G4VPhysicalVolume*
155 G4GDMLParser::GetWorldVolume(const G4String& setupName) const
156 {
157  return reader->GetWorldVolume(setupName);
158 }
159 
160 inline
161 G4GDMLAuxListType
162 G4GDMLParser::GetVolumeAuxiliaryInformation(G4LogicalVolume* logvol) const
163 {
164  return reader->GetVolumeAuxiliaryInformation(logvol);
165 }
166 
167 inline
168 const G4GDMLAuxMapType* G4GDMLParser::GetAuxMap() const
169 {
170  return reader->GetAuxMap();
171 }
172 
173 inline
174 const G4GDMLAuxListType* G4GDMLParser::GetAuxList() const
175 {
176  return reader->GetAuxList();
177 }
178 
179 inline
180 void G4GDMLParser::AddAuxiliary(G4GDMLAuxStructType myaux)
181 {
182  return writer->AddAuxiliary(myaux);
183 }
184 
185 inline
186 void G4GDMLParser::StripNamePointers() const
187 {
188  reader->StripNames();
189 }
190 
191 inline void G4GDMLParser::SetStripFlag(G4bool flag)
192 {
193  strip = flag;
194 }
195 
196 inline void G4GDMLParser::SetOverlapCheck(G4bool flag)
197 {
198  reader->OverlapCheck(flag);
199 }
200 
201 inline void G4GDMLParser::SetRegionExport(G4bool flag)
202 {
203  rexp = flag;
204 }
205 
206 inline void G4GDMLParser::SetEnergyCutsExport(G4bool flag)
207 {
208  writer->SetEnergyCutsExport(flag);
209 }
210 
211 inline void G4GDMLParser::SetSDExport(G4bool flag)
212 {
213  writer->SetSDExport(flag);
214 }
215 
216 inline void G4GDMLParser::Clear()
217 {
218  reader->Clear();
219 }
220 
221 //
222 // Methods for Writer
223 //
224 
225 inline
226 void G4GDMLParser::AddModule(const G4VPhysicalVolume* const physvol)
227 {
228  writer->AddModule(physvol);
229 }
230 
231 inline
232 void G4GDMLParser::AddModule(const G4int depth)
233 {
234  writer->AddModule(depth);
235 }
236 
237 inline
238 void G4GDMLParser::SetAddPointerToName(G4bool set)
239 {
240  writer->SetAddPointerToName(set);
241 }
242 
243 inline
244 void G4GDMLParser::AddVolumeAuxiliary(G4GDMLAuxStructType myaux,
245  const G4LogicalVolume* const lvol)
246 {
247  writer->AddVolumeAuxiliary(myaux, lvol);
248 }