OPALX (Object Oriented Parallel Accelerator Library for Exascale) MINIorX
OPALX
TypeUtils.h File Reference
#include <Kokkos_Core.hpp>
#include "Types/Variant.h"
#include "Utility/IpplException.h"
Include dependency graph for TypeUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ippl::detail::IsUnique< Check, Collection >
 
struct  ippl::detail::WrapUnique< Wrapper >
 
struct  ippl::detail::WrapUnique< Wrapper >::Verifier< Check, Collection >
 
struct  ippl::detail::IsEnabled< Type,... >
 
struct  ippl::detail::ConstructVariant< std::variant<>, std::variant<>, Verifier >
 
struct  ippl::detail::ConstructVariant< std::variant<>, std::variant< T... >, Verifier >
 
struct  ippl::detail::ConstructVariant< std::variant< Next, ToAdd... >, std::variant< Added... >, Verifier >
 
struct  ippl::detail::Forward< Type, std::variant< Spaces... > >
 
struct  ippl::detail::Forward< Type, Kokkos::View< T, Properties... > >
 
struct  ippl::detail::CreateUniformType< Type, View >
 
struct  ippl::detail::TypeForAllSpaces< Type >
 
class  ippl::detail::MultispaceContainer< Type, Spaces >
 
struct  ippl::detail::ContainerForAllSpaces< Type >
 

Namespaces

namespace  ippl
 Implementations for FFT constructor/destructor and transforms.
 
namespace  ippl::detail
 

Typedefs

template<bool B, typename T >
using ippl::detail::ConditionalType = std::conditional_t< B, T, void >
 
template<typename... Types>
using ippl::detail::VariantFromConditionalTypes = typename ConstructVariant< std::variant< Types... >, std::variant<>, IsEnabled >::type
 
template<typename... Types>
using ippl::detail::VariantFromUniqueTypes = typename ConstructVariant< std::variant< Types... >, std::variant<>, IsUnique >::type
 
template<template< typename... > class Verifier, typename... Types>
using ippl::detail::VariantWithVerifier = typename ConstructVariant< std::variant< Types... >, std::variant<>, Verifier >::type
 

Functions

template<typename Functor >
void ippl::detail::runForAllSpaces (Functor &&f)
 

Class Documentation

◆ ippl::detail::WrapUnique

struct ippl::detail::WrapUnique
template<template< typename > class Wrapper>
struct ippl::detail::WrapUnique< Wrapper >

Defines a variant verification struct Performs the same check as IsUnique, but instead of using the provided types directly, the types are wrapped in another provided type. For example, if the wrapper type is std::shared_ptr and the types are <int, float, int>, then the final variant will allow std::shared_ptr<int> and std::shared_ptr<float>.

Template Parameters
Wrapperthe wrapper type

Definition at line 39 of file TypeUtils.h.

Collaboration diagram for ippl::detail::WrapUnique< Wrapper >:
Collaboration graph

◆ ippl::detail::ConstructVariant< std::variant<>, std::variant<>, Verifier >

struct ippl::detail::ConstructVariant< std::variant<>, std::variant<>, Verifier >
template<template< typename... > class Verifier>
struct ippl::detail::ConstructVariant< std::variant<>, std::variant<>, Verifier >

Base case for variant construction with no types to add

Definition at line 81 of file TypeUtils.h.

Collaboration diagram for ippl::detail::ConstructVariant< std::variant<>, std::variant<>, Verifier >:
Collaboration graph
Class Members
typedef variant type

◆ ippl::detail::ConstructVariant< std::variant<>, std::variant< T... >, Verifier >

struct ippl::detail::ConstructVariant< std::variant<>, std::variant< T... >, Verifier >
template<typename... T, template< typename... > class Verifier>
struct ippl::detail::ConstructVariant< std::variant<>, std::variant< T... >, Verifier >

Base case for a fully constructed variant

Template Parameters
T...the types to be included in the variant

Definition at line 90 of file TypeUtils.h.

Collaboration diagram for ippl::detail::ConstructVariant< std::variant<>, std::variant< T... >, Verifier >:
Collaboration graph
Class Members
typedef variant< T... > type

◆ ippl::detail::ConstructVariant< std::variant< Next, ToAdd... >, std::variant< Added... >, Verifier >

