DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
Loading...
Searching...
No Matches
Functions
Logical Volume Configuration Methods.

Functions

DerivedPtr SetMaterial (const VBHelpers::G4MaterialPtrOrString &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 is_visible=true)
 
DerivedPtr AddBoolean (const VolumeBuilder &other, bool is_subtraction=false, bool is_intersection=false, const DLG4::VolumeBuilders::ThreeVecDimensioner &offset={0, 0, 0, VB::Length::mm}, G4RotationMatrix *rotation=nullptr)
 
DerivedPtr SetMaterial (const VBHelpers::G4MaterialPtrOrString &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)
 

Detailed Description

These all return the builder for fluent interface.

Function Documentation

◆ AddBoolean()

template<typename U >
VolumeBuilderBase< U >::DerivedPtr AddBoolean ( const VolumeBuilder other,
bool  is_subtraction = false,
bool  is_intersection = false,
const DLG4::VolumeBuilders::ThreeVecDimensioner offset = {0, 0, 0, VB::Length::mm},
G4RotationMatrix *  rotation = nullptr 
)

Add a boolean operation.

This does NOT immediately trigger a build on a passed-in builder, just pre-sets the relationship.

Parameters
otherA VolumeBuilder, G4VSolid, or anything constructable by a BuilderView
is_subtractiontrue for subtraction, false for union
is_intersectiontrue for intersection, false for union
offsetOffset applied to solid
rotationApplied to solid
Returns
The builder

Definition at line 279 of file VolumeBuilderBase.hpp.

280 {
281 auto offset = ProvisionUnits(new_offset);
282
283 if (other) {
284 boolean_configs_->booleans.emplace_back(
285 BooleanSolid{other, is_subtraction, is_intersection, offset, rotation});
286 } else {
287 throw std::runtime_error("Error in AddBoolean() "
288 "for builder named: \"" + builder_configs_->name + "\"\n"
289 " volume is invalid (null)");
290 }
291 return this->shared_from_this();
292 }

◆ ForceSolid() [1/2]

template<typename U >
DerivedPtr ForceSolid ( bool  x = true)
Returns
The builder

◆ ForceSolid() [2/2]

template<typename U >
VolumeBuilderBase< U >::DerivedPtr ForceSolid ( bool  x = true)
Returns
The builder

Definition at line 433 of file VolumeBuilderBase.hpp.

433 {
434 lv_configs_->force_solid = x;
435 ApplyAttributes_();
436 return this->shared_from_this();
437 }

◆ SetAlpha() [1/2]

template<typename U >
DerivedPtr SetAlpha ( G4double  alpha)
Parameters
alpha
Returns
The builder

◆ SetAlpha() [2/2]

template<typename U >
VolumeBuilderBase< U >::DerivedPtr SetAlpha ( G4double  alpha)
Parameters
alpha
Returns
The builder

Definition at line 419 of file VolumeBuilderBase.hpp.

419 {
420 lv_configs_->color.SetAlpha(alpha);
421 ApplyAttributes_();
422 return this->shared_from_this();
423 }

◆ SetColor() [1/4]

template<typename U >
DerivedPtr SetColor ( const G4Colour &  color)
Parameters
color
Returns
The builder

◆ SetColor() [2/4]

template<typename U >
VolumeBuilderBase< U >::DerivedPtr SetColor ( const G4Colour &  color)
Parameters
color
Returns
The builder

Definition at line 426 of file VolumeBuilderBase.hpp.

426 {
427 lv_configs_->color = color;
428 ApplyAttributes_();
429 return this->shared_from_this();
430 }

◆ SetColor() [3/4]

template<typename U >
DerivedPtr SetColor ( double  r = 0.5,
double  g = 0.5,
double  b = 0.5,
double  alpha = 1.0 
)
Returns
The builder

◆ SetColor() [4/4]

template<typename U >
VolumeBuilderBase< U >::DerivedPtr SetColor ( double  r = 0.5,
double  g = 0.5,
double  b = 0.5,
double  alpha = 1.0 
)
Returns
The builder

Definition at line 412 of file VolumeBuilderBase.hpp.

412 {
413 lv_configs_->color = G4Colour(r, g, b, alpha);
414 ApplyAttributes_();
415 return this->shared_from_this();
416 }

◆ SetMaterial() [1/2]

template<typename U >
DerivedPtr SetMaterial ( const VBHelpers::G4MaterialPtrOrString material)

/**

Parameters
materialG4Material* or string for local or NIST material
Returns
The builder

◆ SetMaterial() [2/2]

template<typename U >
VolumeBuilderBase< U >::DerivedPtr SetMaterial ( const VBHelpers::G4MaterialPtrOrString material)

/**

Parameters
materialG4Material* OR a string name of a local or NIST material!
Returns
The builder

Definition at line 406 of file VolumeBuilderBase.hpp.

406 {
407 lv_configs_->material = material;
408 return this->shared_from_this();
409 }

◆ SetVisibility() [1/2]

template<typename U >
DerivedPtr SetVisibility ( bool  is_visible = true)
Parameters
is_visible
Returns
The builder

◆ SetVisibility() [2/2]

template<typename U >
VolumeBuilderBase< U >::DerivedPtr SetVisibility ( bool  x = true)
Parameters
x
Returns
The builder

Definition at line 440 of file VolumeBuilderBase.hpp.

440 {
441 lv_configs_->is_visible = x;
442 ApplyAttributes_();
443 return this->shared_from_this();
444 }