BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSGeometryWriter.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2024.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef BDSGEOMETRYWRITER_H
20#define BDSGEOMETRYWRITER_H
21
22#include "globals.hh" // geant4 types / globals
23#include "G4VisAttributes.hh"
24#include "G4String.hh"
25
26#include <map>
27
28class G4Colour;
29class G4GDMLParser;
30class G4LogicalVolume;
31class G4VPhysicalVolume;
32struct G4GDMLAuxStructType;
33
42{
43public:
46
47 const static G4String auxType;
48
51 void ExportGeometry(const G4String& geometryType,
52 const G4String& geometryFileName);
53
57 static G4String ColourToVRGBAString(G4bool visible,
58 const G4Colour& colour);
59
60private:
61#ifdef USE_GDML
65 void WriteToGDML(const G4String& outputFileName, G4VPhysicalVolume* volume = nullptr);
66
69 static std::map<G4LogicalVolume*, G4GDMLAuxStructType> PrepareColourInformation(G4VPhysicalVolume* volume);
70
72 static void RegisterVolumeAuxiliaryInformation(G4GDMLParser& parser,
73 const std::map<G4LogicalVolume*, G4GDMLAuxStructType>& volToAuxMap);
74
77 static void AddLVColour(std::map<G4LogicalVolume*, G4GDMLAuxStructType>&, G4LogicalVolume* lv);
78#endif
79};
80
81#endif
A class for writing fully constructed geometry from BDSIM out to other formats.
void WriteToGDML(const G4String &outputFileName, G4VPhysicalVolume *volume=nullptr)
static std::map< G4LogicalVolume *, G4GDMLAuxStructType > PrepareColourInformation(G4VPhysicalVolume *volume)
static const G4String auxType
"bds_vrgba" - short to minimise output file size: "bdsim visibility rgba"
static void AddLVColour(std::map< G4LogicalVolume *, G4GDMLAuxStructType > &, G4LogicalVolume *lv)
static G4String ColourToVRGBAString(G4bool visible, const G4Colour &colour)
static void RegisterVolumeAuxiliaryInformation(G4GDMLParser &parser, const std::map< G4LogicalVolume *, G4GDMLAuxStructType > &volToAuxMap)
Register the auxiliary information with the GDML parser (writer).
void ExportGeometry(const G4String &geometryType, const G4String &geometryFileName)