Celeritas  0.5.0-56+6b053cd
Public Member Functions | List of all members
celeritas::AtomicNumber Class Reference

Type-safe atomic number identifier. More...

#include <AtomicNumber.hh>

Public Member Functions

constexpr AtomicNumber ()=default
 Construct with an invalid/unassigned value of zero.
 
CELER_CONSTEXPR_FUNCTION AtomicNumber (int z_or_a_value)
 Construct with the Z value.
 
CELER_CONSTEXPR_FUNCTION operator bool () const
 True if value is assigned/valid.
 
CELER_CONSTEXPR_FUNCTION int unchecked_get () const
 Get the Z or A value.
 
CELER_FUNCTION int get () const
 Get Z or A value.
 

Detailed Description

Type-safe atomic number identifier.

Atomic numbers (Z and A) have constraints that integers do not (zero is not an atomic number, dividing one atomic number by another is meaningless) so this type improves the semantics and safety.

Generally speaking, Z and A numbers are used during setup and when evaluating expressions that use atomic charge. Z or A should not be used to "index" data during runtime.

Constructing with a nonpositive values gives the result in a false state (get will throw a DebugError).


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