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) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef BDSGEOMETRYWRITER_H
19#define BDSGEOMETRYWRITER_H
20
21#include "globals.hh" // geant4 types / globals
22#include "G4VisAttributes.hh"
23#include "G4String.hh"
24
25#include <map>
26
27class G4Colour;
28class G4GDMLParser;
29class G4LogicalVolume;
30class G4VPhysicalVolume;
31struct G4GDMLAuxStructType;
32
41{
42public:
45
46 const static G4String auxType;
47
50 void ExportGeometry(const G4String& geometryType,
51 const G4String& geometryFileName);
52
56 static G4String ColourToVRGBAString(G4bool visible,
57 const G4Colour& colour);
58
59private:
60#ifdef USE_GDML
64 void WriteToGDML(const G4String& outputFileName, G4VPhysicalVolume* volume = nullptr);
65
68 static std::map<G4LogicalVolume*, G4GDMLAuxStructType> PrepareColourInformation(G4VPhysicalVolume* volume);
69
71 static void RegisterVolumeAuxiliaryInformation(G4GDMLParser& parser,
72 const std::map<G4LogicalVolume*, G4GDMLAuxStructType>& volToAuxMap);
73
76 static void AddLVColour(std::map<G4LogicalVolume*, G4GDMLAuxStructType>&, G4LogicalVolume* lv);
77#endif
78};
79
80#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)