Celeritas 0.7.0-dev.227+develop.0bc78931
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::test::CheckedGeoTrackView Class Referencefinal

Check validity of safety and volume crossings while navigating on CPU. More...

#include <CheckedGeoTrackView.hh>

Inheritance diagram for celeritas::test::CheckedGeoTrackView:
Inheritance graph
[legend]

Public Types

Type aliases
using Initializer_t = GeoTrackInitializer
 
using Real3 = Array< real_type, 3 >
 
using TrackT = GeoTrackInterface< real_type >
 
using UPTrack = std::unique_ptr< TrackT >
 
using SPConstGeoI = std::shared_ptr< GeoParamsInterface const >
 
using SPConstVolumes = std::shared_ptr< VolumeParams const >
 
- Public Types inherited from celeritas::GeoTrackInterface< real_type >
using Initializer_t = GeoTrackInitializer
 
using real_type = real_type
 
using Real3 = Array< real_type, 3 >
 

Public Member Functions

 CheckedGeoTrackView (UPTrack track)
 Construct with a unique pointer to a geo track view.
 
 CheckedGeoTrackView (UPTrack track, SPConstVolumes volumes, SPConstGeoI geo_interface, UnitLength unit_length)
 ! Construct with a unique pointer to a geo track view.
 
TrackT consttrack_view () const
 Access the underlying track view.
 
TrackTtrack_view ()
 Access the underlying track view.
 
real_type safety_tol () const
 Check volume consistency this far from the boundary.
 
size_type intersect_count () const
 Number of calls of find_next_step.
 
size_type safety_count () const
 Number of calls of find_safety.
 
void reset_count ()
 Reset the counters.
 
void check_normal (bool value)
 Enable/disable normal checking.
 
bool check_normal () const
 Whether normal checking is enabled.
 
void check_failure (bool value)
 Enable/disable failure state checking.
 
bool check_failure () const
 Whether failure checking is enabled.
 
SPConstVolumes constvolumes () const
 Canonical volume parameters (if available)
 
SPConstGeoI constgeo_interface () const
 Geometry interface (if available)
 
UnitLength unit_length () const
 Length scale.
 
CheckedGeoTrackViewoperator= (GeoTrackInitializer const &init) final
 Initialize the state.
 
Real3 constpos () const final
 Return the physical position in the global coordinate system.
 
Real3 constdir () const final
 Return the direction in the global coordinate system.
 
VolumeId volume_id () const final
 Get the canonical volume ID in the current impl volume.
 
VolumeInstanceId volume_instance_id () const final
 Get the physical volume ID in the current cell.
 
VolumeLevelId volume_level () const final
 Get the distance from root volume in the geometry hierarchy.
 
void volume_instance_id (Span< VolumeInstanceId > levels) const final
 Get the volume instance ID for all levels.
 
ImplVolumeId impl_volume_id () const final
 Get the implementation volume ID.
 
bool is_outside () const final
 Whether the track is outside the valid geometry region.
 
bool failed () const final
 Whether the last operation resulted in an error.
 
bool is_on_boundary () const final
 Whether the track is exactly on a surface.
 
Real3 normal () const final
 Calculate the normal vector on the current surface.
 
real_type find_safety () final
 Calculate the safety distance.
 
real_type find_safety (real_type max_safety) final
 Calculate the safety distance up to a given length.
 
void set_dir (Real3 const &) final
 Set the direction.
 
Propagation find_next_step () final
 Find the distance to the next boundary.
 
Propagation find_next_step (real_type max_distance) final
 Find the distance to the next boundary.
 
void move_internal (real_type) final
 Move within the volume along the current direction.
 
void move_internal (Real3 const &pos) final
 Move within the volume to a nearby position.
 
void move_to_boundary () final
 Move to the next boundary.
 
void cross_boundary () final
 Move to the next boundary.
 
- Public Member Functions inherited from celeritas::GeoTrackInterface< real_type >
virtual ~GeoTrackInterface ()=0
 Default virtual destructor.
 
virtual Propagation find_next_step (real_type max_step)=0
 Find the distance to the next boundary, up to and including a step.
 
virtual void move_internal (real_type step)=0
 Move within the volume.
 
virtual real_type find_safety (real_type max_step)=0
 Find the safety at the current position, up to a maximum step distance.
 

Additional Inherited Members

- Protected Member Functions inherited from celeritas::GeoTrackInterface< real_type >
 CELER_DEFAULT_COPY_MOVE (GeoTrackInterface)
 

Detailed Description

Check validity of safety and volume crossings while navigating on CPU.

This wraps a GeoTrackInterface and adds validation and instrumentation. It counts the number of calls to find_next_step and find_safety .

Two flags can alter the error checking:

The only nontrivial function that can be called from an outside or failed state is initialization (with operator= ).

Member Function Documentation

◆ cross_boundary()

void celeritas::test::CheckedGeoTrackView::cross_boundary ( )
finalvirtual

Move to the next boundary.

Implements celeritas::GeoTrackInterface< real_type >.

◆ dir()

Real3 const & celeritas::test::CheckedGeoTrackView::dir ( ) const
inlinefinalvirtual

Return the direction in the global coordinate system.

Implements celeritas::GeoTrackInterface< real_type >.

◆ failed()

bool celeritas::test::CheckedGeoTrackView::failed ( ) const
inlinefinalvirtual

Whether the last operation resulted in an error.

Implements celeritas::GeoTrackInterface< real_type >.

◆ find_next_step() [1/2]

Propagation celeritas::test::CheckedGeoTrackView::find_next_step ( )
finalvirtual

Find the distance to the next boundary.

Precondition
Cannot call from outside or if failed
Postcondition
Boundary state was unaffected
Returns
Next step, with boundary flag set

Implements celeritas::GeoTrackInterface< real_type >.

◆ find_next_step() [2/2]

Propagation celeritas::test::CheckedGeoTrackView::find_next_step ( real_type  distance)
final

Find the distance to the next boundary.

Precondition
Cannot call from outside or if failed, distance is positive
Postcondition
Boundary state was unaffected
Returns
Next step, with distance between zero and the given maximum

◆ find_safety() [1/2]

real_type celeritas::test::CheckedGeoTrackView::find_safety ( )
finalvirtual

Calculate the safety distance.

Returns
Nonnegative safety value

Implements celeritas::GeoTrackInterface< real_type >.

◆ find_safety() [2/2]

real_type celeritas::test::CheckedGeoTrackView::find_safety ( real_type  max_safety)
final

Calculate the safety distance up to a given length.

Returns
Nonnegative safety value up to max_safety

◆ impl_volume_id()

ImplVolumeId celeritas::test::CheckedGeoTrackView::impl_volume_id ( ) const
inlinefinalvirtual

Get the implementation volume ID.

Implements celeritas::GeoTrackInterface< real_type >.

◆ is_on_boundary()

bool celeritas::test::CheckedGeoTrackView::is_on_boundary ( ) const
inlinefinalvirtual

Whether the track is exactly on a surface.

Returns true if a track is exactly on the boundary of a volume, capable of changing to another volume without altering the physical position.

Implements celeritas::GeoTrackInterface< real_type >.

◆ is_outside()

bool celeritas::test::CheckedGeoTrackView::is_outside ( ) const
inlinefinalvirtual

Whether the track is outside the valid geometry region.

Returns true if the track has left the world (or started outside the outermost known volume).

Implements celeritas::GeoTrackInterface< real_type >.

◆ move_internal() [1/2]

void celeritas::test::CheckedGeoTrackView::move_internal ( Real3 const pos)
finalvirtual

Move within the volume to a nearby position.

The first call to this function will perform additional checking by reinitializing the geometry at the given position.

Postcondition
Not on boundary

Implements celeritas::GeoTrackInterface< real_type >.

◆ move_internal() [2/2]

void celeritas::test::CheckedGeoTrackView::move_internal ( real_type  step)
final

Move within the volume along the current direction.

Postcondition
Not on boundary

◆ move_to_boundary()

void celeritas::test::CheckedGeoTrackView::move_to_boundary ( )
finalvirtual

Move to the next boundary.

Postcondition
On boundary

Implements celeritas::GeoTrackInterface< real_type >.

◆ normal()

Real3 celeritas::test::CheckedGeoTrackView::normal ( ) const
inlinefinalvirtual

Calculate the normal vector on the current surface.

Returns a global-coordinate direction perpendicular to the volume at the local point when on a boundary. The sign of the surface normal is implementation-dependent; it may change based on the track state (previous volume, direction, surface sign) or geometry construction.

Implements celeritas::GeoTrackInterface< real_type >.

◆ operator=()

CheckedGeoTrackView & celeritas::test::CheckedGeoTrackView::operator= ( GeoTrackInitializer const init)
finalvirtual

Initialize the state.

Implements celeritas::GeoTrackInterface< real_type >.

◆ pos()

Real3 const & celeritas::test::CheckedGeoTrackView::pos ( ) const
inlinefinalvirtual

Return the physical position in the global coordinate system.

Implements celeritas::GeoTrackInterface< real_type >.

◆ set_dir()

void celeritas::test::CheckedGeoTrackView::set_dir ( Real3 const newdir)
finalvirtual

Set the direction.

Precondition
Direction is a unit vector
Postcondition
Boundary state was unaffected

Implements celeritas::GeoTrackInterface< real_type >.

◆ volume_id()

VolumeId celeritas::test::CheckedGeoTrackView::volume_id ( ) const
inlinefinalvirtual

Get the canonical volume ID in the current impl volume.

Implements celeritas::GeoTrackInterface< real_type >.

◆ volume_instance_id() [1/2]

VolumeInstanceId celeritas::test::CheckedGeoTrackView::volume_instance_id ( ) const
inlinefinalvirtual

Get the physical volume ID in the current cell.

Implements celeritas::GeoTrackInterface< real_type >.

◆ volume_instance_id() [2/2]

void celeritas::test::CheckedGeoTrackView::volume_instance_id ( Span< VolumeInstanceId levels) const
inlinefinalvirtual

Get the volume instance ID for all levels.

Implements celeritas::GeoTrackInterface< real_type >.

◆ volume_level()

VolumeLevelId celeritas::test::CheckedGeoTrackView::volume_level ( ) const
inlinefinalvirtual

Get the distance from root volume in the geometry hierarchy.

Implements celeritas::GeoTrackInterface< real_type >.


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