Celeritas  0.5.0-86+4a8eea4
Public Member Functions | Static Public Member Functions | List of all members
celeritas::CylAligned< T > Class Template Reference

Axis-aligned cylinder. More...

#include <CylAligned.hh>

Public Member Functions

CELER_FUNCTION CylAligned (Real3 const &origin, real_type radius)
 Construct from origin and radius.
 
template<class R >
CELER_FUNCTION CylAligned (Span< R, StorageSpan::extent >)
 Construct from raw data.
 
 CylAligned (CylCentered< T > const &other) noexcept
 Promote from a centered axis-aligned cylinder.
 
CELER_FUNCTION real_type origin_u () const
 Get the origin vector along the 'u' axis.
 
CELER_FUNCTION real_type origin_v () const
 Get the origin vector along the 'v' axis.
 
CELER_FUNCTION real_type radius_sq () const
 Get the square of the radius.
 
CELER_FUNCTION StorageSpan data () const
 Get a view to the data for type-deleted storage.
 
Real3 calc_origin () const
 Get the origin as a 3-vector.
 
CELER_FUNCTION SignedSense calc_sense (Real3 const &pos) const
 Determine the sense of the position relative to this surface.
 
CELER_FUNCTION Intersections calc_intersections (Real3 const &pos, Real3 const &dir, SurfaceState on_surface) const
 Calculate all possible straight-line intersections with this surface.
 
CELER_FUNCTION Real3 calc_normal (Real3 const &pos) const
 Calculate outward normal at a position.
 

Static Public Member Functions

static CylAligned from_radius_sq (Real3 const &origin, real_type rsq)
 Construct from the square of the radius and the origin. More...
 

Type aliases

using Intersections = Array< real_type, 2 >
 Surface type identifier.
 
using StorageSpan = Span< real_type const, 3 >
 Surface type identifier.
 
static CELER_CONSTEXPR_FUNCTION SurfaceType surface_type ()
 Surface type identifier.
 
static CELER_CONSTEXPR_FUNCTION bool simple_safety ()
 Safety is intersection along surface normal.
 
static CELER_CONSTEXPR_FUNCTION Axis t_axis ()
 
static CELER_CONSTEXPR_FUNCTION Axis u_axis ()
 Surface type identifier.
 
static CELER_CONSTEXPR_FUNCTION Axis v_axis ()
 Surface type identifier.
 

Detailed Description

template<Axis T>
class celeritas::CylAligned< T >

Axis-aligned cylinder.

The cylinder is centered about the template parameter Axis.

For a cylinder along the x axis:

\[ (y - y_0)^2 + (z - z_0)^2 - R^2 = 0 \]

The axis-aligned cylinder is used to calculate a tolerance for the second-order coefficient on the quadratic equation, where a small value is approximately zero.

Basing the intersection tolerance on a particle traveling nearly parallel to the cylinder, the angle \(\theta \) between the particle's direction and the center axis of the cylinder needed to give an intersection distance of \( 1/\delta \) when a distance of 1 from the cylinder (or equivalently, an intersection of 1 when a distance \( \delta \) away) is

\[ \sin \theta = \frac{1}{1/\delta} \;. \]

Letting \( \mu = \cos \theta = \Omega \cdot t \) we have

\[ \mu^2 + \delta^2 = 1 \;. \]

The quadratic intersection for an axis-aligned cylinder where the particle is at \( R + \delta \) is

\[ 0 = ax^2 + bx + c = (1 - \mu^2)x^2 + 2 \sqrt{1 - \mu^2} (R + 1) x + (R + 1)^2 - R^2 \]

so the quadric coefficient when a particle is effectively parallel to a cylinder is:

\[ a = (1 - \mu^2) = \delta^2 \;. \]

Because a is calculated by subtraction, this puts a hard limit on the accuracy of the intersection distance: the default value of a=1e-10 corresponds to a tolerance of 1e-5, not the default tolerance 1e-8.

Member Function Documentation

◆ from_radius_sq()

template<Axis T>
CylAligned< T > celeritas::CylAligned< T >::from_radius_sq ( Real3 const &  origin,
real_type  rsq 
)
static

Construct from the square of the radius and the origin.

This is used for surface simplification.

◆ t_axis()

template<Axis T>
static CELER_CONSTEXPR_FUNCTION Axis celeritas::CylAligned< T >::t_axis ( )
inlinestatic

Axes


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