Gyselalib++
MultipatchType< T, Patches > Class Template Reference

A class to store several objects that are of a type which is templated by the patch. More...

Inheritance diagram for MultipatchType< T, Patches >:
MultipatchField< ConstSplineCoeffOnPatch_2D, Patch1, Patch2 >

Public Types

using PatchOrdering = ddc::detail::TypeSeq< Patches... >
 A tag storing the order of Patches in this MultipatchType.
 
using example_element = T< ddc::type_seq_element_t< 0, PatchOrdering > >
 The type of one of the elements of the MultipatchType. More...
 

Public Member Functions

KOKKOS_FUNCTION MultipatchType (T< Patches >... args)
 Instantiate the MultipatchType class from an arbitrary number of objects. More...
 
template<template< typename P > typename OT, class... OPatches>
KOKKOS_FUNCTION MultipatchType (MultipatchType< OT, OPatches... > const &other)
 Create a MultipatchType class by copying an instance of another compatible MultipatchType. More...
 
template<template< typename P > typename OT, class... OPatches>
 MultipatchType (MultipatchType< OT, OPatches... > &&other)
 Create a MultipatchType class from an r-value (temporary) instance of another MultipatchType which uses the same type for the internal tuple. More...
 
template<class Patch , std::enable_if_t<!has_data_access_methods_v< T< Patch >>, bool > = true>
KOKKOS_FUNCTION T< Patchget () const
 Retrieve an object from the patch that it is defined on. More...
 
KOKKOS_FUNCTION std::tuple< T< Patches >... > const & get_tuple () const
 Get a constant reference to the tuple of objects stored inside this MultipatchType. More...
 

Static Public Member Functions

static constexpr std::size_t size ()
 Get the number of objects stored inside the class. More...
 

Protected Member Functions

KOKKOS_FUNCTION MultipatchType (std::tuple< T< Patches >... > &&tuple)
 A constructor for sub-classes which can build the necessary tuple directly following their own rules. More...
 

Protected Attributes

std::tuple< T< Patches >... > m_tuple
 The internal tuple containing the data.
 

Detailed Description

template<template< typename P > typename T, class... Patches>
class MultipatchType< T, Patches >

A class to store several objects that are of a type which is templated by the patch.

On a multipatch domain when we have objects and types defined on different patches, e.g. fields. They can be stored in this class and then be accessed by the patch they are defined on.

Template Parameters
TThe type of the objects that are stored on the given patches.
PatchesThe patches of the objects in the same order of the patches that the given objects are defined on.
Warning
The objects have to be defined on different patches. Otherwise retrieving them by their patch is ill-defined.

Member Typedef Documentation

◆ example_element

template<template< typename P > typename T, class... Patches>
using MultipatchType< T, Patches >::example_element = T<ddc::type_seq_element_t<0, PatchOrdering> >

The type of one of the elements of the MultipatchType.

This can be used to check that types are as expected using functions such as ddc::is_chunk_v.

Constructor & Destructor Documentation

◆ MultipatchType() [1/4]

template<template< typename P > typename T, class... Patches>
KOKKOS_FUNCTION MultipatchType< T, Patches >::MultipatchType ( std::tuple< T< Patches >... > &&  tuple)
inlineexplicitprotected

A constructor for sub-classes which can build the necessary tuple directly following their own rules.

Parameters
tupleThe internal tuple.

◆ MultipatchType() [2/4]

template<template< typename P > typename T, class... Patches>
KOKKOS_FUNCTION MultipatchType< T, Patches >::MultipatchType ( T< Patches >...  args)
inlineexplicit

Instantiate the MultipatchType class from an arbitrary number of objects.

Parameters
argsThe objects to be stored in the class.

◆ MultipatchType() [3/4]

template<template< typename P > typename T, class... Patches>
template<template< typename P > typename OT, class... OPatches>
KOKKOS_FUNCTION MultipatchType< T, Patches >::MultipatchType ( MultipatchType< OT, OPatches... > const &  other)
inline

Create a MultipatchType class by copying an instance of another compatible MultipatchType.

A compatible MultipatchType is one which uses all the patches used by this class. The object being copied may include more patches than this MultipatchType. Further the original MultipatchType must store objects of the correct type (the type template may be different but return the same type depending on how it is designed.

This function is not explicit as it is helpful to be able to change between equivalent multipatch definitions if the internal type is the same but the definition comes from different locations in the code.

Parameters
otherThe equivalent MultipatchType being copied.

◆ MultipatchType() [4/4]

template<template< typename P > typename T, class... Patches>
template<template< typename P > typename OT, class... OPatches>
MultipatchType< T, Patches >::MultipatchType ( MultipatchType< OT, OPatches... > &&  other)
inline

Create a MultipatchType class from an r-value (temporary) instance of another MultipatchType which uses the same type for the internal tuple.

Parameters
otherThe equivalent MultipatchType being copied.

Member Function Documentation

◆ get()

template<template< typename P > typename T, class... Patches>
template<class Patch , std::enable_if_t<!has_data_access_methods_v< T< Patch >>, bool > = true>
KOKKOS_FUNCTION T<Patch> MultipatchType< T, Patches >::get ( ) const
inline

Retrieve an object from the patch that it is defined on.

Template Parameters
PatchThe patch of the object to be returned.
Returns
The object on the given patch.

◆ size()

template<template< typename P > typename T, class... Patches>
static constexpr std::size_t MultipatchType< T, Patches >::size ( )
inlinestaticconstexpr

Get the number of objects stored inside the class.

This is equal to the number of patches.

Returns
Number of elements stored in the tuple of the class.

◆ get_tuple()

template<template< typename P > typename T, class... Patches>
KOKKOS_FUNCTION std::tuple<T<Patches>...> const& MultipatchType< T, Patches >::get_tuple ( ) const
inline

Get a constant reference to the tuple of objects stored inside this MultipatchType.

Returns
A constant reference to the tuple of objects stored inside this MultipatchType.

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