Celeritas 0.6.0-129+develop.846910afa
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
celeritas::VolumeVisitor< VA > Class Template Reference

Recursively walk through all unique volumes/instances. More...

#include <VolumeVisitor.hh>

Public Types

using VolumeRef = typename VA::VolumeRef
 
using VolumeInstanceRef = typename VA::VolumeInstanceRef
 

Public Member Functions

 VolumeVisitor (VA va)
 Construct from accessor for obtaining volumes.
 
template<class F >
void operator() (F &&visit, VolumeRef top)
 Visit all volume instance paths, depth-first.
 
template<class F >
void operator() (F &&visit, VolumeInstanceRef top)
 Visit all volume instance paths, depth-first.
 

Detailed Description

template<class VA>
class celeritas::VolumeVisitor< VA >

Recursively walk through all unique volumes/instances.

Template Parameters
VAHelper class with the same signature as VolumeAccessor above.

This class can be used for both Geant4 and VecGeom to give the same visiting behavior across the two. The volume accessor should have the same signature as VolumeAccessor above.

The visitor function must have the signature bool(*)(Ref, int) where the return value indicates whether the volume's children should be visited, Ref is either VolumeRef or VolumeInstanceRef , and the integer is the depth of the volume being visited (the top element has depth zero).

By default this will visit all unique instances, i.e. every path in the graph (the entire "touchable" hierarchy): this may be very expensive! If it's desired to only visit single physical volumes, mark them as visited using a set (see unit test for example) and return false from the visitor to terminate the search path.

Member Function Documentation

◆ operator()() [1/2]

template<class VA >
template<class F >
void celeritas::VolumeVisitor< VA >::operator() ( F &&  visit,
VolumeInstanceRef  top 
)
inline

Visit all volume instance paths, depth-first.

Future work: we could keep and return full paths instead of just the depth if we wanted.

◆ operator()() [2/2]

template<class VA >
template<class F >
void celeritas::VolumeVisitor< VA >::operator() ( F &&  visit,
VolumeRef  top 
)
inline

Visit all volume instance paths, depth-first.

Future work: we could keep and return full paths instead of just the depth if we wanted.


The documentation for this class was generated from the following file: