Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // G4GDMLParser inline methods 27 // 28 // Author: Zoltan Torzsok, November 2007 29 // ------------------------------------------- 30 31 inline void G4GDMLParser::Read(const G4String& 32 { 33 if(G4Threading::IsMasterThread()) 34 { 35 reader->Read(filename, validate, false, st 36 ImportRegions(); 37 } 38 } 39 40 // ------------------------------------------- 41 inline void G4GDMLParser::ReadModule(const G4S 42 { 43 if(G4Threading::IsMasterThread()) 44 { 45 reader->Read(filename, validate, true); 46 ImportRegions(); 47 } 48 } 49 50 // ------------------------------------------- 51 inline void G4GDMLParser::Write(const G4String 52 const G4VPhysi 53 const G4String 54 { 55 if(G4Threading::IsMasterThread()) 56 { 57 const G4int depth = 0; 58 G4LogicalVolume* lvol = nullptr; 59 60 if(pvol == nullptr) 61 { 62 lvol = G4TransportationManager::GetTrans 63 ->GetNavigatorForTracking() 64 ->GetWorldVolume() 65 ->GetLogicalVolume(); 66 } 67 else 68 { 69 lvol = pvol->GetLogicalVolume(); 70 } 71 72 if(rexp) 73 { 74 ExportRegions(refs); 75 } 76 writer->Write(filename, lvol, schemaLocati 77 } 78 } 79 80 // ------------------------------------------- 81 inline void G4GDMLParser::Write(const G4String 82 const G4Logica 83 const G4String 84 { 85 if(G4Threading::IsMasterThread()) 86 { 87 const G4int depth = 0; 88 89 if(lvol == nullptr) 90 { 91 lvol = G4TransportationManager::GetTrans 92 ->GetNavigatorForTracking() 93 ->GetWorldVolume() 94 ->GetLogicalVolume(); 95 } 96 if(rexp) 97 { 98 ExportRegions(refs); 99 } 100 writer->Write(filename, lvol, schemaLocati 101 } 102 } 103 104 // ------------------------------------------- 105 inline G4LogicalVolume* G4GDMLParser::ParseST( 106 107 108 { 109 if(G4Threading::IsMasterThread()) 110 { 111 G4STRead STreader; 112 return STreader.Read(filename, medium, sol 113 } 114 else 115 { 116 return nullptr; 117 } 118 } 119 120 // ------------------------------------------- 121 // Methods for Reader 122 // ------------------------------------------- 123 124 inline G4bool G4GDMLParser::IsValid(const G4St 125 { 126 return reader->IsValidID(name); 127 } 128 129 inline G4double G4GDMLParser::GetConstant(cons 130 { 131 return reader->GetConstant(name); 132 } 133 134 inline G4double G4GDMLParser::GetVariable(cons 135 { 136 return reader->GetVariable(name); 137 } 138 139 inline G4double G4GDMLParser::GetQuantity(cons 140 { 141 return reader->GetQuantity(name); 142 } 143 144 inline G4ThreeVector G4GDMLParser::GetPosition 145 { 146 return reader->GetPosition(name); 147 } 148 149 inline G4ThreeVector G4GDMLParser::GetRotation 150 { 151 return reader->GetRotation(name); 152 } 153 154 inline G4ThreeVector G4GDMLParser::GetScale(co 155 { 156 return reader->GetScale(name); 157 } 158 159 inline G4GDMLMatrix G4GDMLParser::GetMatrix(co 160 { 161 return reader->GetMatrix(name); 162 } 163 164 inline G4LogicalVolume* G4GDMLParser::GetVolum 165 { 166 return reader->GetVolume(name); 167 } 168 169 inline G4VPhysicalVolume* 170 G4GDMLParser::GetPhysVolume(const G4String& na 171 { 172 return reader->GetPhysvol(name); 173 } 174 175 inline G4VPhysicalVolume* 176 G4GDMLParser::GetWorldVolume(const G4String& s 177 { 178 return reader->GetWorldVolume(setupName); 179 } 180 181 inline G4GDMLAuxListType 182 G4GDMLParser::GetVolumeAuxiliaryInformation(G4 183 { 184 return reader->GetVolumeAuxiliaryInformation 185 } 186 187 inline const G4GDMLAuxMapType* G4GDMLParser::G 188 { 189 return reader->GetAuxMap(); 190 } 191 192 inline const G4GDMLAuxListType* G4GDMLParser:: 193 { 194 return reader->GetAuxList(); 195 } 196 197 inline void G4GDMLParser::AddAuxiliary(G4GDMLA 198 { 199 return writer->AddAuxiliary(myaux); 200 } 201 202 inline void G4GDMLParser::StripNamePointers() 203 { 204 reader->StripNames(); 205 } 206 207 inline void G4GDMLParser::SetStripFlag(G4bool 208 { 209 strip = flag; 210 } 211 212 inline void G4GDMLParser::SetOverlapCheck(G4bo 213 { 214 reader->OverlapCheck(flag); 215 } 216 217 inline void G4GDMLParser::SetRegionExport(G4bo 218 { 219 rexp = flag; 220 } 221 222 inline void G4GDMLParser::SetEnergyCutsExport( 223 { 224 writer->SetEnergyCutsExport(flag); 225 } 226 227 inline void G4GDMLParser::SetSDExport(G4bool f 228 { 229 writer->SetSDExport(flag); 230 } 231 232 inline void G4GDMLParser::SetReverseSearch(G4b 233 { 234 reader->SetReverseSearch(flag); 235 } 236 237 inline G4int G4GDMLParser::GetMaxExportLevel() 238 { 239 return writer->GetMaxExportLevel(); 240 } 241 242 inline void G4GDMLParser::SetMaxExportLevel(G4 243 { 244 writer->SetMaxExportLevel(level); 245 } 246 247 inline void G4GDMLParser::Clear() 248 { 249 reader->Clear(); 250 } 251 252 inline void G4GDMLParser::SetImportSchema(cons 253 { 254 reader->SetSchemaFile(path_and_filename); 255 } 256 257 // ------------------------------------------- 258 // Methods for Writer 259 // ------------------------------------------- 260 261 inline void G4GDMLParser::AddModule(const G4VP 262 { 263 writer->AddModule(physvol); 264 } 265 266 inline void G4GDMLParser::AddModule(const G4in 267 { 268 writer->AddModule(depth); 269 } 270 271 inline void G4GDMLParser::SetAddPointerToName( 272 { 273 writer->SetAddPointerToName(set); 274 } 275 276 inline void G4GDMLParser::AddVolumeAuxiliary(G 277 c 278 { 279 writer->AddVolumeAuxiliary(myaux, lvol); 280 } 281 282 inline void G4GDMLParser::SetOutputFileOverwri 283 { 284 writer->SetOutputFileOverwrite(flag); 285 } 286