20#include "BDSException.hh"
21#include "BDSGeometryWriter.hh"
22#include "BDSUtilities.hh"
26#include "G4GDMLParser.hh"
28#include "G4FileUtilities.hh"
30#include "G4TransportationManager.hh"
32class G4VPhysicalVolume;
34BDSGeometryWriter::~BDSGeometryWriter()
37BDSGeometryWriter::BDSGeometryWriter()
41 G4String geometryFileName)
43 if (geometryType ==
"gdml")
48 throw BDSException(__METHOD_NAME__,
"Unable to write out " + geometryFileName +
", as compiled without GDML support");
55 G4VPhysicalVolume* volume)
58 {volume = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();}
62 G4FileUtilities fileUtilities;
63 G4cout <<
"Removing existing file: \"" << outputFileName <<
"\"" << G4endl;
64 fileUtilities.DeleteFile(outputFileName,
"");
73 {
throw BDSException(__METHOD_NAME__,
"directory \"" + dirName +
"\" does not exist - please create it first.");}
77 parser.Write(outputFileName, volume,
true);
General exception with possible name of object and message.
void WriteToGDML(G4String outputFileName, G4VPhysicalVolume *volume=nullptr)
void ExportGeometry(G4String geometryType, G4String geometryFileName)
G4bool StrContains(const G4String &str, const G4String &test)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
G4String GetFullPath(G4String filename, bool excludeNameFromPath=false, bool useCWDForPrefix=false)
G4bool DirectoryExists(const G4String &path)
Check if directory exists.
G4bool FileExists(const G4String &filename)
Checks if filename exists.