Bembel
evaluateBilinearForm.hpp
1 // This file is part of Bembel, the higher order C++ boundary element library.
2 //
3 // Copyright (C) 2022 see <http://www.bembel.eu>
4 //
5 // It was written as part of a cooperation of J. Doelz, H. Harbrecht, S. Kurz,
6 // M. Multerer, S. Schoeps, and F. Wolf at Technische Universitaet Darmstadt,
7 // Universitaet Basel, and Universita della Svizzera italiana, Lugano. This
8 // source code is subject to the GNU General Public License version 3 and
9 // provided WITHOUT ANY WARRANTY, see <http://www.bembel.eu> for further
10 // information.
11 #ifndef BEMBEL_SRC_DUFFYTRICK_EVALUATEBILINEARFORM_HPP_
12 #define BEMBEL_SRC_DUFFYTRICK_EVALUATEBILINEARFORM_HPP_
13 
14 namespace Bembel {
15 namespace DuffyTrick {
21 template <typename Derived, class T, class CubatureVector>
23  const LinearOperatorBase<Derived>& linOp, const T& super_space,
24  const ElementTreeNode& e1, const ElementTreeNode& e2,
25  const CubatureVector& GS, const ElementSurfacePoints& ffield_qnodes1,
26  const ElementSurfacePoints& ffield_qnodes2,
27  Eigen::Matrix<typename LinearOperatorTraits<Derived>::Scalar,
28  Eigen::Dynamic, Eigen::Dynamic>* intval) {
30  double dist = 0;
31  int ffield_deg =
32  linOp.get_FarfieldQuadratureDegree(super_space.get_polynomial_degree());
33  int nfield_deg = 0;
34  auto cp = compareElements(e1, e2, &dist);
35  nfield_deg = linOp.getNearfieldQuadratureDegree(
36  super_space.get_polynomial_degree(), dist, e1.level_);
37  // make sure that the quadratur degree is at least the far field degree
38  nfield_deg = nfield_deg >= ffield_deg ? nfield_deg : ffield_deg;
39  assert(nfield_deg < Constants::maximum_quadrature_degree &&
40  "nfield_deg too large, increase maximum_quadrature_degree");
41  auto Q = GS[nfield_deg];
42  switch (cp(2)) {
43  case 0:
44  if (nfield_deg == ffield_deg) {
45  integrate0(linOp, super_space, e1, 0, e2, 0, ffield_qnodes1,
46  ffield_qnodes2, Q, intval);
47  return;
48  } else {
49  integrate1(linOp, super_space, e1, 0, e2, 0, ffield_qnodes1,
50  ffield_qnodes2, Q, intval);
51  return;
52  }
53  case 1:
54  assert(!"you should not have ended up here!");
55  case 2:
56  integrate2(linOp, super_space, e1, 0, e2, 0, ffield_qnodes1,
57  ffield_qnodes2, Q, intval);
58  return;
59  case 3:
60  integrate3(linOp, super_space, e1, cp(0), e2, cp(1), ffield_qnodes1,
61  ffield_qnodes2, Q, intval);
62  return;
63  case 4:
64  integrate4(linOp, super_space, e1, cp(0), e2, cp(1), ffield_qnodes1,
65  ffield_qnodes2, Q, intval);
66  return;
67  default:
68  assert(!"you should not have ended up here!");
69  }
70  return;
71 }
72 } // namespace DuffyTrick
73 } // namespace Bembel
74 #endif // BEMBEL_SRC_DUFFYTRICK_EVALUATEBILINEARFORM_HPP_
The ElementTreeNode corresponds to an element in the element tree.
int level_
element id with respect to the level
void evaluateBilinearForm(const LinearOperatorBase< Derived > &linOp, const T &super_space, const ElementTreeNode &e1, const ElementTreeNode &e2, const CubatureVector &GS, const ElementSurfacePoints &ffield_qnodes1, const ElementSurfacePoints &ffield_qnodes2, Eigen::Matrix< typename LinearOperatorTraits< Derived >::Scalar, Eigen::Dynamic, Eigen::Dynamic > *intval)
This function wraps the quadrature routines for the DuffyTrick and returns all integrals for the give...
void integrate3(const LinearOperatorBase< Derived > &LinOp, const T &super_space, const ElementTreeNode &e1, int rot1, const ElementTreeNode &e2, int rot2, const ElementSurfacePoints &ffield_qnodes1, const ElementSurfacePoints &ffield_qnodes2, const Cubature &Q, Eigen::Matrix< typename LinearOperatorTraits< Derived >::Scalar, Eigen::Dynamic, Eigen::Dynamic > *intval)
quadrature routine for the common edge case
Definition: integrate3.hpp:28
void integrate1(const LinearOperatorBase< Derived > &LinOp, const T &super_space, const ElementTreeNode &e1, int rot1, const ElementTreeNode &e2, int rot2, const ElementSurfacePoints &ffield_qnodes1, const ElementSurfacePoints &ffield_qnodes2, const Cubature &Q, Eigen::Matrix< typename LinearOperatorTraits< Derived >::Scalar, Eigen::Dynamic, Eigen::Dynamic > *intval)
no-problem quadrature routine, elements are sufficiently far away from each other,...
Definition: integrate1.hpp:26
void integrate2(const LinearOperatorBase< Derived > &LinOp, const T &super_space, const ElementTreeNode &e1, int rot1, const ElementTreeNode &e2, int rot2, const ElementSurfacePoints &ffield_qnodes1, const ElementSurfacePoints &ffield_qnodes2, const Cubature &Q, Eigen::Matrix< typename LinearOperatorTraits< Derived >::Scalar, Eigen::Dynamic, Eigen::Dynamic > *intval)
quadrature routine for identical elements
Definition: integrate2.hpp:28
void integrate0(const LinearOperatorBase< Derived > &LinOp, const T &super_space, const ElementTreeNode &e1, int rot1, const ElementTreeNode &e2, int rot2, const ElementSurfacePoints &ffield_qnodes1, const ElementSurfacePoints &ffield_qnodes2, const Cubature &Q, Eigen::Matrix< typename LinearOperatorTraits< Derived >::Scalar, Eigen::Dynamic, Eigen::Dynamic > *intval)
far-field quadrature routine, which is based on precomputed values in order to quickly evaluate the i...
Definition: integrate0.hpp:23
void integrate4(const LinearOperatorBase< Derived > &LinOp, const T &super_space, const ElementTreeNode &e1, int rot1, const ElementTreeNode &e2, int rot2, const ElementSurfacePoints &ffield_qnodes1, const ElementSurfacePoints &ffield_qnodes2, const Cubature &Q, Eigen::Matrix< typename LinearOperatorTraits< Derived >::Scalar, Eigen::Dynamic, Eigen::Dynamic > *intval)
quadrature routine for common vertex case.
Definition: integrate4.hpp:28
Eigen::Vector3i compareElements(const ElementTreeNode &e1, const ElementTreeNode &e2, double *dist)
Compares two elements for similarities and determines, how the elements have to be rotated to move th...
std::vector< SurfacePoint, Eigen::aligned_allocator< SurfacePoint > > ElementSurfacePoints
typedef std::vector<SurfacePoint> with aligned allocator of Eigen for compatibility with older compil...
Routines for the evalutation of pointwise errors.
Definition: AnsatzSpace.hpp:14
linear operator base class. this serves as a common interface for existing linear operators.
int getNearfieldQuadratureDegree(int ansatz_degree, double distance, int level) const
Compute quadrature degree for numerical integretation close to the singularity based on distance,...
struct containing specifications on the linear operator has to be specialized or derived for any part...