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

A class to store field objects on patches. More...

Inheritance diagram for MultipatchField< T, Patches >:
MultipatchType< T, Patches... >

Public Types

using base_type = MultipatchType< T, Patches... >
 The MultipatchType from which this class inherits.
 
template<class Patch >
using InternalIdxRangeOnPatch = typename T< Patch >::discrete_domain_type
 An internal type alias that is only instantiated if the idx_range method is called.
 
template<class Patch >
using InternalFieldOnPatch = typename T< Patch >::span_type
 An internal type alias that is only instantiated if the get_const_field method is called.
 
template<class Patch >
using InternalConstFieldOnPatch = typename T< Patch >::view_type
 An internal type alias that is only instantiated if the get_const_field method is called.
 
using span_type = MultipatchField< InternalFieldOnPatch, Patches... >
 The type of a modifiable reference to this multipatch field.
 
using view_type = MultipatchField< InternalConstFieldOnPatch, Patches... >
 The type of a constant reference to this multipatch field.
 
using discrete_domain_type = MultipatchType< InternalIdxRangeOnPatch, Patches... >
 The type of the index ranges that can be used to access this field.
 
using memory_space = typename base_type::example_element::memory_space
 The memory space (CPU/GPU) where the data is saved.
 
using element_type = typename base_type::example_element::element_type
 The type of the elements inside the field.
 
template<class Patch >
using idx_type = typename InternalIdxRangeOnPatch< Patch >::discrete_element_type
 The type used to index the field on the specified patch.
 
- Public Types inherited from MultipatchType< T, Patches... >
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 MultipatchField (T< Patches >... args)
 Instantiate the MultipatchField class from an arbitrary number of objects. More...
 
template<class MultipatchObj , std::enable_if_t<!is_mem_type_v< MultipatchObj >, bool > = true>
KOKKOS_FUNCTION MultipatchField (MultipatchObj &other)
 Create a MultipatchField class by copying an instance of another compatible MultipatchField. More...
 
template<class MultipatchObj , std::enable_if_t< is_mem_type_v< MultipatchObj >, bool > = true>
 MultipatchField (MultipatchObj &other)
 Create a MultipatchField class from a compatible MultipatchFieldMem. More...
 
template<template< typename P > typename OT, class... OPatches>
 MultipatchField (MultipatchField< OT, OPatches... > &&other)
 Create a MultipatchField class from an r-value (temporary) instance of another MultipatchField which uses the same type for the internal tuple. More...
 
template<class Patch >
KOKKOS_FUNCTION auto get () const
 Retrieve an object from the patch that it is defined on. More...
 
auto idx_range () const
 Get a MultipatchType containing the index ranges on which the fields are defined. More...
 
KOKKOS_FUNCTION auto get_field ()
 Get a MultipatchField containing modifiable fields. More...
 
KOKKOS_FUNCTION auto span_view ()
 Get a MultipatchField containing modifiable fields. More...
 
KOKKOS_FUNCTION auto get_const_field () const
 Get a MultipatchField containing constant fields so the values cannot be modified. More...
 
KOKKOS_FUNCTION auto span_cview ()
 Get a MultipatchField containing constant fields so the values cannot be modified. More...
 
- Public Member Functions inherited from MultipatchType< T, Patches... >
KOKKOS_FUNCTION MultipatchType (T< Patches >... args)
 Instantiate the MultipatchType class from an arbitrary number of objects. More...
 
KOKKOS_FUNCTION MultipatchType (MultipatchType< OT, OPatches... > const &other)
 Create a MultipatchType class by copying an instance of another compatible MultipatchType. More...
 
 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...
 
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...
 

Additional Inherited Members

- Static Public Member Functions inherited from MultipatchType< T, Patches... >
static constexpr std::size_t size ()
 Get the number of objects stored inside the class. More...
 
- Protected Member Functions inherited from MultipatchType< T, Patches... >
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 inherited from MultipatchType< T, Patches... >
std::tuple< T< Patches >... > m_tuple
 The internal tuple containing the data.
 

Detailed Description

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

A class to store field objects on patches.

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 fields/derivative fields/vector fields 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.

Constructor & Destructor Documentation

◆ MultipatchField() [1/4]

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

Instantiate the MultipatchField class from an arbitrary number of objects.

Parameters
argsThe objects to be stored in the class.

◆ MultipatchField() [2/4]

template<template< typename P > typename T, class... Patches>
template<class MultipatchObj , std::enable_if_t<!is_mem_type_v< MultipatchObj >, bool > = true>
KOKKOS_FUNCTION MultipatchField< T, Patches >::MultipatchField ( MultipatchObj &  other)
inline

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

A compatible MultipatchField is one which uses all the patches used by this class. The object being copied may include more patches than this MultipatchField. Further the original MultipatchField 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 MultipatchField being copied.

◆ MultipatchField() [3/4]

template<template< typename P > typename T, class... Patches>
template<class MultipatchObj , std::enable_if_t< is_mem_type_v< MultipatchObj >, bool > = true>
MultipatchField< T, Patches >::MultipatchField ( MultipatchObj &  other)
inlineexplicit

Create a MultipatchField class from a compatible MultipatchFieldMem.

A compatible MultipatchField is one which uses all the patches used by this class. The object being copied may include more patches than this MultipatchField. Further the original MultipatchField must store objects of the correct type.

Parameters
otherThe MultipatchFieldMem being accessed.

◆ MultipatchField() [4/4]

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

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

Parameters
otherThe equivalent MultipatchField being copied.

Member Function Documentation

◆ get()

template<template< typename P > typename T, class... Patches>
template<class Patch >
KOKKOS_FUNCTION auto MultipatchField< 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.

◆ idx_range()

template<template< typename P > typename T, class... Patches>
auto MultipatchField< T, Patches >::idx_range ( ) const
inline

Get a MultipatchType containing the index ranges on which the fields are defined.

Returns
The set of index ranges on which the set of fields stored in this class are defined.

◆ get_field()

template<template< typename P > typename T, class... Patches>
KOKKOS_FUNCTION auto MultipatchField< T, Patches >::get_field ( )
inline

Get a MultipatchField containing modifiable fields.

Returns
A set of modifiable fields providing access to the fields stored in this class.

◆ span_view()

template<template< typename P > typename T, class... Patches>
KOKKOS_FUNCTION auto MultipatchField< T, Patches >::span_view ( )
inline

Get a MultipatchField containing modifiable fields.

This function matches the DDC name to allow the global get_const_field to be defined.

Returns
A set of modifiable fields providing access to the fields stored in this class.

◆ get_const_field()

template<template< typename P > typename T, class... Patches>
KOKKOS_FUNCTION auto MultipatchField< T, Patches >::get_const_field ( ) const
inline

Get a MultipatchField containing constant fields so the values cannot be modified.

Returns
A set of constant fields providing access to the fields stored in this class.

◆ span_cview()

template<template< typename P > typename T, class... Patches>
KOKKOS_FUNCTION auto MultipatchField< T, Patches >::span_cview ( )
inline

Get a MultipatchField containing constant fields so the values cannot be modified.

This function matches the DDC name to allow the global get_const_field to be defined.

Returns
A set of constant fields providing access to the fields stored in this class.

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