2#ifndef model_TrialSum_H_
3#define model_TrialSum_H_
10 template<
class T1,
class T2>
17 static constexpr int rows=T1::rows;
18 static constexpr int cols=T1::cols;
19 static_assert(std::is_same_v<TrialFunctionType,typename T2::TrialFunctionType>);
20 static_assert(
rows==T2::rows &&
cols==T2::cols);
21 const std::shared_ptr<T1>
op1;
22 const std::shared_ptr<T2>
op2;
28 throw std::invalid_argument(
"Null FEM sum operand.");
30 if(!
op1->field().sameField(
op2->field()))
32 throw std::invalid_argument(
"Cannot add trial expressions of different FEM fields.");
45 return (
op1->sfmGrad(
e,
b)+
op2->sfmGrad(
e,
b)).eval();
49 return (
op1->sfmDef(
e,
b)+
op2->sfmDef(
e,
b)).eval();
52 template<
class T1,
class T2, std::enable_if_t<std::is_base_of_v<TrialExpressionBase<T1>,T1> && std::is_base_of_v<TrialExpressionBase<T2>,T2>,
int> = 0>
53 auto operator+(
const std::shared_ptr<T1>&
x,
const std::shared_ptr<T2>&
y)
55 return std::make_shared<TrialSum<T1,T2>>(
x,
y);
auto operator+(const std::shared_ptr< T1 > &x, const std::shared_ptr< T2 > &y)
TrialExpressionBase()=default
auto sfmGrad(const ElementType &e, const BaryType &b) const
typename T1::TrialFunctionType TrialFunctionType
auto sfmDef(const ElementType &e, const BaryType &b) const
TrialSum(std::shared_ptr< T1 > x, std::shared_ptr< T2 > y)
const auto & field() const
static constexpr int rows
const std::shared_ptr< T1 > op1
typename T1::ElementType ElementType
ShapeFunctionMatrixType sfm(const ElementType &e, const BaryType &b) const
const std::shared_ptr< T2 > op2
static constexpr int cols
typename T1::ShapeFunctionMatrixType ShapeFunctionMatrixType
typename T1::BaryType BaryType