6 #include "ddc_aliases.hpp"
8 template <
class FieldType,
class NDTypeSeq>
12 inline constexpr
bool enable_vector_field =
false;
15 inline constexpr
bool enable_borrowed_vector_field =
false;
18 inline constexpr
bool is_vector_field_v
19 = enable_vector_field<std::remove_const_t<std::remove_reference_t<T>>>;
22 inline constexpr
bool is_borrowed_vector_field_v
24 T> && (std::is_lvalue_reference_v<T> || enable_borrowed_vector_field<std::remove_cv_t<std::remove_reference_t<T>>>);
32 is_borrowed_vector_field_v<FieldDst> && is_borrowed_vector_field_v<FieldSrc>,
34 auto deepcopy(FieldDst&& dst, FieldSrc&& src)
36 static_assert(std::is_same_v<
37 typename std::remove_reference_t<FieldDst>::NDTypeTag,
38 typename std::remove_reference_t<FieldSrc>::NDTypeTag>);
40 assert(dst.idx_range().extents() == src.idx_range().extents());
43 return get_field(dst);
46 template <
class QueryTag,
class VectorFieldType>
47 inline constexpr
auto get(VectorFieldType&& field) noexcept
49 return field.template get<QueryTag>();
55 template <
class FieldType,
class... DDims>
58 static_assert(ddc::is_chunk_v<FieldType>);
59 using data_type =
typename FieldType::element_type;
64 typename ddc::detail::TaggedVector<std::remove_const_t<data_type>, DDims...>;
72 using discrete_domain_type =
typename FieldType::discrete_domain_type;
74 using index_range_type = discrete_domain_type;
77 using element_ref_type =
typename ddc::detail::TaggedVector<data_type&, DDims...>;
80 using NDTypeTag = ddc::detail::TypeSeq<DDims...>;
83 using chunk_span_type =
typename FieldType::span_type;
85 using chunk_view_type =
typename FieldType::view_type;
88 static constexpr std::size_t NDims =
sizeof...(DDims);
90 std::array<FieldType, NDims> m_values;
99 class = std::enable_if_t<std::conjunction_v<std::is_same<FieldTypes, FieldType>...>>,
102 std::bool_constant<ddc::is_borrowed_chunk_v<FieldTypes>>...>,
104 explicit VectorFieldCommon(FieldTypes&&... fields) : m_values {std::move(fields)...}
111 class = std::enable_if_t<std::conjunction_v<std::is_same<FieldTypes, FieldType>...>>,
113 std::conjunction_v<std::bool_constant<ddc::is_borrowed_chunk_v<FieldTypes>>...>,
116 : m_values {std::forward<FieldTypes>(fields)...}
121 constexpr index_range_type idx_range() const noexcept
123 return m_values[0].domain();
129 template <
class... QueryDDims>
130 constexpr IdxRange<QueryDDims...> idx_range() const noexcept
132 return ddc::select<QueryDDims...>(idx_range());
135 static constexpr
int rank() noexcept
137 return FieldType::rank();
140 template <
class FieldSrc>
141 void deepcopy(FieldSrc
const& src)
143 ((ddc::parallel_deepcopy(
144 m_values[ddc::type_seq_rank_v<DDims, NDTypeTag>].span_view(),
145 ddcHelper::get<DDims>(src))),
Definition: vector_field_common.hpp:9
A class which describes the real space in the temporal direction.
Definition: geometry.hpp:45