ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::homogeneous_material_factory< detector_t > Class Template Referencefinal

Factory class for homogeneous material. More...

#include <detray/builders/homogeneous_material_factory.hpp>

Inheritance diagram for detray::homogeneous_material_factory< detector_t >:
[legend]
Collaboration diagram for detray::homogeneous_material_factory< detector_t >:
[legend]

Public Types

using scalar_type = dscalar<typename detector_t::algebra_type>
 Scalar type used by the detector's material definitions.
Public Types inherited from detray::surface_factory_interface< detector_t >
using navigation_link = typename detector_t::surface_type::navigation_link
 Navigation link type used by surfaces produced by the factory.

Public Member Functions

 homogeneous_material_factory (std::unique_ptr< surface_factory_interface< detector_t > > sf_factory=std::make_unique< placeholder_factory_t >())
 Factory with surfaces potentially already filled or empty placeholder that will not be used.
void add_material (material_id id, material_data< scalar_type > &&mat_data, std::size_t index=detail::invalid_value< std::size_t >())
 Add all necessary components to the factory for a single material slab or rod (determined by the id).
void add_material (material_id id, std::vector< material_data< scalar_type > > &&mat_data_vec)
 Add all necessary components to the factory for multiple material slabs or rods (determined by the id).
auto clear () -> void override
 Clear old data.
auto links () const -> const std::vector< material_id > &
auto materials () const -> const std::vector< material< scalar_type > > &
auto n_materials () const -> dindex
auto operator() (typename detector_t::surface_lookup_container &surfaces, typename detector_t::material_container &materials)
 Add material to the containers of a volume builder.
auto operator() (typename detector_t::volume_type &volume, typename detector_t::surface_lookup_container &surfaces, typename detector_t::transform_container &transforms, typename detector_t::mask_container &masks, typename detector_t::geometry_context ctx={}) -> dindex_range override
auto thickness () const -> const std::vector< scalar_type > &
Public Member Functions inherited from detray::factory_decorator< detector_t >
 factory_decorator (std::unique_ptr< surface_factory_interface< detector_t > > factory)
 Wrap a concrete surface factory and forward interface calls to it.
const surface_factory_interface< detector_t > * get_factory () const
dindex size () const override
 Overwrite interface functions using callbacks to the base factory.
void push_back (surface_data< detector_t > &&data) override
 Add data to the factory.
void push_back (std::vector< surface_data< detector_t > > &&data) override
 Forward a batch of surface records to the wrapped factory.
void clear () override
 Clear all data in the factory.
Public Member Functions inherited from detray::surface_factory_interface< detector_t >

Additional Inherited Members

Protected Member Functions inherited from detray::factory_decorator< detector_t >
surface_factory_interface< detector_t > * get_factory ()
Protected Member Functions inherited from detray::surface_factory_interface< detector_t >
template<typename container_t, typename... Args>
dindex insert_in_container (container_t &cont, const typename container_t::value_type value, const dindex idx, Args &&...args) const
 Insert a value in a container at a specific index.

Detailed Description

template<concepts::detector detector_t>
class detray::homogeneous_material_factory< detector_t >

Factory class for homogeneous material.

Uses a surface factory underneath the hood that handles the surface construction. The material ID from the detector determines the type of material that will be produced. The factory is filled from [a vector] of material_data .

Template Parameters
detector_ttype of detector that contains the material

Constructor & Destructor Documentation

◆ homogeneous_material_factory()

template<concepts::detector detector_t>
detray::homogeneous_material_factory< detector_t >::homogeneous_material_factory ( std::unique_ptr< surface_factory_interface< detector_t > > sf_factory = std::make_unique<placeholder_factory_t>())
explicit

Factory with surfaces potentially already filled or empty placeholder that will not be used.

Parameters
sf_factoryUnderlying surface factory to decorate.

Member Function Documentation

◆ add_material() [1/2]

template<concepts::detector detector_t>
void detray::homogeneous_material_factory< detector_t >::add_material ( material_id id,
material_data< scalar_type > && mat_data,
std::size_t index = detail::invalid_value<std::size_t>() )

Add all necessary components to the factory for a single material slab or rod (determined by the id).

Parameters
idMaterial collection to receive the value.
mat_dataOne material and its surface association.
indexOptional index in the material collection.

◆ add_material() [2/2]

template<concepts::detector detector_t>
void detray::homogeneous_material_factory< detector_t >::add_material ( material_id id,
std::vector< material_data< scalar_type > > && mat_data_vec )

Add all necessary components to the factory for multiple material slabs or rods (determined by the id).

Parameters
idMaterial collection to receive the values.
mat_data_vecMaterial records to append.

◆ links()

template<concepts::detector detector_t>
auto detray::homogeneous_material_factory< detector_t >::links ( ) const->conststd::vector< material_id > &
Returns
the material links to the surfaces (counted for this volume)

◆ materials()

template<concepts::detector detector_t>
auto detray::homogeneous_material_factory< detector_t >::materials ( ) const->conststd::vector< material< scalar_type > > &
Returns
the raw materials that are currently in the factory

◆ n_materials()

template<concepts::detector detector_t>
auto detray::homogeneous_material_factory< detector_t >::n_materials ( ) const->dindex
Returns
the number of material instances that will be built by the factory

◆ operator()() [1/2]

template<concepts::detector detector_t>
auto detray::homogeneous_material_factory< detector_t >::operator() ( typename detector_t::surface_lookup_container & surfaces,
typename detector_t::material_container & materials )

Add material to the containers of a volume builder.

This assumes that the surfaces have already been added (e.g. by this factories underlying surface factory). The material from this factory is added to the corresponding number of surfaces at the end of the calling volume builder.

Note
This does not override the pure virtual function from the surface factory interface, but presents an overload for the case when material should be added.
Parameters
surfacessurface container of the volume builder that should get decorated with material.
materialsmaterial store of the volume builder that the new materials get added to.
Returns
No value; surfaces and material storage are updated in place.

◆ operator()() [2/2]

template<concepts::detector detector_t>
auto detray::factory_decorator< detector_t >::operator() ( typename detector_t::volume_type & volume,
typename detector_t::surface_lookup_container & surfaces,
typename detector_t::transform_container & transforms,
typename detector_t::mask_container & masks,
typename detector_t::geometry_context ctx = {} )->dindex_range
overridevirtual
Parameters
volumeVolume receiving the generated surfaces.
surfacesDetector surface lookup to append to.
transformsDetector transform store to append to.
masksDetector mask store to append to.
ctxGeometry context used when constructing transforms.
Returns
Half-open range of newly added surfaces.

Reimplemented from detray::factory_decorator< detector_t >.

◆ thickness()

template<concepts::detector detector_t>
auto detray::homogeneous_material_factory< detector_t >::thickness ( ) const->conststd::vector< scalar_type > &
Returns
the material thickness currently held by the factory