GEOSX
Typedefs | Functions
geos::types Namespace Reference

Namespace containing type dispatching facilities. More...

Typedefs

template<typename ... Ts>
using TypeList = camp::list< Ts... >
 Construct a list of types.
 
template<typename LIST >
using ListofTypeList = internal::Apply< camp::list, LIST >
 Construct a list of list type.
 
template<typename ... Ls>
using Join = typename camp::join< Ls ... >::type
 Concatenate multiple type lists.
 
template<typename TYPES , typename NDIMS >
using ArrayTypes = internal::Apply< internal::ArrayType, camp::cartesian_product< TYPES, internal::AddLayouts< NDIMS > > >
 Construct a list of GEOSX multidimensional array types (geos::Array), containing all value types in type list TYPES and all dimensionalities in list of integral constants NDIMS.
 
using IntegralTypes = TypeList< integer, localIndex, globalIndex >
 List of major integral types used in GEOSX type system.
 
using RealTypes = TypeList< real32, real64 >
 List of major real-valued (floating point) types used in GEOSX type system.
 
template<int M, int N>
using DimsRange = camp::as_list< internal::Increment< camp::make_idx_seq_t< N - M+1 >, M > >
 Generate a list of types representing array dimensionalities from M up to (and including) N.
 
template<int N>
using DimsSingle = DimsRange< N, N >
 Generate a list of types representing array dimensionality exactly N.
 
template<int N>
using DimsUpTo = DimsRange< 1, N >
 Generate a list of types representing array dimensionalities up to (and including) N.
 
using RealArrays = ArrayTypes< RealTypes, DimsUpTo< 4 > >
 List of real-valued array types typically used in GEOSX (dimensions up to 4).
 
using IntegralArrays = ArrayTypes< IntegralTypes, DimsUpTo< 2 > >
 List of integer-valued array types typically used in GEOSX (dimensions 1 and 2).
 
using StandardArrays = Join< RealArrays, IntegralArrays >
 List of all array types (real- and integer-valued) typically used in GEOSX.
 

Functions

template<typename LIST , typename LAMBDA , typename ... Ts>
bool dispatch (LIST const combinations, LAMBDA &&lambda, Ts &&... objects)
 Dispatch a generic worker function lambda based on runtime type. More...
 

Detailed Description

Namespace containing type dispatching facilities.

Function Documentation

◆ dispatch()

template<typename LIST , typename LAMBDA , typename ... Ts>
bool geos::types::dispatch ( LIST const  combinations,
LAMBDA &&  lambda,
Ts &&...  objects 
)

Dispatch a generic worker function lambda based on runtime type.

Template Parameters
LISTtype of the list of types
LAMBDAtype of user-provided function or lambda, must have one auto argument
Tstypes of the objects to be dispatched.
Parameters
combinationslist of types
lambdalambda user-provided callable
objectsobjects to be dispatched
Returns
true iff type has been dispatch

todo Do we want errorIfTypeNotFound parameter? Options:

  • make it a template parameter (caller always knows whether or not it wants hard errors)
  • make the caller process return value and raise error if needed (and however they want)

Definition at line 360 of file TypeDispatch.hpp.