11 #ifndef BEMBEL_SRC_AUGMENTEDEFIE_INCIDENCEMATRIX_HPP_
12 #define BEMBEL_SRC_AUGMENTEDEFIE_INCIDENCEMATRIX_HPP_
18 template <
typename Derived_vec,
typename Derived>
20 typedef Eigen::SparseMatrix<typename LinearOperatorTraits<Derived>::Scalar>
22 typedef Eigen::Matrix<typename LinearOperatorTraits<Derived>::Scalar,
37 "Scalar Types need to be equal");
38 init_IncidenceMatrix(ansatz_space_vec, ansatz_space);
45 ansatz_space_vec_ = ansatz_space_vec;
46 ansatz_space_ = ansatz_space;
61 const auto &number_of_elements = element_tree.get_number_of_elements();
62 const auto polynomial_degree_plus_one_squared_vec =
63 super_space_vec.get_polynomial_degree_plus_one_squared();
64 const auto polynomial_degree_plus_one_squared =
65 super_space.get_polynomial_degree_plus_one_squared();
68 typedef Eigen::Triplet<typename LinearOperatorTraits<Derived>::Scalar> T;
69 std::vector<T> tripletList;
70 tripletList.reserve(2 * polynomial_degree_plus_one_squared_vec *
71 polynomial_degree_plus_one_squared *
75 for (
auto element = element_tree.cpbegin(); element != element_tree.cpend();
77 Eigen::Matrix<typename LinearOperatorTraits<Derived>::Scalar,
78 Eigen::Dynamic, Eigen::Dynamic>
79 intval(2 * polynomial_degree_plus_one_squared_vec,
80 polynomial_degree_plus_one_squared);
83 for (
auto i = 0; i < Q.w_.size(); ++i) {
85 super_space.
map2surface(*element, Q.xi_.col(i), Q.w_(i), &qp);
86 evaluateIntegrand(super_space_vec, super_space, qp, &intval);
89 for (
auto jj = 0; jj < polynomial_degree_plus_one_squared; ++jj)
90 for (
auto i = 0; i < 2; ++i)
91 for (
auto ii = 0; ii < polynomial_degree_plus_one_squared_vec; ++ii)
92 tripletList.push_back(
93 T(polynomial_degree_plus_one_squared_vec *
94 (i * number_of_elements + element->id_) +
96 polynomial_degree_plus_one_squared * element->id_ + jj,
97 intval(i * polynomial_degree_plus_one_squared_vec + ii, jj)));
99 incidence_matrix_.resize(
100 2 * polynomial_degree_plus_one_squared_vec * number_of_elements,
101 polynomial_degree_plus_one_squared * number_of_elements);
102 incidence_matrix_.setFromTriplets(tripletList.begin(), tripletList.end());
104 auto projector = ansatz_space_.get_transformation_matrix();
106 projector_vec.transpose() * (incidence_matrix_ * projector);
112 const MatrixType &get_incidence_matrix()
const {
return incidence_matrix_; }
117 template <
class T_vec,
class T>
118 void evaluateIntegrand(
119 const T_vec &super_space_vec,
const T &super_space,
const SurfacePoint &p,
121 Eigen::Dynamic, Eigen::Dynamic> *intval) {
122 const auto polynomial_degree_plus_one_squared_vec =
123 super_space_vec.get_polynomial_degree_plus_one_squared();
127 VectorType intval_scal =
128 super_space.basis(p.segment<2>(0)).array().real();
129 VectorType intval_dx = super_space_vec.basisDx(p.segment<2>(0));
130 VectorType intval_dy = super_space_vec.basisDy(p.segment<2>(0));
131 VectorType intval_div(2 * polynomial_degree_plus_one_squared_vec);
132 intval_div << intval_dx, intval_dy;
135 const unsigned int elements_per_direction =
136 (1 << super_space.get_refinement_level());
137 const double h = 1. / ((double)(elements_per_direction));
140 double x_kappa = p.segment<3>(6).cross(p.segment<3>(9)).norm();
142 intval[0] += w * intval_div * intval_scal.transpose();
144 MatrixType incidence_matrix_;
const Eigen::SparseMatrix< double > & get_transformation_matrix() const
Retrieves the transformation matrix associated with this AnsatzSpace.
const SuperSpace< Derived > & get_superspace() const
Retrieves the reference to the SuperSpace associated with this AnsatzSpace.
ElementTree & get_element_tree()
getter
Eigen::Matrix< double, 12, 1 > SurfacePoint
typedef of SurfacePoint
Routines for the evalutation of pointwise errors.
struct containing specifications on the linear operator has to be specialized or derived for any part...
The superspace manages local polynomial bases on each element of the mesh and provides an interface t...
void map2surface(const ElementTreeNode &e, const Eigen::Vector2d &xi, double w, SurfacePoint *surf_pt) const
Evaluation of a point in the element and its Jacobian matrix.