1#ifndef TATOOINE_BINARY_OPERATION_FIELD_H
2#define TATOOINE_BINARY_OPERATION_FIELD_H
8template <
typename LHSInternalField,
typename RHSInternalField,
typename Op>
10 :
field<binary_operation_field<LHSInternalField, RHSInternalField, Op>,
11 common_type<field_real_type<LHSInternalField>,
12 field_real_type<RHSInternalField>>,
13 field_num_dimensions<LHSInternalField>,
14 std::invoke_result_t<Op,
15 field_tensor_type<LHSInternalField>,
16 field_tensor_type<RHSInternalField>>> {
17 static_assert(field_num_dimensions<LHSInternalField> ==
18 field_num_dimensions<RHSInternalField>);
26 field_num_dimensions<LHSInternalField>,
27 std::invoke_result_t<Op, field_tensor_type<LHSInternalField>,
47 :
m_lhs{std::move(other.m_lhs)},
48 m_rhs{std::move(other.m_rhs)},
49 m_op{std::move(other.m_op)} {}
51 template <
typename LHS,
typename Rhs,
typename Op_>
68 m_lhs = std::move(other.m_lhs);
69 m_rhs = std::move(other.m_rhs);
85 auto lhs() const -> auto const& {
86 if constexpr (is_pointer<LHSInternalField>) {
92 auto rhs() const -> auto const& {
93 if constexpr (is_pointer<RHSInternalField>) {
101 ->
void requires(is_pointer<LHSInternalField>) {
106 ->
void requires(is_pointer<RHSInternalField>) {
116template <
typename LHSInternalField,
typename LHSReal,
size_t N,
117 typename LHSTensor,
typename RHSInternalField,
typename RHSReal,
118 typename RHSTensor,
typename Op>
128template <
typename LHSInternalField,
typename LHSReal,
size_t N,
129 typename LHSTensor,
typename RHSInternalField,
typename RHSReal,
130 typename RHSTensor,
typename Op>
137 std::move(lhs), rhs, op};
140template <
typename LHSInternalField,
typename LHSReal,
size_t N,
141 typename LHSTensor,
typename RHSInternalField,
typename RHSReal,
142 typename RHSTensor,
typename Op>
149 lhs, std::move(rhs), op};
152template <
typename LHSInternalField,
typename LHSReal,
size_t N,
153 typename LHSTensor,
typename RHSInternalField,
typename RHSReal,
154 typename RHSTensor,
typename Op>
160 const Op&>{std::move(lhs), std::move(rhs), op};
163template <
typename LHSInternalField,
typename LHSReal,
size_t N,
164 typename LHSTensor,
typename RHSInternalField,
typename RHSReal,
165 typename RHSTensor,
typename Op>
175template <
typename LHSInternalField,
typename LHSReal,
size_t N,
176 typename LHSTensor,
typename RHSInternalField,
typename RHSReal,
177 typename RHSTensor,
typename Op>
184 std::move(lhs), rhs, std::move(op)};
187template <
typename LHSInternalField,
typename LHSReal,
size_t N,
188 typename LHSTensor,
typename RHSInternalField,
typename RHSReal,
189 typename RHSTensor,
typename Op>
199template <
typename LHSInternalField,
typename LHSReal,
size_t N,
200 typename LHSTensor,
typename RHSInternalField,
typename RHSReal,
201 typename RHSTensor,
typename Op>
207 Op>{std::move(lhs), std::move(rhs),
211template <
typename LHSReal,
size_t N,
typename LHSTensor,
typename RHSReal,
212 typename RHSTensor,
typename Op>
222template <
typename RealOut,
size_t NOut,
size_t... TensorDimsOut,
223 typename LHSReal,
size_t N,
typename LHSTensor,
typename RHSReal,
224 typename RHSTensor,
typename Op>
Definition: algorithm.h:6
typename common_type_impl< Ts... >::type common_type
Definition: common_type.h:23
constexpr auto make_binary_operation_field(const field< LHSInternalField, LHSReal, N, LHSTensor > &lhs, const field< RHSInternalField, RHSReal, N, RHSTensor > &rhs, const Op &op)
Definition: binary_operation_field.h:119
typename std::decay_t< std::remove_pointer_t< std::decay_t< Field > > >::real_type field_real_type
Definition: field_type_traits.h:10
static constexpr forward_tag forward
Definition: tags.h:9
static constexpr auto is_pointer
Definition: type_traits.h:22
typename std::decay_t< std::remove_pointer_t< std::decay_t< Field > > >::tensor_type field_tensor_type
Definition: field_type_traits.h:14
Definition: binary_operation_field.h:16
auto set_v0(LHSInternalField lhs) -> void requires(is_pointer< LHSInternalField >)
Definition: binary_operation_field.h:100
constexpr binary_operation_field(binary_operation_field &&other) noexcept
Definition: binary_operation_field.h:46
auto rhs() const -> auto const &
Definition: binary_operation_field.h:92
constexpr auto evaluate(pos_type const &x, real_type const t) const -> tensor_type final
Definition: binary_operation_field.h:81
constexpr binary_operation_field(binary_operation_field const &other)
Definition: binary_operation_field.h:43
constexpr binary_operation_field(LHS &&lhs, Rhs &&rhs, Op_ &&op)
Definition: binary_operation_field.h:52
LHSInternalField m_lhs
Definition: binary_operation_field.h:36
binary_operation_field< LHSInternalField, RHSInternalField, Op > this_type
Definition: binary_operation_field.h:21
Op m_op
Definition: binary_operation_field.h:38
RHSInternalField m_rhs
Definition: binary_operation_field.h:37
auto set_v1(RHSInternalField rhs) -> void requires(is_pointer< RHSInternalField >)
Definition: binary_operation_field.h:105
auto lhs() const -> auto const &
Definition: binary_operation_field.h:85
~binary_operation_field() override=default
constexpr auto operator=(binary_operation_field &&other) noexcept -> binary_operation_field &
Definition: binary_operation_field.h:66
auto fields_available() const -> bool requires(is_pointer< LHSInternalField > &&is_pointer< RHSInternalField >)
Definition: binary_operation_field.h:110
constexpr auto operator=(binary_operation_field const &other) -> binary_operation_field &
Definition: binary_operation_field.h:60
Real real_type
Definition: field.h:17
vec< real_type, NumDimensions > pos_type
Definition: field.h:20
Tensor tensor_type
Definition: field.h:18