Celeritas 0.7.0-dev.245+develop.a7be925e
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
celeritas::OrangeTrackView Class Reference

Navigate through an ORANGE geometry on a single thread. More...

#include <OrangeTrackView.hh>

Public Types

Type aliases
using ParamsRef = NativeCRef< OrangeParamsData >
 
using StateRef = NativeRef< OrangeStateData >
 
using Initializer_t = GeoTrackInitializer
 
using LSA = LevelStateAccessor
 
using UniverseIndexer = detail::UniverseIndexer
 
using real_type = ::celeritas::real_type
 

Public Member Functions

 OrangeTrackView (ParamsRef const &params, StateRef const &states, TrackSlotId tid)
 Construct from persistent and state data.
 
OrangeTrackViewoperator= (Initializer_t const &init)
 Construct the state.
 
Real3 constpos () const
 The current position.
 
Real3 constdir () const
 The current direction.
 
VolumeId volume_id () const
 The current canonical volume ID.
 
VolumeInstanceId volume_instance_id () const
 The current volume instance.
 
VolumeLevelId volume_level () const
 The level in the canonical volume graph.
 
void volume_instance_id (Span< VolumeInstanceId >) const
 Get the volume instance ID at every level.
 
bool is_outside () const
 Whether the track is outside the valid geometry region.
 
bool is_on_boundary () const
 Whether the track is exactly on a surface.
 
bool failed () const
 Whether the last operation resulted in an error.
 
Real3 normal () const
 Get the normal vector of the current surface.
 
Propagation find_next_step ()
 Find the distance to the next geometric boundary.
 
Propagation find_next_step (real_type max_step)
 Find a nearby distance to the next geometric boundary up to a distance.
 
real_type find_safety ()
 Find the distance to the nearest boundary in any direction.
 
real_type find_safety (real_type max_step)
 Find the distance to the nearest nearby boundary.
 
void move_to_boundary ()
 Move to the next straight-line boundary but do not change volume.
 
void move_internal (real_type step)
 Move within the current volume.
 
void move_internal (Real3 const &pos)
 Move within the current volume to a nearby point.
 
void cross_boundary ()
 Cross from one side of the current surface to the other.
 
void set_dir (Real3 const &newdir)
 Change the track's direction.
 
OrangeParamsScalars constscalars () const
 Geometry constant parameters.
 
UnivLevelId univ_level () const
 The track's level in the universe hierarchy.
 
ImplVolumeId impl_volume_id () const
 The current "global" volume ID.
 
ImplSurfaceId impl_surface_id () const
 The current surface ID.
 
ImplSurfaceId next_impl_surface_id () const
 After 'find_next_step', the next straight-line surface.
 
UniverseIndexer make_univ_indexer () const
 Make a UniverseIndexer to convert local to global IDs.
 
LSA make_lsa () const
 Make a LevelStateAccessor for the current thread and level.
 
LSA make_lsa (UnivLevelId ulev_id) const
 Make a LevelStateAccessor for the current thread and a given univ_level.
 

Detailed Description

Navigate through an ORANGE geometry on a single thread.

The direction of normal is set to always point out of the volume the track is currently in. On the boundary this is determined by the sense of the track rather than its direction.

Todo:
move_internal with a position should depend on the safety distance, but that check is not yet implemented.

Member Function Documentation

◆ cross_boundary()

void celeritas::OrangeTrackView::cross_boundary ( )
inline

Cross from one side of the current surface to the other.

The position must be on the boundary following a move-to-boundary. This should only be called once per boundary crossing.

◆ find_next_step()

Propagation celeritas::OrangeTrackView::find_next_step ( real_type  max_step)
inline

Find a nearby distance to the next geometric boundary up to a distance.

This may reduce the number of surfaces needed to check, sort, or write to temporary memory, thereby speeding up transport.

◆ find_safety() [1/2]

real_type celeritas::OrangeTrackView::find_safety ( )
inline

Find the distance to the nearest boundary in any direction.

The safety distance at a given point is the minimum safety distance over all universe levels, since surface deduplication can potentionally elide bounding surfaces at more deeply embedded universe levels.

◆ find_safety() [2/2]

real_type celeritas::OrangeTrackView::find_safety ( real_type  max_step)
inline

Find the distance to the nearest nearby boundary.

Since we currently support only "simple" safety distances, we can't eliminate anything by checking only nearby surfaces.

◆ impl_volume_id()

ImplVolumeId celeritas::OrangeTrackView::impl_volume_id ( ) const
inline

The current "global" volume ID.

Note
It is allowable to call this function when "outside", because the outside in ORANGE is just a special volume.

◆ make_lsa() [1/2]

auto celeritas::OrangeTrackView::make_lsa ( ) const
inline

Make a LevelStateAccessor for the current thread and level.

Please treat as read-only outside this class!

◆ make_lsa() [2/2]

auto celeritas::OrangeTrackView::make_lsa ( UnivLevelId  ulev_id) const
inline

Make a LevelStateAccessor for the current thread and a given univ_level.

Note that access beyond the current level is allowable: cross_boundary locally updates the univ_level before committing the change.

◆ move_internal() [1/2]

void celeritas::OrangeTrackView::move_internal ( Real3 const pos)
inline

Move within the current volume to a nearby point.

Todo:
Currently it's up to the caller to make sure that the position is "nearby". We should actually test this with an "is inside" call.

◆ move_internal() [2/2]

void celeritas::OrangeTrackView::move_internal ( real_type  dist)
inline

Move within the current volume.

The straight-line distance must be less than the distance to the boundary.

◆ normal()

Real3 celeritas::OrangeTrackView::normal ( ) const
inline

Get the normal vector of the current surface.

The direction of the normal is determined by the sense of the track such that the normal always points out of the volume that the track is currently in.

◆ operator=()

OrangeTrackView & celeritas::OrangeTrackView::operator= ( Initializer_t const init)
inline

Construct the state.

Expensive. This function should only be called to initialize an event from a starting location and direction. Secondaries will initialize their states from a copy of the parent.

◆ set_dir()

void celeritas::OrangeTrackView::set_dir ( Real3 const newdir)
inline

Change the track's direction.

This happens after a scattering event or movement inside a magnetic field. It resets the calculated distance-to-boundary. It is allowed to happen on the boundary, but changing direction so that it goes from pointing outward to inward (or vice versa) will mean that cross_boundary will be a null-op.

◆ univ_level()

UnivLevelId celeritas::OrangeTrackView::univ_level ( ) const
inline

The track's level in the universe hierarchy.

Zero corresponds to being in the global universe.

◆ volume_id()

VolumeId celeritas::OrangeTrackView::volume_id ( ) const
inline

The current canonical volume ID.

This is the volume identifier in the user's geometry model, not the ORANGE implementation of it. For unit tests and certain use cases where the volumes have not been loaded from Geant4 or a structured geometry model, it may not be available.

◆ volume_instance_id()

void celeritas::OrangeTrackView::volume_instance_id ( Span< VolumeInstanceId levels) const
inline

Get the volume instance ID at every level.

The input span size must be equal to the value of "level" plus one. The top-most volume ("world" or level zero) starts at index zero, and child volumes have higher level IDs. Note that Geant4 uses the reverse nomenclature.


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