8#ifndef model_TrialProd_H_
9#define model_TrialProd_H_
26 template<
int rows1,
int cols1,
int rows2>
29 static_assert(cols1==rows2,
"YOU ARE MULTIPLYING TrialExpressionBaseS WITH DIFFERENT SIZE.");
30 constexpr static int rows=rows1;
36 constexpr static int rows=rows2;
42 constexpr static int rows=1;
45 template <
typename T1,
typename T2>
56 constexpr static int cols=T2::cols;
62 const std::shared_ptr<T1>
op1;
63 const std::shared_ptr<T2>
op2;
69 throw std::invalid_argument(
"Null FEM expression operand.");
76 return (*
op1)(ele,bary)*
op2->sfm(ele,bary);
82 const auto t1((*
op1)(ele,bary));
83 if constexpr(T1::rows==1 && T1::cols==1)
85 if constexpr(std::is_arithmetic_v<
decltype(
t1)>)
87 return t1*
op2->sfmGrad(ele,bary);
91 return t1(0,0)*
op2->sfmGrad(ele,bary);
96 Eigen::Matrix<double,T1::rows*dim,TrialGrad<T2>::rows> t1Ex(Eigen::Matrix<
double,T1::rows*
dim,
TrialGrad<T2>::rows>::Zero());
97 for(
int I=0;
I<T1::rows;++
I)
99 for(
int J=0;J<T1::cols;++J)
101 for(
int d=0;d<
dim;++d)
103 const int i(
I*
dim+d);
104 const int j(J*
dim+d);
109 return t1Ex*
op2->sfmGrad(ele,bary);
119 template<
class E,
class T, std::enable_if_t<std::is_base_of_v<EvalFunction<E>,E> && std::is_base_of_v<TrialExpressionBase<T>,T>,
int> = 0>
120 auto operator*(
const std::shared_ptr<E>&
e,
const std::shared_ptr<T>&
t)
122 return std::make_shared<TrialProd<E,T>>(
e,
t);
129 template<
int R,
int C,
class T>
130 auto operator*(
const Eigen::Matrix<double,R,C>&
c,
const std::shared_ptr<T>&
t)
static constexpr int rows
final point of the source segment t
auto operator*(const std::shared_ptr< BilinearForm< T1, T2 > > &f, const IntegrationDomain< FE, D, Q, Rule > &dom)
auto make_constant(const Eigen::Matrix< double, rows, cols > &c)
TrialExpressionBase()=default
Eigen::Matrix< double, rows, 1 > EvalMatrixType
ShapeFunctionMatrixType sfm(const ElementType &ele, const BaryType &bary) const
TypeTraits< TrialFunctionType >::BaryType BaryType
ShapeFunctionGradMatrixType sfmGrad(const ElementType &ele, const BaryType &bary) const
Eigen::Matrix< double, rows, dofPerElement > ShapeFunctionMatrixType
const auto & field() const
TrialBase< TrialFunctionType > TrialBaseType
Eigen::Matrix< double, rows *dim, dofPerElement > ShapeFunctionGradMatrixType
static constexpr int cols
const std::shared_ptr< MobileGradType > op2
const std::shared_ptr< FluxMatrix< dim > > op1
static constexpr int rows
static constexpr int dofPerElement
TypeTraits< TrialFunctionType >::ElementType ElementType
MobileGradType::TrialFunctionType TrialFunctionType
TrialProd(std::shared_ptr< T1 > x, std::shared_ptr< T2 > y)
static constexpr int rows
static constexpr int rows
static constexpr int rows