Celeritas  0.5.0-56+6b053cd
Classes | Namespaces | Typedefs | Enumerations | Functions
OrangeTypes.hh File Reference

Type definitions for ORANGE geometry. More...

#include <cstddef>
#include <functional>
#include <type_traits>
#include <utility>
#include "corecel/Macros.hh"
#include "corecel/OpaqueId.hh"
#include "corecel/Types.hh"
#include "corecel/cont/Array.hh"
#include "corecel/math/NumericLimits.hh"
#include "geocel/Types.hh"

Classes

struct  celeritas::Daughter
 Data specifying a daughter universe embedded in a volume. More...
 
struct  celeritas::Tolerance< T >
 Tolerance for construction and runtime bumping. More...
 

Namespaces

 celeritas::logic
 Volume logic encoding.
 

Typedefs

using celeritas::fast_real_type = float
 Real type used for acceleration.
 
using celeritas::logic_int = size_type
 Integer type for volume CSG tree representation.
 
template<Axis T>
using celeritas::AxisTag = std::integral_constant< Axis, T >
 Helper class for some template dispatch functions.
 
using celeritas::BIHNodeId = OpaqueId< struct BIHNode_ >
 Identifier for a BIHNode objects.
 
using celeritas::DaughterId = OpaqueId< struct Daughter >
 Identifier for a daughter universe.
 
using celeritas::FaceId = OpaqueId< struct Face_, logic_int >
 Identifier for a face within a volume.
 
using celeritas::FastBBox = BoundingBox< fast_real_type >
 Bounding box used for acceleration.
 
using celeritas::FastBBoxId = OpaqueId< FastBBox >
 Identifier for a bounding box used for acceleration.
 
using celeritas::FastReal3 = Array< float, 3 >
 Identifier for an array of length three of floating point values.
 
using celeritas::LocalSurfaceId = OpaqueId< struct LocalSurface_ >
 Local identifier for a surface within a universe.
 
using celeritas::LocalVolumeId = OpaqueId< struct LocalVolume_ >
 Local identifier for a geometry volume within a universe.
 
using celeritas::OrientedBoundingZoneId = OpaqueId< struct OrientedBoundingZoneRecord >
 Identifier for an OrientedBoundingZone.
 
using celeritas::SimpleUnitId = OpaqueId< struct SimpleUnitRecord >
 Opaque index for "simple unit" data.
 
using celeritas::RectArrayId = OpaqueId< struct RectArrayRecord >
 Opaque index for rectilinear array data.
 
using celeritas::TransformId = OpaqueId< struct TransformRecord >
 Identifier for a translation of a single embedded universe.
 
using celeritas::UniverseId = OpaqueId< struct Universe_ >
 Identifier for a relocatable set of volumes.
 

Enumerations

enum class  celeritas::Sense : bool { inside , outside }
 Whether a position is logically "inside" or "outside" a surface. More...
 
enum class  celeritas::SurfaceType : unsigned char {
  px , py , pz , cxc ,
  cyc , czc , sc , cx ,
  cy , cz , p , s ,
  kx , ky , kz , sq ,
  gq , inv , size_
}
 Enumeration for mapping surface classes to integers. More...
 
enum class  celeritas::TransformType : unsigned char { no_transformation , translation , transformation , size_ }
 Enumeration for mapping transform implementations to integers. More...
 
enum class  celeritas::UniverseType : unsigned char { simple , rect_array , size_ }
 Enumeration for type-deleted universe storage. More...
 
enum class  celeritas::SignedSense { inside = -1 , on = 0 , outside = 1 }
 Evaluated quadric expression allowing for distinct 'on surface' state. More...
 
enum class  celeritas::SurfaceState : bool { off = false , on = true }
 When evaluating an intersection, whether the point is on the surface. More...
 
enum class  celeritas::BoundaryResult : bool { reentrant = false , exiting = true }
 When crossing a boundary, whether the track exits the current volume. More...
 
enum class  celeritas::Chirality : bool { left , right }
 Chirality of a twirly object (currently only Involute). More...
 
