// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // G4GDMLParser inline methods // // Author: Zoltan Torzsok, November 2007 // -------------------------------------------------------------------- inline void G4GDMLParser::Read(const G4String& filename, G4bool validate) { if(G4Threading::IsMasterThread()) { reader->Read(filename, validate, false, strip); ImportRegions(); } } // -------------------------------------------------------------------- inline void G4GDMLParser::ReadModule(const G4String& filename, G4bool validate) { if(G4Threading::IsMasterThread()) { reader->Read(filename, validate, true); ImportRegions(); } } // -------------------------------------------------------------------- inline void G4GDMLParser::Write(const G4String& filename, const G4VPhysicalVolume* pvol, G4bool refs, const G4String& schemaLocation) { if(G4Threading::IsMasterThread()) { const G4int depth = 0; G4LogicalVolume* lvol = nullptr; if(pvol == nullptr) { lvol = G4TransportationManager::GetTransportationManager() ->GetNavigatorForTracking() ->GetWorldVolume() ->GetLogicalVolume(); } else { lvol = pvol->GetLogicalVolume(); } if(rexp) { ExportRegions(refs); } writer->Write(filename, lvol, schemaLocation, depth, refs); } } // -------------------------------------------------------------------- inline void G4GDMLParser::Write(const G4String& filename, const G4LogicalVolume* lvol, G4bool refs, const G4String& schemaLocation) { if(G4Threading::IsMasterThread()) { const G4int depth = 0; if(lvol == nullptr) { lvol = G4TransportationManager::GetTransportationManager() ->GetNavigatorForTracking() ->GetWorldVolume() ->GetLogicalVolume(); } if(rexp) { ExportRegions(refs); } writer->Write(filename, lvol, schemaLocation, depth, refs); } } // -------------------------------------------------------------------- inline G4LogicalVolume* G4GDMLParser::ParseST(const G4String& filename, G4Material* medium, G4Material* solid) { if(G4Threading::IsMasterThread()) { G4STRead STreader; return STreader.Read(filename, medium, solid); } else { return nullptr; } } // -------------------------------------------------------------------- // Methods for Reader // -------------------------------------------------------------------- inline G4bool G4GDMLParser::IsValid(const G4String& name) const { return reader->IsValidID(name); } inline G4double G4GDMLParser::GetConstant(const G4String& name) const { return reader->GetConstant(name); } inline G4double G4GDMLParser::GetVariable(const G4String& name) const { return reader->GetVariable(name); } inline G4double G4GDMLParser::GetQuantity(const G4String& name) const { return reader->GetQuantity(name); } inline G4ThreeVector G4GDMLParser::GetPosition(const G4String& name) const { return reader->GetPosition(name); } inline G4ThreeVector G4GDMLParser::GetRotation(const G4String& name) const { return reader->GetRotation(name); } inline G4ThreeVector G4GDMLParser::GetScale(const G4String& name) const { return reader->GetScale(name); } inline G4GDMLMatrix G4GDMLParser::GetMatrix(const G4String& name) const { return reader->GetMatrix(name); } inline G4LogicalVolume* G4GDMLParser::GetVolume(const G4String& name) const { return reader->GetVolume(name); } inline G4VPhysicalVolume* G4GDMLParser::GetPhysVolume(const G4String& name) const { return reader->GetPhysvol(name); } inline G4VPhysicalVolume* G4GDMLParser::GetWorldVolume(const G4String& setupName) const { return reader->GetWorldVolume(setupName); } inline G4GDMLAuxListType G4GDMLParser::GetVolumeAuxiliaryInformation(G4LogicalVolume* logvol) const { return reader->GetVolumeAuxiliaryInformation(logvol); } inline const G4GDMLAuxMapType* G4GDMLParser::GetAuxMap() const { return reader->GetAuxMap(); } inline const G4GDMLAuxListType* G4GDMLParser::GetAuxList() const { return reader->GetAuxList(); } inline void G4GDMLParser::AddAuxiliary(G4GDMLAuxStructType myaux) { return writer->AddAuxiliary(myaux); } inline void G4GDMLParser::StripNamePointers() const { reader->StripNames(); } inline void G4GDMLParser::SetStripFlag(G4bool flag) { strip = flag; } inline void G4GDMLParser::SetOverlapCheck(G4bool flag) { reader->OverlapCheck(flag); } inline void G4GDMLParser::SetRegionExport(G4bool flag) { rexp = flag; } inline void G4GDMLParser::SetEnergyCutsExport(G4bool flag) { writer->SetEnergyCutsExport(flag); } inline void G4GDMLParser::SetSDExport(G4bool flag) { writer->SetSDExport(flag); } inline void G4GDMLParser::SetReverseSearch(G4bool flag) { reader->SetReverseSearch(flag); } inline G4int G4GDMLParser::GetMaxExportLevel() const { return writer->GetMaxExportLevel(); } inline void G4GDMLParser::SetMaxExportLevel(G4int level) { writer->SetMaxExportLevel(level); } inline void G4GDMLParser::Clear() { reader->Clear(); } inline void G4GDMLParser::SetImportSchema(const G4String& path_and_filename) { reader->SetSchemaFile(path_and_filename); } // -------------------------------------------------------------------- // Methods for Writer // -------------------------------------------------------------------- inline void G4GDMLParser::AddModule(const G4VPhysicalVolume* const physvol) { writer->AddModule(physvol); } inline void G4GDMLParser::AddModule(const G4int depth) { writer->AddModule(depth); } inline void G4GDMLParser::SetAddPointerToName(G4bool set) { writer->SetAddPointerToName(set); } inline void G4GDMLParser::AddVolumeAuxiliary(G4GDMLAuxStructType myaux, const G4LogicalVolume* const lvol) { writer->AddVolumeAuxiliary(myaux, lvol); } inline void G4GDMLParser::SetOutputFileOverwrite(G4bool flag) { writer->SetOutputFileOverwrite(flag); }