struct ippl::detail::ConstructVariant< std::variant< Next, ToAdd... >, std::variant< Added... >, Verifier >
template<typename Next, typename... ToAdd, typename... Added, template< typename... > class Verifier>
struct ippl::detail::ConstructVariant< std::variant< Next, ToAdd... >, std::variant< Added... >, Verifier >

Constructs a variant type containing all the provided types that fulfill a certain condition. This is done by recursively adding types to the variant based on the inclusion criteria.

The default verification struct is IsPresent defined above, which includes the type if it has not already been added to the variant before. This is useful if the provided types include duplicates, e.g. if they are type aliases that can sometimes refer to the same type. In particular, Kokkos memory spaces can sometimes have different names but refer to the same memory space. Variants do not allow duplicate types to appear in their parameter packs; each type may only appear once.

The verification struct can be user defined as long as it conforms to the variant verification struct interface. The struct must accept at least a parameter pack; the first parameter is the type currently being checked and the rest are the types already added to the variant. The struct must expose a boolean enable that indicates whether the next type should be included in the variant. The struct must also expose a type type, which is the type to be added to the variant

Template Parameters
Nextthe next type to add to the variant
ToAdd...the remaining types waiting to be added to the variant
Added...the types that have already been added to the variant
Verifierthe variant verification struct

Definition at line 121 of file TypeUtils.h.

Collaboration diagram for ippl::detail::ConstructVariant< std::variant< Next, ToAdd... >, std::variant< Added... >, Verifier >:
Collaboration graph
Class Members
typedef Verifier< Next, Added... > Check
typedef conditional_t< B, T, F > cond
typedef cond< enable, typename ConstructVariant< variant< ToAdd... >, variant< typename type, Added... >, Verifier >::type, typename ConstructVariant< variant< ToAdd... >, variant< Added... >, Verifier >::type > type
typedef variant< T... > variant

◆ ippl::detail::Forward< Type, std::variant< Spaces... > >

struct ippl::detail::Forward< Type, std::variant< Spaces... > >
template<template< typename... > class Type, typename... Spaces>
struct ippl::detail::Forward< Type, std::variant< Spaces... > >

Forwards the types in a variant to another type

Definition at line 183 of file TypeUtils.h.

Collaboration diagram for ippl::detail::Forward< Type, std::variant< Spaces... > >:
Collaboration graph
Class Members
typedef Type< Spaces... > type

◆ ippl::detail::Forward< Type, Kokkos::View< T, Properties... > >

struct ippl::detail::Forward< Type, Kokkos::View< T, Properties... > >
template<template< typename... > class Type, typename T, typename... Properties>
struct ippl::detail::Forward< Type, Kokkos::View< T, Properties... > >

Forwards the properties of a Kokkos view to another type

Definition at line 191 of file TypeUtils.h.

Collaboration diagram for ippl::detail::Forward< Type, Kokkos::View< T, Properties... > >:
Collaboration graph
Class Members
typedef Type< Properties... > type

◆ ippl::detail::CreateUniformType

struct ippl::detail::CreateUniformType
template<template< typename... > class Type, typename View>
struct ippl::detail::CreateUniformType< Type, View >

Constructs a uniform type based on Kokkos views' uniform types (i.e. a type where all optional template parameters are explicitly specified)

Template Parameters
Typethe type to specialize
Viewthe view type

Definition at line 203 of file TypeUtils.h.

Collaboration diagram for ippl::detail::CreateUniformType< Type, View >:
Collaboration graph
Class Members
typedef typename type type
typedef typename uniform_type view_type

◆ ippl::detail::TypeForAllSpaces

struct ippl::detail::TypeForAllSpaces
template<template< typename... > class Type>
struct ippl::detail::TypeForAllSpaces< Type >

Instantiates a parameter pack with all the available Kokkos memory spaces

Definition at line 212 of file TypeUtils.h.

Collaboration diagram for ippl::detail::TypeForAllSpaces< Type >:
Collaboration graph
Class Members
typedef typename type exec_spaces_type
typedef typename type memory_spaces_type
typedef VariantFromUniqueTypes< DefaultExecutionSpace > unique_exec_spaces
typedef VariantFromUniqueTypes< HostSpace, SharedSpace, SharedHostPinnedSpace > unique_memory_spaces