OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
gauss.cpp
Go to the documentation of this file.
1// OpenBEM - Copyright (C) 2026 Shashwat Sharma
2
3// This file is part of OpenBEM.
4
5// OpenBEM is free software: you can redistribute it and/or modify it under the terms of the
6// GNU General Public License as published by the Free Software Foundation, either version 3
7// of the License, or (at your option) any later version.
8
9// You should have received a copy of the GNU General Public License along with OpenBEM.
10// If not, see <https://www.gnu.org/licenses/>.
11
12
19
20#include <functional>
21
22#include "types.hpp"
23#include "constants.hpp"
25
26
27namespace bem
28{
29
30template <uint8_t dim>
32{
33 if (order > TRI_MAX_ORDER)
34 throw std::domain_error(
35 "GaussTriangleQuadrature::set_order(): order must be less than or equal to "
36 + std::to_string(TRI_MAX_ORDER) + "."
37 );
38
39 base::order_ = order;
40 base::points_.resize(dim, rules_[order - 1].num_nodes);
41 base::weights_.resize(1, rules_[order - 1].num_nodes);
42 base::points_weights_computed_ = false;
43 return;
44};
45
46
47template <uint8_t dim>
49 const Triangle<dim>& tri,
51 )
52{
53 base::points_.noalias() =
54 tri.v().rightCols(2) * ref_points() + tri.v().col(0) * (
55 one
56 - ref_points().row(0).array()
57 - ref_points().row(1).array()
58 ).matrix();
59 base::weights_.noalias() = tri.area() * ref_weights() * 2;
60 base::points_weights_computed_ = true;
61 return;
62};
63
64
65template class GaussTriangleQuadrature<2>;
66template class GaussTriangleQuadrature<3>;
67
68}
void compute_points_weights(const Triangle< dim > &tri, std::function< EigRowVec< Complex >(ConstEigRef< EigMatNX< Float, dim > >)> eval={}) override
Computes and stores the points on which to evaluate the integrand, and the corresponding weights.
Definition gauss.cpp:48
void set_order(const uint8_t order) override
Sets the quadrature order.
Definition gauss.cpp:31
const Eigen::Ref< const EigObj > ConstEigRef
Read-only reference to an Eigen object.
Definition types.hpp:98
Eigen::Matrix< T, N, 1 > EigColVecN
Fixed-size column vector of size N containing type T.
Definition types.hpp:86
Primary namespace for the OpenBEM library.
Definition constants.hpp:31