|
Celeritas 0.7.0-dev.179+develop.ec08af0c9
|
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. | |
Recursively walk through all unique volumes/instances.
| VA | Helper 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 level of the volume being visited (the top element has level 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.
|
inline |
Visit all volume instance paths, depth-first.
Future work: we could keep and return full paths instead of just the level if we wanted.
|
inline |
Visit all volume instance paths, depth-first.
Future work: we could keep and return full paths instead of just the level if we wanted.