11 #include <Bembel/AnsatzSpace>
12 #include <Bembel/Geometry>
13 #include <Bembel/H2Matrix>
15 #include <Bembel/Laplace>
16 #include <Bembel/LinearForm>
17 #include <Eigen/Dense>
20 #include "examples/Data.hpp"
21 #include "examples/Error.hpp"
22 #include "examples/Grids.hpp"
77 using namespace Eigen;
80 int polynomial_degree_max = 3;
81 int refinement_level_max = 3;
87 MatrixXd gridpoints = Util::makeTensorProductGrid(
88 VectorXd::LinSpaced(10, -.25, .25), VectorXd::LinSpaced(10, -.25, .25),
89 VectorXd::LinSpaced(10, -.25, .25));
92 std::function<double(Vector3d)> fun = [](Vector3d in) {
93 return Data::HarmonicFunction(in);
96 std::cout <<
"\n" << std::string(60,
'=') <<
"\n";
98 for (
int polynomial_degree = 0; polynomial_degree < polynomial_degree_max + 1;
99 ++polynomial_degree) {
100 VectorXd error(refinement_level_max + 1);
102 for (
int refinement_level = 0; refinement_level < refinement_level_max + 1;
103 ++refinement_level) {
106 std::cout <<
"Degree " << polynomial_degree <<
" Level "
107 << refinement_level <<
"\t\t";
112 geometry, refinement_level, polynomial_degree);
116 disc_lf(ansatz_space);
117 disc_lf.get_linear_form().set_function(fun);
128 llt.compute(disc_op.get_discrete_operator());
129 auto rho = llt.solve(disc_lf.get_discrete_linear_form());
135 disc_pot(ansatz_space);
136 disc_pot.set_cauchy_data(rho);
137 auto pot = disc_pot.evaluate(gridpoints);
140 VectorXd pot_ref(gridpoints.rows());
141 for (
int i = 0; i < gridpoints.rows(); ++i)
142 pot_ref(i) = fun(gridpoints.row(i));
143 error(refinement_level) = (pot - pot_ref).cwiseAbs().maxCoeff();
144 std::cout <<
" time " << std::setprecision(4) << sw.toc() <<
"s\t\t";
145 std::cout << error(refinement_level) << std::endl;
151 checkRateOfConvergence(error.tail(2), 2 * polynomial_degree + 3, 0.9));
153 std::cout << std::endl;
155 std::cout << std::string(60,
'=') << std::endl;
The AnsatzSpace is the class that handles the assembly of the discrete basis.
this class wraps a GeometryVector and provides some basic functionality, like reading Geometry files
A simple class for benchmarking.
This class implements the specification of the integration for the single layer operator for Laplace.
Routines for the evalutation of pointwise errors.