4 #include "multipatch_type.hpp"
8 inline constexpr
bool enable_multipatch_field =
false;
11 inline constexpr
bool is_multipatch_field_v
12 = enable_multipatch_field<std::remove_const_t<std::remove_reference_t<T>>>;
28 template <
template <
typename P>
typename T,
class... Patches>
32 (has_data_access_methods_v<
T<Patches>> && ...),
33 "The MultipatchField type should only contain instances of objects that can be "
34 "manipulated like fields.");
44 template <
class Patch>
48 template <
class Patch>
52 template <
class Patch>
55 template <
template <
typename P>
typename OT,
class... OPatches>
59 !is_mem_type_v<typename base_type::example_element>,
60 "For correct GPU handling a FieldMem object must be saved in a MultipatchFieldMem "
71 using memory_space =
typename base_type::example_element::memory_space;
73 using element_type =
typename base_type::example_element::element_type;
76 template <
class Patch>
101 template <
class MultipatchObj, std::enable_if_t<!is_mem_type_v<MultipatchObj>,
bool> = true>
103 :
base_type(std::move(
T<Patches>(other.template
get<Patches>()))...)
105 static_assert(is_multipatch_type_v<MultipatchObj>);
117 template <
class MultipatchObj, std::enable_if_t<is_mem_type_v<MultipatchObj>,
bool> = true>
119 :
base_type(std::move(
T<Patches>(other.template
get<Patches>()))...)
121 static_assert(is_multipatch_type_v<MultipatchObj>);
130 template <
template <
typename P>
typename OT,
class... OPatches>
132 :
base_type(std::make_tuple(other.template
get<Patches>()...))
135 std::is_same_v<ddc::detail::TypeSeq<Patches...>, ddc::detail::TypeSeq<OPatches...>>,
136 "Cannot create a MultipatchField from a temporary MultipatchField with a different "
139 std::is_same_v<std::tuple<
T<Patches>...>, std::tuple<OT<OPatches>...>>,
140 "MultipatchFields are not equivalent");
151 template <
class Patch>
152 KOKKOS_FUNCTION
auto get()
const
213 template <
template <
typename P>
typename T,
class... Patches>
214 inline constexpr
bool enable_multipatch_type<
MultipatchField<
T, Patches...>> =
true;
216 template <
template <
typename P>
typename T,
class... Patches>
217 inline constexpr
bool enable_data_access_methods<
MultipatchField<
T, Patches...>> =
true;
219 template <
template <
typename P>
typename T,
class... Patches>
220 inline constexpr
bool enable_multipatch_field<
MultipatchField<
T, Patches...>> =
true;
222 namespace ddcHelper {
229 template <
template <
typename P>
typename T1,
template <
typename P>
typename T2,
class... Patches>
233 (ddc::parallel_deepcopy(dst.template get<Patches>(), src.template get<Patches>()), ...);
235 (ddcHelper::deepcopy(dst.template get<Patches>(), src.template get<Patches>()), ...);
A class to store field objects on patches.
Definition: multipatch_field.hpp:30
typename base_type::example_element::element_type element_type
The type of the elements inside the field.
Definition: multipatch_field.hpp:73
typename T< Patch >::discrete_domain_type InternalIdxRangeOnPatch
An internal type alias that is only instantiated if the idx_range method is called.
Definition: multipatch_field.hpp:45
KOKKOS_FUNCTION MultipatchField(MultipatchObj &other)
Create a MultipatchField class by copying an instance of another compatible MultipatchField.
Definition: multipatch_field.hpp:102
typename T< Patch >::view_type InternalConstFieldOnPatch
An internal type alias that is only instantiated if the get_const_field method is called.
Definition: multipatch_field.hpp:53
MultipatchField(MultipatchField< OT, OPatches... > &&other)
Create a MultipatchField class from an r-value (temporary) instance of another MultipatchField which ...
Definition: multipatch_field.hpp:131
typename InternalIdxRangeOnPatch< Patch >::discrete_element_type idx_type
The type used to index the field on the specified patch.
Definition: multipatch_field.hpp:77
KOKKOS_FUNCTION auto get() const
Retrieve an object from the patch that it is defined on.
Definition: multipatch_field.hpp:152
KOKKOS_FUNCTION auto span_cview()
Get a MultipatchField containing constant fields so the values cannot be modified.
Definition: multipatch_field.hpp:207
KOKKOS_FUNCTION auto get_const_field() const
Get a MultipatchField containing constant fields so the values cannot be modified.
Definition: multipatch_field.hpp:195
MultipatchField(MultipatchObj &other)
Create a MultipatchField class from a compatible MultipatchFieldMem.
Definition: multipatch_field.hpp:118
KOKKOS_FUNCTION MultipatchField(T< Patches >... args)
Instantiate the MultipatchField class from an arbitrary number of objects.
Definition: multipatch_field.hpp:85
typename base_type::example_element::memory_space memory_space
The memory space (CPU/GPU) where the data is saved.
Definition: multipatch_field.hpp:71
KOKKOS_FUNCTION auto get_field()
Get a MultipatchField containing modifiable fields.
Definition: multipatch_field.hpp:173
auto idx_range() const
Get a MultipatchType containing the index ranges on which the fields are defined.
Definition: multipatch_field.hpp:162
KOKKOS_FUNCTION auto span_view()
Get a MultipatchField containing modifiable fields.
Definition: multipatch_field.hpp:185
typename T< Patch >::span_type InternalFieldOnPatch
An internal type alias that is only instantiated if the get_const_field method is called.
Definition: multipatch_field.hpp:49
A class to store several objects that are of a type which is templated by the patch.
Definition: multipatch_type.hpp:32
ddc::detail::TypeSeq< Patches... > PatchOrdering
A tag storing the order of Patches in this MultipatchType.
Definition: multipatch_type.hpp:35
std::tuple< T< Patches >... > m_tuple
The internal tuple containing the data.
Definition: multipatch_type.hpp:45
A class which describes the real space in the temporal direction.
Definition: geometry.hpp:45