Bembel
 
Loading...
Searching...
No Matches
DiscretePotential.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_POTENTIAL_DISCRETEPOTENTIAL_HPP_
12#define BEMBEL_SRC_POTENTIAL_DISCRETEPOTENTIAL_HPP_
13
14namespace Bembel {
20template <typename Derived, typename LinOp>
22 public:
24 // constructors
29 }
31 // init_DiscretePotential
34 ansatz_space_ = ansatz_space;
35 fun_ev_ = FunctionEvaluator<LinOp>(ansatz_space_);
39 deg_ = ansatz_space_.get_polynomial_degree() + 1;
40 return;
41 }
43 // compute
45 Eigen::Matrix<typename PotentialReturnScalar<
47 typename PotentialTraits<Derived>::Scalar>::Scalar,
49 evaluate(const Eigen::Matrix<double, Eigen::Dynamic, 3> &points) {
50 auto FunctionSpaceVectorDimension =
53
55 auto Q = GS[deg_];
56
57 auto super_space = ansatz_space_.get_superspace();
58
59 const ElementTree &element_tree = super_space.get_mesh().get_element_tree();
61
62 auto polynomial_degree = super_space.get_polynomial_degree();
63 auto polynomial_degree_plus_one_squared =
64 (polynomial_degree + 1) * (polynomial_degree + 1);
65
66 Eigen::Matrix<typename PotentialReturnScalar<
68 typename PotentialTraits<Derived>::Scalar>::Scalar,
69 Eigen::Dynamic,
72 potential.resize(points.rows(),
74 potential.setZero();
75
76#pragma omp parallel
77 {
78 Eigen::Matrix<typename PotentialReturnScalar<
80 typename PotentialTraits<Derived>::Scalar>::Scalar,
81 Eigen::Dynamic,
84 my_potential.resize(points.rows(),
86 my_potential.setZero();
87 for (auto element = element_tree.cpbegin();
88 element != element_tree.cpend(); ++element) {
89#pragma omp single nowait
90 {
92 for (auto j = 0; j < Q.w_.size(); ++j) {
93 super_space.map2surface(
94 *element, Q.xi_.col(j),
95 element->get_h() * element->get_h() * Q.w_(j), &qp);
96 for (auto i = 0; i < points.rows(); ++i) {
97 my_potential.row(i) += pot_.evaluateIntegrand_impl(
98 fun_ev_, *element, points.row(i), qp);
99 }
100 }
101 }
102 }
103#pragma omp critical
105 }
106 return potential;
107 }
109 // setter
111 void set_cauchy_data(
112 const Eigen::Matrix<typename LinearOperatorTraits<LinOp>::Scalar,
113 Eigen::Dynamic, 1> &cauchy_data) {
114 fun_ev_.set_function(cauchy_data);
115 }
116 void set_degree(const int &deg) { deg_ = deg; }
118 // getter
120 Derived &get_potential() { return pot_; }
122 // private member variables
124 private:
125 int deg_;
126 Derived pot_;
127 AnsatzSpace<LinOp> ansatz_space_;
128 FunctionEvaluator<LinOp> fun_ev_;
129}; // namespace Bembel
130
131} // namespace Bembel
132#endif // BEMBEL_SRC_POTENTIAL_DISCRETEPOTENTIAL_HPP_
The AnsatzSpace is the class that handles the assembly of the discrete basis.
int get_polynomial_degree() const
Retrieves the polynomial degree of this AnsatzSpace.
const SuperSpace< Derived > & get_superspace() const
Retrieves the reference to the SuperSpace associated with this AnsatzSpace.
void init_DiscretePotential(const AnsatzSpace< LinOp > &ansatz_space)
This class organizes an element structure on a Geometry object and handles refinement.
int get_number_of_elements() const
Return number of elements in the ElementTree.
The FunctionEvaluator provides means to evaluate coefficient vectors as functions on the geometry.
Eigen::Matrix< double, 12, 1 > SurfacePoint
typedef of SurfacePoint
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...
Base case for specifying the return type of the potential.
Definition Potential.hpp:36
struct containing specifications on the functional has to be specialized or derived for any particula...
Definition Potential.hpp:28