8#ifndef model_BilinearWeakSum_H_
9#define model_BilinearWeakSum_H_
22 template <
typename T1,
typename T2>
26 static_assert(std::is_same<typename T1::TrialFunctionType,typename T2::TrialFunctionType>::value,
"YOU ARE SUMMING BilinearWeakForms OF DIFFERENT TRIALFUNCTIONS.");
29 const std::shared_ptr<T1>
op1;
31 const std::shared_ptr<T2>
op2;
37 throw std::invalid_argument(
"Null FEM expression operand.");
43 if(!(
op2->field().sameField(
field())))
45 throw std::runtime_error(
"Cannot assemble expressions from different FEM field instances.");
47 std::vector<Eigen::Triplet<double> > gt1=
op1->globalTriplets();
48 std::vector<Eigen::Triplet<double> > gt2=
op2->globalTriplets();
51 std::make_move_iterator(gt2.begin()),
52 std::make_move_iterator(gt2.end())
61 throw std::runtime_error(
"Cannot combine different FEM fields.");
78 template<
class T1,
class T2, std::enable_if_t<std::is_base_of_v<BilinearWeakExpression<T1>,T1> && std::is_base_of_v<BilinearWeakExpression<T2>,T2>,
int> = 0>
79 auto operator+(
const std::shared_ptr<T1>&
x,
const std::shared_ptr<T2>&
y)
81 return std::make_shared<BilinearWeakSum<T1,T2>>(
x,
y);
Eigen::MatrixXd lowRankBilinearRows(const Form &form)
auto operator+(const std::shared_ptr< T1 > &x, const std::shared_ptr< T2 > &y)
T1::TrialFunctionType TrialFunctionType
const auto & field() const
Eigen::MatrixXd lowRankPenaltyRows() const
std::vector< Eigen::Triplet< double > > globalTriplets() const
BilinearWeakSum(std::shared_ptr< T1 > x, std::shared_ptr< T2 > y)
const std::shared_ptr< T1 > op1
const std::shared_ptr< T2 > op2