|
DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
|
Public Member Functions | |
| G4VPhysicalVolume * | GetPlacement () final |
| DerivedPtr | MakePlacement () |
| DerivedPtr | PlaceAndFork () |
| G4LogicalVolume * | GetLogicalVolume () final |
| G4VSolid * | GetBaseSolid () final |
| G4VSolid * | GetFinalSolid () final |
| DerivedPtr | MakeLogicalVolume (G4Material *material=nullptr, G4String name=std::string()) |
| DerivedPtr | MakeSolid () |
| DerivedPtr | SetName (const G4String &name) |
| DerivedPtr | AddUnion (const VolumeBuilder &other, const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}, G4RotationMatrix *rotation=nullptr) |
| DerivedPtr | AddSubtraction (const VolumeBuilder &other, const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}, G4RotationMatrix *rotation=nullptr) |
| DerivedPtr | AddIntersection (const VolumeBuilder &other, const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}, G4RotationMatrix *rotation=nullptr) |
| DerivedPtr | AddBoolean (const VolumeBuilder &other, bool is_subtraction=false, bool is_intersection=false, const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}, G4RotationMatrix *rotation=nullptr) |
| DerivedPtr | SetMaterial (G4Material *material) |
| DerivedPtr | SetColor (double r=0.5, double g=0.5, double b=0.5, double alpha=1.0) |
| DerivedPtr | SetColor (const G4Colour &color) |
| DerivedPtr | SetAlpha (G4double alpha) |
| DerivedPtr | ForceSolid (bool x=true) |
| DerivedPtr | SetVisibility (bool x=true) |
| DerivedPtr | SetLogicalVolume (G4LogicalVolume *logical_volume) |
| DerivedPtr | SetBooleanName (const G4String &name) |
| DerivedPtr | SetPhysRotation (const G4RotationMatrix &rot) |
| DerivedPtr | StackPhysRotation (const G4RotationMatrix &stacked_rot) |
| DerivedPtr | SetPhysOffset (const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}) |
| DerivedPtr | StackPhysOffset (const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}) |
| DerivedPtr | SetPhysTransform (const UnitlessG4Transform3D &new_transform) |
| DerivedPtr | StackPhysTransform (const UnitlessG4Transform3D &new_transform) |
| G4Transform3D | GetPhysTransform () const final |
| DerivedPtr | OverridePlacementName (const G4String &pName) |
| DerivedPtr | SetCopyNo (G4int pCopyNo) |
| DerivedPtr | SetSurfaceCheck (G4bool pSurfChk) |
| DerivedPtr | SetMother (const VolumeBuilder &mother) |
| DerivedPtr | SetAutoPlacementNaming (bool set) |
| DerivedPtr | SetAutoCopyNo (bool set) |
| DerivedPtr | ReflectZFinalSolid () |
| DerivedPtr | ReflectZBaseSolid () |
| DerivedPtr | ForkAndReset (const G4String &new_name) const |
| DerivedPtr | ForkForFinalSolid (const G4String &new_name) |
| DerivedPtr | ForkForLogicalVolume (const G4String &new_name) |
| DerivedPtr | ForkForPlacement (std::optional< int > copy_no=std::nullopt, const G4String &name_override="", bool parent_name_was_set=false) |
| DerivedPtr | CopyPlacementConfigsFrom (const VolumeBuilder &other) |
| DerivedPtr | CopyVolumeConfigsFrom (const VolumeBuilder &other) |
| DerivedPtr | SetDefaultUnit (G4double unit) |
| G4double | GetEffectiveDefaultUnit () const |
| DerivedPtr | AddTo (BuilderViewList &list) const |
| DerivedPtr | AddTo (StructureViewList &list) const |
| DerivedPtr | AddTo (Assembly &assembly) const |
| ~VolumeBuilderBase () override | |
| G4String | GetBuilderName () const |
| template<typename U > | |
| VolumeBuilderBase (const VolumeBuilderBase< U > &other) | |
| template<typename T , std::enable_if_t< std::is_base_of_v< IStructureBuilder, T >, int > > | |
| VolumeBuilderBase (const SharedPtr< T > &other, std::true_type) | |
| std::shared_ptr< T > | shared_from_this () |
| std::shared_ptr< const T > | shared_from_this () const |
| void | set_shared_from_this_enabled (bool enabled) |
Protected Member Functions | |
| G4VSolid * | SolidConstructor (const G4String &name) override=0 |
| SharedPtr< IStructureBuilder > | clone_impl () const override |
Protected Attributes | |
| std::atomic< bool > | is_enabled_ {true} |
Friends | |
| template<typename > | |
| class | VolumeBuilderBase |
| class | VolumeBuilderCore |
| class | AssemblyCore |
| template<typename > | |
| class | StructureBuilderBase |
| class | StructureBuilderCore |
| class | RZBuilderCore |
| class | BoxBuilderCore |
| class | FromG4VSolidCore |
| FromG4VSolid | VB::CreateFromG4VSolid (G4VSolid *solid) |
| Assembly | VB::CreateAssembly (G4String names) |
VolumeBuilder: Common functionality for volume builder classes.
Includes material and attribute setting, and union/subtraction methods. This is Not a user class. Only usable through inheritance to extend class functionality. Return most things by pointer to the derived class So we can chain operations (fluent interface).
| U | CRTP paramter for the derived class. |
Definition at line 60 of file VolumeBuilderBase.hh.
|
override |
Destructor Normally does not delete volume objects.
Geant takes care of that.
Definition at line 114 of file VolumeBuilderBase.hpp.
| VolumeBuilderBase | ( | const VolumeBuilderBase< U > & | other | ) |
Definition at line 83 of file VolumeBuilderBase.hpp.
| VolumeBuilderBase | ( | const SharedPtr< T > & | other, |
| std::true_type | |||
| ) |
Definition at line 100 of file VolumeBuilderBase.hpp.
| VolumeBuilderBase< U >::DerivedPtr AddTo | ( | BuilderViewList & | list | ) | const |
Definition at line 1005 of file VolumeBuilderBase.hpp.
|
overrideprotectedvirtual |
Implements IStructureBuilder.
Reimplemented in VolumeBuilderCore.
Definition at line 997 of file VolumeBuilderBase.hpp.
| G4String GetBuilderName | ( | ) | const |
Definition at line 973 of file VolumeBuilderBase.hpp.
| VolumeBuilderBase< U >::DerivedPtr MakeLogicalVolume | ( | G4Material * | material = nullptr, |
| G4String | name = std::string() |
||
| ) |
Basically never needed now.
Builds the logical volume and returns the builder. GetLogicalVolume(), or passing the builder to any consumer will trigger the build anyway.
| material | Pointer to material to use. |
| name | Optional explicit name for logical volume. Normally already derived from builder/solid name. |
Definition at line 129 of file VolumeBuilderBase.hpp.
| VolumeBuilderBase< U >::DerivedPtr MakePlacement | ( | ) |
Make a placed physical volume.
Retrieve it or make and retrieve with GetPlacement() Fails (throws) if already built. Make a copy first.
Definition at line 463 of file VolumeBuilderBase.hpp.
| VolumeBuilderBase< U >::DerivedPtr MakeSolid | ( | ) |
Make the G4VSolid.
Returns the builder. Use GetBaseSolid() to retrieve or make and retrieve it.
Definition at line 938 of file VolumeBuilderBase.hpp.
|
inlineinherited |
Definition at line 60 of file disableable_shared_from_this.hh.
| VolumeBuilderBase< U >::DerivedPtr SetName | ( | const G4String & | name | ) |
SetName Sets name used for solid and derived product names.
| name | The name |
Definition at line 403 of file VolumeBuilderBase.hpp.
|
inlineinherited |
Definition at line 44 of file disableable_shared_from_this.hh.
|
inlineinherited |
Definition at line 52 of file disableable_shared_from_this.hh.
|
overrideprotectedpure virtual |
polymorphic access to solid construction
Implements IStructureBuilder.
Implemented in BoxBuilderCore, RZBuilderCore, and VolumeBuilderCore.
| VolumeBuilderBase< U >::DerivedPtr StackPhysOffset | ( | const Unit3Vec & | offset = {CLHEP::mm, 0, 0, 0} | ) |
Like SetPhysOffset but stacks with previous transformations in order applied.
Unlike with G4Transform multiplication, stacking is done in a way that allows mutiple objects to move together. The first transformations can set individual objects, and a uniform transformation can be applied to them all to create a rigid motion of the collection.
| offset |
Definition at line 570 of file VolumeBuilderBase.hpp.
| VolumeBuilderBase< U >::DerivedPtr StackPhysRotation | ( | const G4RotationMatrix & | stacked_rot | ) |
Like SetPhysRotation but stacks with previous transformations in order applied.
Unlike with G4Transform multiplication, stacking is done in a way that allows mutiple objects to move together. The first transformations can set individual objects, and a uniform transformation can be applied to them all to create a rigid motion of the collection.
| stacked_rot |
Definition at line 546 of file VolumeBuilderBase.hpp.
| VolumeBuilderBase< U >::DerivedPtr StackPhysTransform | ( | const UnitlessG4Transform3D & | new_transform | ) |
Like SetPhysTransform but stacks with previous transformations in order applied.
| new_transform |
Definition at line 586 of file VolumeBuilderBase.hpp.
|
friend |
Definition at line 72 of file VolumeBuilderBase.hh.
|
friend |
Definition at line 79 of file VolumeBuilderBase.hh.
|
friend |
Definition at line 80 of file VolumeBuilderBase.hh.
|
friend |
Definition at line 78 of file VolumeBuilderBase.hh.
Definition at line 74 of file VolumeBuilderBase.hh.
|
friend |
A type-erased (data shared view) view of a builder or assembly, ie a "structure.".
Can hold other structures, creating placement hierarchies. Behaves like a buidler, but only for logical volume properties and placement related commands. You can set VisAtt on a structure, and can set offsets and rotations of the whole structure for placement.
While this base view only supports limited methods, it is fully polymorphic and builder objects internally can trigger their full build chain.
This derived clas really exists for parallelism with VolumeBuilderCore.
Definition at line 75 of file VolumeBuilderBase.hh.
|
friend |
|
friend |
Definition at line 70 of file VolumeBuilderBase.hh.
|
friend |
A polymorphic, type-erased "view" of any specialized builder.
Use it to assign a specialized builder to a generic builder. But you don't use it directly. It has no direct public ctors or factories, but BuilderView(your_other_builder_object) constructs it as i_shared_ptr<VolumeBuilderCore> ( pointer-wrapped builder). Or pass your builder to something expecting a BuilderView, like ex: a std::vector<BuilderViewr>, aka a BuilderViewList.
Definition at line 71 of file VolumeBuilderBase.hh.
|
protectedinherited |
Definition at line 37 of file disableable_shared_from_this.hh.