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

Functions

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 is_visible=true)
 
DerivedPtr AddBoolean (const BuilderView &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)
 

Detailed Description

These all return the builder for fluent interface.

Function Documentation

◆ AddBoolean()

template<typename U >
VolumeBuilder< U >::DerivedPtr AddBoolean ( const BuilderView other,
bool  is_subtraction = false,
bool  is_intersection = false,
const Unit3Vec offset = {CLHEP::mm, 0, 0, 0},
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 VolumeReferencePtr
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 282 of file VolumeBuilder.hpp.

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

◆ ForceSolid() [1/2]

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

◆ ForceSolid() [2/2]

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

Definition at line 436 of file VolumeBuilder.hpp.

436 {
437 lv_configs_->force_solid = x;
438 ApplyAttributes_();
439 return this->shared_from_this();
440 }

◆ SetAlpha() [1/2]

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

◆ SetAlpha() [2/2]

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

Definition at line 422 of file VolumeBuilder.hpp.

422 {
423 lv_configs_->color.SetAlpha(alpha);
424 ApplyAttributes_();
425 return this->shared_from_this();
426 }

◆ SetColor() [1/4]

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

◆ SetColor() [2/4]

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

Definition at line 429 of file VolumeBuilder.hpp.

429 {
430 lv_configs_->color = color;
431 ApplyAttributes_();
432 return this->shared_from_this();
433 }

◆ 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 >
VolumeBuilder< 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 415 of file VolumeBuilder.hpp.

415 {
416 lv_configs_->color = G4Colour(r, g, b, alpha);
417 ApplyAttributes_();
418 return this->shared_from_this();
419 }

◆ SetMaterial() [1/2]

template<typename U >
DerivedPtr SetMaterial ( G4Material *  material)

/**

Parameters
material
Returns
The builder

◆ SetMaterial() [2/2]

template<typename U >
VolumeBuilder< U >::DerivedPtr SetMaterial ( G4Material *  material)

/**

Parameters
material
Returns
The builder

Definition at line 409 of file VolumeBuilder.hpp.

409 {
410 lv_configs_->material = material;
411 return this->shared_from_this();
412 }

◆ SetVisibility() [1/2]

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

◆ SetVisibility() [2/2]

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

Definition at line 443 of file VolumeBuilder.hpp.

443 {
444 lv_configs_->is_visible = x;
445 ApplyAttributes_();
446 return this->shared_from_this();
447 }