enum  celeritas::logic::OperatorToken : logic_int {
  lbegin = logic_int(~logic_int(6)) , celeritas::logic::lopen = lbegin , celeritas::logic::lclose , celeritas::logic::ltrue ,
  celeritas::logic::lor , celeritas::logic::land , celeritas::logic::lnot , lend
}
 Special logical Evaluator tokens. More...
 
enum class  celeritas::ZOrder : size_type {
  invalid = 0 , background , media , array ,
  hole , implicit_exterior = size_type(-2) , exterior = size_type(-1)
}
 Masking priority. More...
 

Functions

CELER_CONSTEXPR_FUNCTION Sense celeritas::to_sense (bool s)
 Convert a boolean value to a Sense enum.
 
CELER_CONSTEXPR_FUNCTION Sense celeritas::flip_sense (Sense orig)
 Change the sense across a surface.
 
CELER_CONSTEXPR_FUNCTION SignedSense celeritas::flip_sense (SignedSense orig)
 Change the sense across a surface.
 
CELER_CONSTEXPR_FUNCTION BoundaryResult celeritas::flip_boundary (BoundaryResult orig)
 Change whether a boundary crossing is reentrant or exiting.
 
CELER_CONSTEXPR_FUNCTION SignedSense celeritas::real_to_sense (real_type quadric)
 Evaluate the sense based on the LHS expression of the quadric equation. More...
 
CELER_CONSTEXPR_FUNCTION Sense celeritas::to_sense (SignedSense s)
 Convert a signed sense to a Sense enum.
 
CELER_CONSTEXPR_FUNCTION SurfaceState celeritas::to_surface_state (SignedSense s)
 Convert a signed sense to a surface state.
 
CELER_CONSTEXPR_FUNCTION real_type celeritas::no_intersection ()
 Sentinel value indicating "no intersection". More...
 
CELER_CONSTEXPR_FUNCTION UniverseId celeritas::top_universe_id ()
 Return the UniverseId of the highest-level (i.e., root) universe.
 
CELER_CONSTEXPR_FUNCTION bool celeritas::logic::is_operator_token (logic_int lv)
 Whether an integer is a special logic token.
 
constexpr char celeritas::to_char (Sense s)
 Get a printable character corresponding to a sense.
 
char const * celeritas::to_cstring (SurfaceType value)
 Get a string corresponding to a surface type.
 
char const * celeritas::to_cstring (TransformType value)
 Get a string corresponding to a transform type.
 
char const * celeritas::to_cstring (SignedSense s)
 Get a string corresponding to a signed sense.
 
char const * celeritas::to_cstring (SurfaceState s)
 
constexpr char celeritas::logic::to_char (OperatorToken tok)
 
char const * celeritas::to_cstring (ZOrder zo)
 Get a string corresponding to a transform type.
 
char celeritas::to_char (ZOrder zo)
 Get a printable character corresponding to a z ordering.
 
ZOrder celeritas::to_zorder (char c)
 Convert a printable character to a z ordering.
 

Detailed Description

Type definitions for ORANGE geometry.

Enumeration Type Documentation

◆ BoundaryResult

enum celeritas::BoundaryResult : bool
strong

When crossing a boundary, whether the track exits the current volume.

This is necessary due to changes in direction on the boundary due to magnetic field and/or multiple scattering. We could extend this later to a flag set of "volume changed" (internal non-reflective crossing), "direction changed" (reflecting/periodic), "position changed" (bump/periodic).

◆ Chirality

enum celeritas::Chirality : bool
strong

Chirality of a twirly object (currently only Involute).

Enumerator
left 

Sinistral, spiraling counterclockwise.

right 

Dextral, spiraling clockwise.

◆ Sense

enum celeritas::Sense : bool
strong

Whether a position is logically "inside" or "outside" a surface.

For a plane, "outside" (true) is the "positive" sense and equivalent to

\[ \vec x \cdot \vec n >= 0 \]

