7 #ifndef NIHU_P2X_INTEGRAL_HPP_INCLUDED
8 #define NIHU_P2X_INTEGRAL_HPP_INCLUDED
14 #include "core/jacobian_computer.hpp"
18 #include <type_traits>
29 template <
class Operator,
class TrialField>
33 template <
class Operator,
class TrialField>
36 typedef typename std::decay<Operator>::type operator_t;
37 typedef typename operator_t::test_input_t test_input_t;
38 typedef TrialField trial_input_t;
39 typedef Eigen::Matrix<
40 typename scalar<typename operator_t::result_t>::type,
47 template <
class Operator,
class TrialField>
50 ,
public fmm_operator<typename std::decay<Operator>::type::fmm_tag>
53 typedef typename std::decay<Operator>::type operator_t;
54 typedef TrialField trial_field_t;
56 typedef typename trial_field_t::elem_t
elem_t;
57 typedef typename trial_field_t::nset_t nset_t;
59 typedef typename operator_t::test_input_t test_input_t;
60 typedef trial_field_t trial_input_t;
63 typedef typename domain_t::xi_t xi_t;
66 typedef typename operator_t::result_t op_result_t;
69 static size_t const result_cols = op_num_cols * nset_t::num_nodes;
70 typedef Eigen::Matrix<
71 typename scalar<typename operator_t::result_t>::type,
72 op_num_rows, result_cols
76 : m_op(std::forward<Operator>(op))
77 , m_quadrature(unsigned(order))
81 size_t rows(test_input_t
const &to)
const
86 size_t cols(trial_input_t
const &)
const
91 result_t operator()(test_input_t
const &to, trial_field_t
const &field)
const
93 result_t mat = result_t::Zero(rows(to), cols(field));
94 elem_t const &elem = field.get_elem();
95 for (
auto const &q : m_quadrature)
97 xi_t
const &xi = q.get_xi();
98 auto N = nset_t::template eval_shape<0>(xi);
100 double w = q.get_w();
101 typename operator_t::trial_input_t tri(elem, xi);
102 double jac = jacobian_computer<elem_t>::eval(elem, xi);
103 auto K = m_op(to, tri);
104 for (Eigen::Index i = 0; i < nset_t::num_nodes; ++i)
105 mat.block(0, i*op_num_cols,
K.rows(), op_num_cols) +=
107 * (N(i, 0) * Eigen::Matrix<double, op_num_cols, op_num_cols>::Identity())
115 quadrature_t m_quadrature;
118 template <
class Operator,
class TrialFieldTag>
119 p2x_integral<Operator, typename tag2type<TrialFieldTag>::type>
120 create_p2x_integral(Operator &&op,
size_t order, TrialFieldTag)
122 typedef typename tag2type<TrialFieldTag>::type TrialField;
123 return p2x_integral<Operator, TrialField>(std::forward<Operator>(op), order);