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

Factory class for material maps. More...

#include <detray/builders/material_map_factory.hpp>

Inheritance diagram for detray::material_map_factory< detector_t, index_t >:
[legend]
Collaboration diagram for detray::material_map_factory< detector_t, index_t >:
[legend]

Public Types

using data_type = material_data<scalar_type>
 Material data type consumed by this factory.
using scalar_type = dscalar<typename detector_t::algebra_type>
 Scalar type used by material map values.
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

 material_map_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, data_type &&mat_data, std::vector< std::size_t > &&n_bins, std::vector< std::vector< scalar_type > > &&axis_spans, std::vector< index_type > &&indices)
 Add all necessary components to the factory for a material map.
auto clear () -> void override
 Clear old data.
auto links () const -> const std::map< std::size_t, std::pair< material_id, std::vector< index_type > > > &
auto materials () const -> const std::map< std::size_t, std::vector< material< scalar_type > > > &
auto n_materials () const -> dindex
template<typename bin_data_t, std::size_t N>
auto operator() (typename detector_t::surface_lookup_container &surfaces, std::map< dindex, std::vector< bin_data_t > > &material_map, std::map< dindex, darray< std::size_t, N > > &n_bins, std::map< dindex, darray< std::vector< scalar_type >, N > > &axis_spans)
 Add data for material maps 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::map< std::size_t, 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, typename index_t = dindex>
class detray::material_map_factory< detector_t, index_t >

Factory class for material maps.

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

Template Parameters
detector_ttype of detector that contains the material
index_tlocal bin index type

Constructor & Destructor Documentation

◆ material_map_factory()

template<concepts::detector detector_t, typename index_t = dindex>
detray::material_map_factory< detector_t, index_t >::material_map_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 wrapped by this decorator.

Member Function Documentation

◆ add_material()

template<concepts::detector detector_t, typename index_t = dindex>
void detray::material_map_factory< detector_t, index_t >::add_material ( material_id id,
data_type && mat_data,
std::vector< std::size_t > && n_bins,
std::vector< std::vector< scalar_type > > && axis_spans,
std::vector< index_type > && indices )

Add all necessary components to the factory for a material map.

Parameters
idthe identifier for thr type of material map
n_binsthe number of bins for the material grid axes
axis_spansthe axis ranges for the material grid axes
mat_datacontains the material data
indiceslocal bin indices in the same order as the material data

◆ links()

template<concepts::detector detector_t, typename index_t = dindex>
auto detray::material_map_factory< detector_t, index_t >::links ( ) const->conststd::map< std::size_t, std::pair< material_id, std::vector< index_type > > > &
Returns
the material links to the surfaces (counted for this volume)

◆ materials()

template<concepts::detector detector_t, typename index_t = dindex>
auto detray::material_map_factory< detector_t, index_t >::materials ( ) const->conststd::map< std::size_t, std::vector< material< scalar_type > > > &
Returns
the raw materials that are currently in the factory

◆ n_materials()

template<concepts::detector detector_t, typename index_t = dindex>
auto detray::material_map_factory< detector_t, index_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, typename index_t = dindex>
template<typename bin_data_t, std::size_t N>
auto detray::material_map_factory< detector_t, index_t >::operator() ( typename detector_t::surface_lookup_container & surfaces,
std::map< dindex, std::vector< bin_data_t > > & material_map,
std::map< dindex, darray< std::size_t, N > > & n_bins,
std::map< dindex, darray< std::vector< scalar_type >, N > > & axis_spans )

Add data for material maps to the containers of a volume builder.

This assumes that the surfaces have already been added (e.g. by this factories underlying surface factory).

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 maps.
material_mapmap the local bin indices and their content to a volume local surface index.
n_binsNumber of bins on each axis for every mapped surface.
axis_spansCoordinate spans for each material-map axis.
Returns
No value; material data is added to the output containers.

◆ operator()() [2/2]

template<concepts::detector detector_t, typename index_t = dindex>
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, typename index_t = dindex>
auto detray::material_map_factory< detector_t, index_t >::thickness ( ) const->conststd::map< std::size_t, std::vector< scalar_type > > &
Returns
the material thickness currently held by the factory