Celeritas
0.5.0-86+4a8eea4
|
Helper class for managing volume and material labels. More...
#include <Label.hh>
Public Member Functions | |
Label ()=default | |
Create an empty label. | |
Label (char const *cstr) | |
Create implicitly from a C string (mostly for testing) | |
Label (std::string &&n) | |
Create implicitly from just a string name (capture) | |
Label (std::string const &n) | |
Create implicitly from just a string name (copy) | |
Label (std::string n, std::string e) | |
Create from a name and label. | |
bool | empty () const |
Whether both the label and extension are empty. | |
Static Public Member Functions | |
static Label | from_geant (std::string const &name) |
Construct a label from a Geant4 pointer-appended name. | |
static Label | from_separator (std::string const &name, char sep=default_sep) |
Construct a label from by splitting on a separator. | |
Public Attributes | |
std::string | name |
Primary readable label component. | |
std::string | ext |
Uniquifying component: pointer address or ID. | |
Static Public Attributes | |
static constexpr char | default_sep = '@' |
Default separator for output and splitting. | |
Helper class for managing volume and material labels.
This class is needed because names in Geant4/VecGeom can be non-unique. The only way to map between duplicate volume names between VecGeom and Geant4 is to ensure that pointers are written on output (and not cleared on input), and to use those as an "extension" to differentiate the duplicate volumes.
Materials likewise can have duplicate names (perhaps because some have different range cutoffs, etc.), so this class can be used to return a range of IDs that match a single material name.