ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::hash_tree< input_collection_t, data_t, hash_function_t, hash_t, vector_t > Class Template Reference

Builds a hash tree from the data of an input collection. More...

#include <detray/test/utils/hash_tree.hpp>

Classes

struct  hashed_node
 Default node in the hash tree. More...

Public Types

using hash_function = hash_function_t
 Hash function used by the tree.
using hash_type = hash_t
 Type of hashes stored in the tree.

Public Member Functions

 hash_tree ()=delete
 No empty tree.
 hash_tree (const input_collection_t &data, const hash_function_t &={})
 Build from an input collection using the configured hash function.
 ~hash_tree ()=default
 Default destructor.
auto root ()
std::string to_string () const
const vector_t< hashed_node > & tree () const

Detailed Description

template<typename input_collection_t, typename data_t = typename input_collection_t::value_type, typename hash_function_t = default_hash<data_t>, typename hash_t = decltype(std::declval<hash_function_t>()(data_t{0})), template< typename > class vector_t = dvector>
requires std::is_invocable_v<hash_function_t, data_t> && std::is_invocable_v<hash_function_t, hash_t>
class detray::hash_tree< input_collection_t, data_t, hash_function_t, hash_t, vector_t >

Builds a hash tree from the data of an input collection.

This class provides a graph algorithm that walk along the volumes of a given geometry and uses the portals to check reachability between the volumes.

Template Parameters
hash_functionthe type hashing that can be called on the collection data.
inputcollection the type of data collection to be hased
node_typehow carries the hashes and links

Constructor & Destructor Documentation

◆ hash_tree()

template<typename input_collection_t, typename data_t = typename input_collection_t::value_type, typename hash_function_t = default_hash<data_t>, typename hash_t = decltype(std::declval<hash_function_t>()(data_t{0})), template< typename > class vector_t = dvector>
detray::hash_tree< input_collection_t, data_t, hash_function_t, hash_t, vector_t >::hash_tree ( const input_collection_t & data,
const hash_function_t & = {} )
explicit

Build from an input collection using the configured hash function.

The optional hash function argument is ignored; the default-constructed hash function is used.

Parameters
dataInput data to hash.

Member Function Documentation

◆ root()

template<typename input_collection_t, typename data_t = typename input_collection_t::value_type, typename hash_function_t = default_hash<data_t>, typename hash_t = decltype(std::declval<hash_function_t>()(data_t{0})), template< typename > class vector_t = dvector>
auto detray::hash_tree< input_collection_t, data_t, hash_function_t, hash_t, vector_t >::root ( )
Returns
the root hash of the tree, which is always the last node in the node storage by way of construction. It is the fingerprint of the input data.

◆ to_string()

template<typename input_collection_t, typename data_t = typename input_collection_t::value_type, typename hash_function_t = default_hash<data_t>, typename hash_t = decltype(std::declval<hash_function_t>()(data_t{0})), template< typename > class vector_t = dvector>
std::string detray::hash_tree< input_collection_t, data_t, hash_function_t, hash_t, vector_t >::to_string ( ) const
Returns
the hash tree as a string

◆ tree()

template<typename input_collection_t, typename data_t = typename input_collection_t::value_type, typename hash_function_t = default_hash<data_t>, typename hash_t = decltype(std::declval<hash_function_t>()(data_t{0})), template< typename > class vector_t = dvector>
const vector_t< hashed_node > & detray::hash_tree< input_collection_t, data_t, hash_function_t, hash_t, vector_t >::tree ( ) const
Returns
the tree data structure