7 #ifndef NIHU_X2P_INTEGRAL_HPP_INCLUDED
8 #define NIHU_X2P_INTEGRAL_HPP_INCLUDED
15 #include "core/jacobian_computer.hpp"
19 #include <type_traits>
31 template <
class Operator,
class TestField>
34 template <
class Operator,
class TestField>
37 typedef typename std::decay<Operator>::type operator_t;
38 typedef TestField test_input_t;
39 typedef typename operator_t::trial_input_t trial_input_t;
40 typedef Eigen::Matrix<
41 typename scalar<typename operator_t::result_t>::type,
49 template <
class Operator,
class TestField>
52 ,
public fmm_operator<typename std::decay<Operator>::type::fmm_tag>
57 typedef typename std::decay<Operator>::type operator_t;
58 typedef TestField test_field_t;
60 typedef typename base_t::trial_input_t trial_input_t;
61 typedef typename base_t::test_input_t test_input_t;
62 typedef typename base_t::result_t result_t;
64 typedef typename test_field_t::elem_t
elem_t;
65 typedef typename test_field_t::nset_t nset_t;
68 typedef typename domain_t::xi_t xi_t;
73 static size_t const result_rows =
74 op_num_rows * nset_t::num_nodes;
77 : m_op(std::forward<Operator>(op))
78 , m_quadrature(unsigned(order))
82 size_t rows(test_input_t
const &)
const
87 size_t cols(trial_input_t
const &from)
const
89 return m_op.cols(from);
98 result_t
operator()(test_input_t
const &to, trial_input_t
const &from)
const
101 static bool printed =
false;
104 result_t mat = result_t::Zero(result_rows, cols(from));
105 elem_t
const &elem = to.get_elem();
107 for (
auto const &q : m_quadrature)
109 xi_t
const &xi = q.get_xi();
110 double w = q.get_w();
111 typename operator_t::test_input_t tsi(elem, xi);
113 auto N = (nset_t::template eval_shape<0>(xi) * (w * jac)).eval();
115 mat += create_kron_identity<op_num_rows>(N) * m_op(tsi, from);
119 mexPrintf(
"Size of kmat in m2p integral: %d x %d\n", mat.rows(), mat.cols());
123 auto op = m_op(tsi, from);
124 for (Eigen::Index i = 0; i < N.rows(); ++i)
125 mat.block(i * op_num_rows, 0, op_num_rows, cols(from)) += N(i, 0) * op;
129 mexPrintf(
"Size of op in m2p integral: %d x %d\n", op.rows(), op.cols());
140 quadrature_t m_quadrature;
146 template <
class Operator,
class TestField>
149 ,
public fmm_operator<typename std::decay<Operator>::type::fmm_tag>
152 typedef typename std::decay<Operator>::type operator_t;
153 typedef TestField test_field_t;
157 typedef typename base_t::trial_input_t trial_input_t;
158 typedef typename base_t::test_input_t test_input_t;
159 typedef typename base_t::result_t result_t;
161 typedef typename test_field_t::elem_t elem_t;
162 typedef typename test_field_t::nset_t nset_t;
165 typedef typename domain_t::xi_t xi_t;
168 static size_t const result_rows =
172 : m_op(std::forward<Operator>(op))
176 size_t rows(test_input_t
const &)
const
181 size_t cols(trial_input_t
const &from)
const
183 return m_op.cols(from);
186 result_t
operator()(test_input_t
const &to, trial_input_t
const &from)
const
188 result_t mat = result_t::Zero(result_rows, cols(from));
190 for (
size_t N = 0; N < nset_t::num_nodes; ++N)
193 xi_t
const &xi = nset_t::corner_at(N);
195 typename operator_t::test_input_t tsi(to.get_elem(), xi);
197 mat.block(N * M, 0, M, cols(from)) = m_op(tsi, from);
208 template <
class Operator,
class FieldTag>
210 create_x2p_integral(Operator &&op,
size_t order, FieldTag)