BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions
BDSGeometryWriter Class Reference

A class for writing fully constructed geometry from BDSIM out to other formats. More...

#include <BDSGeometryWriter.hh>

Collaboration diagram for BDSGeometryWriter:
Collaboration graph

Public Member Functions

void ExportGeometry (const G4String &geometryType, const G4String &geometryFileName)
 

Static Public Member Functions

static G4String ColourToVRGBAString (G4bool visible, const G4Colour &colour)
 

Static Public Attributes

static const G4String auxType = "bds_vrgba"
 "bds_vrgba" - short to minimise output file size: "bdsim visibility rgba"
 

Private Member Functions

void WriteToGDML (const G4String &outputFileName, G4VPhysicalVolume *volume=nullptr)
 

Static Private Member Functions

static std::map< G4LogicalVolume *, G4GDMLAuxStructType > PrepareColourInformation (G4VPhysicalVolume *volume)
 
static void RegisterVolumeAuxiliaryInformation (G4GDMLParser &parser, const std::map< G4LogicalVolume *, G4GDMLAuxStructType > &volToAuxMap)
 Register the auxiliary information with the GDML parser (writer).
 
static void AddLVColour (std::map< G4LogicalVolume *, G4GDMLAuxStructType > &, G4LogicalVolume *lv)
 

Detailed Description

A class for writing fully constructed geometry from BDSIM out to other formats.

Author
Laurie Nevay

Definition at line 41 of file BDSGeometryWriter.hh.

Constructor & Destructor Documentation

◆ BDSGeometryWriter()

BDSGeometryWriter::BDSGeometryWriter ( )

Definition at line 49 of file BDSGeometryWriter.cc.

◆ ~BDSGeometryWriter()

BDSGeometryWriter::~BDSGeometryWriter ( )

Definition at line 46 of file BDSGeometryWriter.cc.

Member Function Documentation

◆ AddLVColour()

void BDSGeometryWriter::AddLVColour ( std::map< G4LogicalVolume *, G4GDMLAuxStructType > &  map,
G4LogicalVolume *  lv 
)
staticprivate

Recursively add information to the map by reference for each logical volume vis attributes if they exist.

Definition at line 128 of file BDSGeometryWriter.cc.

References AddLVColour(), auxType, and ColourToVRGBAString().

Referenced by AddLVColour(), and PrepareColourInformation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ColourToVRGBAString()

G4String BDSGeometryWriter::ColourToVRGBAString ( G4bool  visible,
const G4Colour &  colour 
)
static

Return a string with the format "int float float float float" for (bool) visible, (double) rgb, and (double) alpha values separated by a space. e.g. "1 0.2 0.4 0.6 1.0"

Definition at line 97 of file BDSGeometryWriter.cc.

Referenced by AddLVColour().

Here is the caller graph for this function:

◆ ExportGeometry()

void BDSGeometryWriter::ExportGeometry ( const G4String &  geometryType,
const G4String &  geometryFileName 
)

Dispatch function that matches the geometry type and uses the appropriate member function to write out the geometry

Definition at line 52 of file BDSGeometryWriter.cc.

References WriteToGDML().

Referenced by BDSIM::Initialise(), and BDSIMLink::Initialise().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrepareColourInformation()

std::map< G4LogicalVolume *, G4GDMLAuxStructType > BDSGeometryWriter::PrepareColourInformation ( G4VPhysicalVolume *  volume)
staticprivate

Generate a map of logical volume pointers to output auxiliary structure information for writing out to GDML.

Definition at line 113 of file BDSGeometryWriter.cc.

References AddLVColour().

Referenced by WriteToGDML().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterVolumeAuxiliaryInformation()

void BDSGeometryWriter::RegisterVolumeAuxiliaryInformation ( G4GDMLParser &  parser,
const std::map< G4LogicalVolume *, G4GDMLAuxStructType > &  volToAuxMap 
)
staticprivate

Register the auxiliary information with the GDML parser (writer).

Definition at line 121 of file BDSGeometryWriter.cc.

Referenced by WriteToGDML().

Here is the caller graph for this function:

◆ WriteToGDML()

void BDSGeometryWriter::WriteToGDML ( const G4String &  outputFileName,
G4VPhysicalVolume *  volume = nullptr 
)
private

Write the geometry to specified output filename. The filename should be the filename ending in .gdml. If the supplied volume is nullptr (default), the world volume will be written out.

Definition at line 68 of file BDSGeometryWriter.cc.

References BDS::DirectoryExists(), BDS::FileExists(), BDS::GetFullPath(), PrepareColourInformation(), RegisterVolumeAuxiliaryInformation(), and BDS::StrContains().

Referenced by ExportGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ auxType

const G4String BDSGeometryWriter::auxType = "bds_vrgba"
static

"bds_vrgba" - short to minimise output file size: "bdsim visibility rgba"

Definition at line 47 of file BDSGeometryWriter.hh.

Referenced by AddLVColour().


The documentation for this class was generated from the following files: