11#ifndef BEMBEL_SRC_ANSATZSPACE_PROJECTOR_HPP_
12#define BEMBEL_SRC_ANSATZSPACE_PROJECTOR_HPP_
15namespace ProjectorRoutines {
19template <
typename Derived,
unsigned int DF>
21 static Eigen::SparseMatrix<double> makeMatrix(
24 assert(
false &&
"This needs to be specialized");
25 return Eigen::SparseMatrix<double>(1, 1);
39template <
typename Derived>
76 dofs_before_projector_ = projector_.rows();
77 dofs_after_projector_ = projector_.cols();
112 Eigen::SparseMatrix<double> makeProjectionMatrix(
121 int knot_repetition_;
122 int dofs_before_projector_;
123 int dofs_after_projector_;
124 Eigen::SparseMatrix<double> projector_;
132namespace ProjectorRoutines {
140 std::vector<double> vals;
141 std::vector<int> rows;
142 std::vector<int> cols;
147template <
typename Derived>
165inline _proj_info makeLocalProjectionTriplets(
171 "superSpace not suitable for desired ansatz space -> polynomial "
177 const int n = (1 <<
M);
178 const int patch_number =
super_space.get_number_of_patches();
204 std::vector<double>
mask =
210 "projector.cpp: System needs to be square");
218 double vals_y[Constants::MaxP + 1];
219 double vals_x[Constants::MaxP + 1];
221 Bembel::Basis::ShapeFunctionHandler::evalBasis(
224 Bembel::Basis::ShapeFunctionHandler::evalBasis(
295 std::vector<double>
vals_x =
297 std::vector<double>
vals_y =
310 if (std::abs(
sol(
i)) > Constants::projector_tolerance) {
328 out.cols.shrink_to_fit();
329 out.rows.shrink_to_fit();
330 out.vals.shrink_to_fit();
333 (
out.rows.size() ==
out.cols.size()) &&
334 "projector.cpp: you made a mistake, try again.");
344template <
typename Derived>
345struct projector_matrixmaker_<Derived, DifferentialForm::Continuous> {
346 static Eigen::SparseMatrix<double> makeMatrix(
349 assert(
P > 0 &&
"P must be 1 or larger for this type of discrete space");
351 "Knot repetition must be smaller than P for this type of discrete "
354 Eigen::SparseMatrix<double>
local_matrix = projector_matrixmaker_<
355 Derived, DifferentialForm::Discontinuous>::makeMatrix(
super_space,
370template <
typename Derived>
371struct projector_matrixmaker_<Derived, DifferentialForm::DivConforming> {
372 static Eigen::SparseMatrix<double> makeMatrix(
375 "P must be 1 or larger for this type of discrete space");
377 "Knot repetition must be smaller than P for this type of discrete "
379 const auto info1 = ProjectorRoutines::makeLocalProjectionTriplets<Derived>(
382 const auto info2 = ProjectorRoutines::makeLocalProjectionTriplets<Derived>(
388 std::vector<Eigen::Triplet<double>>
trips;
412template <
typename Derived>
413struct projector_matrixmaker_<Derived, DifferentialForm::Discontinuous> {
414 static Eigen::SparseMatrix<double> makeMatrix(
416 const auto info = ProjectorRoutines::makeLocalProjectionTriplets<Derived>(
420 std::vector<Eigen::Triplet<double>>
trips;
421 for (
int k = 0;
k <
size; ++
k) {
The Projector provides routines to assemble smooth B-Splines on each patch.
void init_Projector(const SuperSpace< Derived > &super_space, const int knot_repetition)
init
int get_knot_repetition() const
getter
int get_dofs_after_projector() const
Return number of smooth B-splines.
Projector(const SuperSpace< Derived > &super_space, const int knot_repetition)
Constructor for the Projector.
const Eigen::SparseMatrix< double > & get_projection_matrix()
This function returns the transformation matrix to assemble smooth tensor product B-splines.
Eigen::Matrix< T, -1, -1 > DeBoor(Eigen::Matrix< T, -1, -1 > const &control_points, const std::vector< double > &knot_vector, const std::vector< double > &evaluation_points) noexcept
"By the book" implementations of the Cox-DeBoor formula. Inefficient, do not use at bottlenecks.
Routines for the evalutation of pointwise errors.
constexpr int getFunctionSpaceOutputDimension()
struct containing specifications on the linear operator has to be specialized or derived for any part...
Helper struct for assembling the Projector for the different cases.
The superspace manages local polynomial bases on each element of the mesh and provides an interface t...