6 #include "ddc_alias_inline_functions.hpp"
7 #include "ddc_aliases.hpp"
8 #include "vector_field_common.hpp"
17 class MemSpace = Kokkos::DefaultExecutionSpace::memory_space>
21 template <
class ElementType,
class IdxRangeType,
class DimSeq,
class MemSpace>
23 enable_vector_field<VectorFieldMem<ElementType, IdxRangeType, DimSeq, MemSpace>> =
true;
25 template <
class ElementType,
class IdxRangeType,
class DimSeq,
class Allocator>
26 inline constexpr
bool enable_data_access_methods<
29 template <
class ElementType,
class IdxRangeType,
class DimSeq,
class Allocator>
31 enable_mem_type<VectorFieldMem<ElementType, IdxRangeType, DimSeq, Allocator>> =
true;
36 template <
class,
class,
class,
class,
class>
51 template <
class ElementType,
class IdxRangeType,
class NDTag,
class MemSpace>
63 using chunk_type = FieldMem<ElementType, IdxRangeType, MemSpace>;
70 using typename base_type::element_type;
72 using typename base_type::NDTypeTag;
74 using typename base_type::chunk_span_type;
75 using typename base_type::chunk_view_type;
78 using Allocator = ddc::KokkosAllocator<ElementType, MemSpace>;
91 std::experimental::layout_right>;
103 std::experimental::layout_right>;
121 template <std::size_t... Is>
125 std::index_sequence<Is...>
const&)
134 template <
class... ODDims,
typename T,
T... ints>
135 element_type operator()(Idx<ODDims...>
const& delems, std::integer_sequence<T, ints...>)
138 return element_type((base_type::m_values[ints](delems))...);
220 template <
class... ODDims>
221 element_type
operator()(Idx<ODDims>
const&... delems)
const noexcept
223 Idx<ODDims...> delem_idx(delems...);
225 operator()(delem_idx, std::make_integer_sequence<
int, element_type::size()> {});
232 template <
class... ODDims,
class = std::enable_if_t<
sizeof...(ODDims) != 1>>
233 element_type
operator()(Idx<ODDims...>
const& delems)
const noexcept
235 return this->operator()(delems, std::make_integer_sequence<
int, element_type::size()> {});
249 template <
class... QueryDDims>
265 template <
class... QueryDDims>
280 template <
class... QueryDDims>
281 auto operator[](IdxRange<QueryDDims...>
const& oidx_range)
const
295 template <
class... QueryDDims>
306 template <
class QueryTag>
307 inline constexpr chunk_span_type
get() noexcept
310 ddc::in_tags_v<QueryTag, NDTypeTag>,
311 "requested Tag absent from TaggedVector");
312 return base_type::m_values[ddc::type_seq_rank_v<QueryTag, NDTypeTag>].span_view();
320 template <
class QueryTag>
321 inline constexpr chunk_view_type
get() const noexcept
324 ddc::in_tags_v<QueryTag, NDTypeTag>,
325 "requested Tag absent from TaggedVector");
326 return base_type::m_values[ddc::type_seq_rank_v<QueryTag, NDTypeTag>].span_cview();
Definition: vector_field_common.hpp:9
Pre-declaration of VectorFieldMem.
Definition: vector_field_mem.hpp:54
view_type span_view() const
Get a constant reference to this vector field.
Definition: vector_field_mem.hpp:198
element_type operator()(Idx< ODDims > const &... delems) const noexcept
Element access using a list of Idxs.
Definition: vector_field_mem.hpp:221
VectorFieldMem(VectorFieldMem const &other)=delete
Deleted: use deepcopy instead.
auto operator[](Idx< QueryDDims... > const &slice_spec)
Slice out some dimensions.
Definition: vector_field_mem.hpp:266
constexpr chunk_span_type get() noexcept
Get the Field describing the component in the QueryTag direction.
Definition: vector_field_mem.hpp:307
auto operator[](IdxRange< QueryDDims... > const &oidx_range) const
Slice out some dimensions.
Definition: vector_field_mem.hpp:281
VectorField< const ElementType, IdxRangeType, NDTag, MemSpace, std::experimental::layout_right > view_type
A type which can hold a constant reference to this VectorFieldMem.
Definition: vector_field_mem.hpp:103
VectorFieldMem(VectorFieldMem &&other)=default
Constructs a new VectorFieldMem by move.
auto operator[](Idx< QueryDDims... > const &slice_spec) const
Slice out some dimensions.
Definition: vector_field_mem.hpp:250
VectorField< ElementType, IdxRangeType, NDTag, MemSpace, std::experimental::layout_right > span_type
A type which can hold a reference to this VectorFieldMem.
Definition: vector_field_mem.hpp:91
FieldMem< ElementType, IdxRangeType, MemSpace > chunk_type
Type describing the object which can be extracted from this VectorFieldMem using the get<> function.
Definition: vector_field_mem.hpp:63
VectorFieldMem & operator=(VectorFieldMem &&other)=default
Move-assigns a new value to this VectorField.
VectorFieldMem(index_range_type const &idx_range, Allocator allocator=Allocator())
Construct a VectorFieldMem on an index range with uninitialized values.
Definition: vector_field_mem.hpp:151
auto operator[](IdxRange< QueryDDims... > const &oidx_range)
Slice out some dimensions.
Definition: vector_field_mem.hpp:296
typename chunk_type::memory_space memory_space
The type of the memory space where the field is saved (CPU vs GPU).
Definition: vector_field_mem.hpp:117
view_type span_cview() const
Get a constant reference to this vector field.
Definition: vector_field_mem.hpp:185
ddc::KokkosAllocator< ElementType, MemSpace > Allocator
The type of allocator that will be used to allocate the data.
Definition: vector_field_mem.hpp:78
discrete_domain_type index_range_type
The IdxRange on which the fields in this object are defined.
Definition: vector_field_mem.hpp:112
VectorFieldMem()=default
Empty VectorFieldMem.
typename base_type::discrete_domain_type discrete_domain_type
The type of the index range on which the field is defined.
Definition: vector_field_mem.hpp:110
span_type span_view()
Get a modifiable reference to this vector field.
Definition: vector_field_mem.hpp:211
constexpr chunk_view_type get() const noexcept
Get the Field describing the component in the QueryTag direction.
Definition: vector_field_mem.hpp:321
VectorFieldMem & operator=(VectorFieldMem const &other)=delete
Deleted: use deepcopy instead.
A class which holds multiple (scalar) fields in order to represent a vector field.
Definition: vector_field.hpp:64
A class which describes the real space in the temporal direction.
Definition: geometry.hpp:45