and "inside" is to the left of the plane's normal. Likewise, for a sphere, "inside" is where the dot product of the position and outward normal is negative.

Enumerator
inside 

Quadric expression is less than zero.

outside 

Expression is greater than zero.

◆ SignedSense

Evaluated quadric expression allowing for distinct 'on surface' state.

For a plane, "outside" is equivalent to

\[ \vec x \cdot \vec n > 0 \]

and "inside" is to the left of the plane's normal (a negative dot product). The exact equality to zero is literally an "edge case" but it can happen with inter-universe coincident surfaces as well as carefully placed particle sources and ray tracing.

As an implementataion detail, the "on" case is currently exact, but future changes might increase the width of "on" to a finite but small range ("fuzziness").

◆ SurfaceState

enum celeritas::SurfaceState : bool
strong

When evaluating an intersection, whether the point is on the surface.

This helps eliminate roundoff errors and other arithmetic issues.

◆ SurfaceType

enum celeritas::SurfaceType : unsigned char
strong

Enumeration for mapping surface classes to integers.

These are ordered roughly by complexity. The storage requirement for corresponding surfaces are:

  • 1 for p.|sc|c.c,
  • 3 for c.,
  • 4 for [ps]|k.,
  • 7 for sq, and
  • 10 for gq.

See orange/surf/SurfaceTypeTraits.hh for how these map to classes.

Enumerator
px 

Plane aligned with X axis.

py 

Plane aligned with Y axis.

pz 

Plane aligned with Z axis.

cxc 

Cylinder centered on X axis.

cyc 

Cylinder centered on Y axis.

czc 

Cylinder centered on Z axis.

sc 

Sphere centered at the origin.

cx 

Cylinder parallel to X axis.

cy 

Cylinder parallel to Y axis.

cz 

Cylinder parallel to Z axis.

General plane.

Sphere.

kx 

Cone parallel to X axis.

ky 

Cone parallel to Y axis.

kz 

Cone parallel to Z axis.

sq 

Simple quadric.

gq 

General quadric.

inv 

Involute.

size_ 

Sentinel value for number of surface types.

◆ TransformType

enum celeritas::TransformType : unsigned char
strong

Enumeration for mapping transform implementations to integers.

Enumerator
no_transformation 

Identity transform.

translation 

Translation only.

transformation 

Translation plus rotation.

◆ UniverseType

enum celeritas::UniverseType : unsigned char
strong

Enumeration for type-deleted universe storage.

See orange/univ/UniverseTypeTraits.hh for how these map to data and classes.

Enumerator
size_ 

Sentinel value for number of universe types.

◆ ZOrder

enum celeritas::ZOrder : size_type
strong

Masking priority.

This is currently not implemented in GPU ORANGE except for the special "background" cell and "exterior".

Enumerator
invalid 

Invalid region.

background 

Implicit fill.

media 

Material-filled region or array.

array 

Lattice array of nested arrangement.

hole 

Another universe masking this one.

implicit_exterior 

Exterior in lower universe.

exterior 

The global problem boundary.

Function Documentation

◆ no_intersection()

CELER_CONSTEXPR_FUNCTION real_type celeritas::no_intersection ( )

Sentinel value indicating "no intersection".

Todo:

There is probably a better place to put this since it's not a "type".

A value of zero might also work since zero-length steps are prohibited. But we'll need custom min and min_element in that case.

◆ real_to_sense()

CELER_CONSTEXPR_FUNCTION SignedSense celeritas::real_to_sense ( real_type  quadric)

Evaluate the sense based on the LHS expression of the quadric equation.

This is an optimized jump-free version of:

return quadric == 0 ? SignedSense::on
: quadric < 0 ? SignedSense::inside
: SignedSense::outside;

as

int gz = !(quadric <= 0) ? 1 : 0;
int lz = quadric < 0 ? 1 : 0;
return static_cast<SignedSense>(gz - lz);
SignedSense
Evaluated quadric expression allowing for distinct 'on surface' state.
Definition: OrangeTypes.hh:190

and compressed into a single line.

NaN values are treated as "outside".