11#ifndef BEMBEL_SRC_ANSATZSPACE_GLUE_HPP_
12#define BEMBEL_SRC_ANSATZSPACE_GLUE_HPP_
38namespace GlueRoutines {
43 std::vector<int> dofs;
49template <
typename Derived,
unsigned int DF>
51 static std::vector<dofIdentification> makeIdentification(
52 const std::vector<std::array<int, 4>> &edges_,
54 assert(
false &&
"Needs to be specialized");
75template <
typename Derived>
77 std::vector<std::array<int, 4>> edges_;
79 Eigen::SparseMatrix<double> glue_mat_;
106 edges_ =
superspace.get_mesh().get_element_tree().patchTopologyInfo();
158 std::vector<Eigen::Triplet<double>>
trips;
159 std::vector<GlueRoutines::dofIdentification>
dof_id =
177 for (
int i = 1;
i <
dofset.dofs.size(); ++
i) {
187 return a.dofs[0] < b.dofs[0];
192 assert(
post_dofs != 0 &&
"All degrees of freedom are on the boundary!");
235namespace GlueRoutines {
261 std::vector<int>
out;
266 "This should be a given. If not something went wrong in Glue.hpp" &&
276 "This should be a given. If not something went wrong in Glue.hpp" &&
286 "This should be a given. If not something went wrong in Glue.hpp" &&
296 "This should be a given. If not something went wrong in Glue.hpp" &&
313inline bool edgeIsForwardParametrized(
int edgeCase) {
316inline bool edgeIsBackwardsParametrized(
int edgeCase) {
317 return !(edgeIsForwardParametrized(
edgeCase));
319inline bool normalComponentIsInwardDirected(
int edgeCase) {
322inline bool normalComponentIsOutwardDirected(
int edgeCase) {
323 return !(normalComponentIsInwardDirected(
edgeCase));
326inline bool reverseParametrized(
const std::array<int, 4> &
edge) {
327 return ((edgeIsForwardParametrized(
edge[2]) &&
328 edgeIsForwardParametrized(
edge[3])) ||
329 (edgeIsBackwardsParametrized(
edge[2]) &&
330 edgeIsBackwardsParametrized(
edge[3])))
335inline int glueCoefficientDivergenceConforming(
const std::array<int, 4> &
edge) {
336 return ((normalComponentIsInwardDirected(
edge[2]) &&
337 normalComponentIsInwardDirected(
edge[3])) ||
338 (normalComponentIsOutwardDirected(
edge[2]) &&
339 normalComponentIsOutwardDirected(
edge[3])))
343inline bool edgeToBeGluedInFirstComp(
int edgeCase) {
352template <
typename Derived>
354 static std::vector<dofIdentification> makeIdentification(
355 const std::vector<std::array<int, 4>> &edges_,
370template <
typename Derived>
372 static std::vector<dofIdentification> makeIdentification(
373 const std::vector<std::array<int, 4>> &edges_,
378 proj.get_knot_repetition() *
379 ((1 <<
superspace.get_refinement_level()) - 1);
382 std::vector<GlueRoutines::dofIdentification>
out;
387 for (
auto edge : edges_) {
406 "If this happens something went horribly wrong.");
495 for (
auto x =
out.begin();
x !=
out.end(); ++
x) {
496 if ((*x).dofs.size() == 0) {
511template <
typename Derived>
513 static std::vector<dofIdentification> makeIdentification(
514 const std::vector<std::array<int, 4>> &edges_,
519 proj.get_knot_repetition() *
520 ((1 <<
superspace.get_refinement_level()) - 1);
522 proj.get_knot_repetition() *
523 ((1 <<
superspace.get_refinement_level()) - 1);
527 (
proj.get_dofs_after_projector() /
529 "The assembly of the glue matrix is highly specific to the space. "
530 "Something went wrong; is the discrete space correct?");
532 std::vector<GlueRoutines::dofIdentification>
out;
535 for (
auto edge : edges_) {
541 (edgeToBeGluedInFirstComp(
edge[2])
546 (edgeToBeGluedInFirstComp(
edge[3])
568 const int coef = glueCoefficientDivergenceConforming(
edge);
576 "If this happens something went horribly wrong.");
This class takes care of identifying DOFs on different edges, which must be identified with one anoth...
void init_Glue(const SuperSpace< Derived > &superspace, const Projector< Derived > &proj)
Initializes the AnsatzSpace object.
std::vector< GlueRoutines::dofIdentification > makeDofIdentificationList(const SuperSpace< Derived > &superspace, const Projector< Derived > &proj)
Generates a list of degrees of freedom (DOFs) identifications.
Eigen::SparseMatrix< double > get_glue_matrix() const
Returns Glue matrix to assemble continuous B-splines.
Glue(const SuperSpace< Derived > &superspace, const Projector< Derived > &proj)
Constructor for the Glue class.
Eigen::SparseMatrix< double > assembleGlueMatrix(const SuperSpace< Derived > &superspace, const Projector< Derived > &proj)
Assembles the Glue matrix according to the DOF identification list.
The Projector provides routines to assemble smooth B-Splines on each patch.
Routines for the evalutation of pointwise errors.
constexpr int getFunctionSpaceOutputDimension()
Helper struct for assembling the Glue for the different cases.
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...