OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
base.hpp
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
18#ifndef TRI_QUAD_BASE_H
19#define TRI_QUAD_BASE_H
20
21#include <stdexcept>
22#include <string>
23#include <functional>
24
25#include "types.hpp"
26#include "constants.hpp"
27
28
29namespace bem
30{
31
32const uint8_t TRI_DEFAULT_ORDER = 4;
33const uint8_t TRI_MAX_ORDER = 30;
34
44template <uint8_t dim>
46{
47
48 static_assert((dim == 2 || dim == 3), "`dim` must be 2 or 3.");
49
50public:
51
58 const Triangle<dim>& tri,
59 std::function<EigRowVec<Complex> (ConstEigRef<EigMatNX<Float, dim>>)> eval = {}
60 ) = 0;
61
62
67 virtual void set_order(const uint8_t order) { order_ = order; return; };
68
69
74 uint8_t order() const { return order_; };
75
76
82 {
83 if (!points_weights_computed_)
84 throw std::runtime_error(
85 "TriangleQuadratureBase::points(): must call `compute_points_weights()` first.");
86 return points_;
87 };
88
89
95 {
96 if (!points_weights_computed_)
97 throw std::runtime_error(
98 "TriangleQuadratureBase::weights(): must call `compute_points_weights()` first.");
99 return weights_;
100 };
101
102
103protected:
104
105 EigMatNX<Float, dim> points_;
106 EigRowVec<Float> weights_;
107 uint8_t order_ = TRI_DEFAULT_ORDER;
108 bool points_weights_computed_ = false;
109
110};
111
116}
117
118#endif
Base class for quadrature over a triangle.
Definition base.hpp:46
virtual void set_order(const uint8_t order)
Sets the quadrature order.
Definition base.hpp:67
const EigMatNX< Float, dim > & points() const
Returns the points on which to evaluate the integrand.
Definition base.hpp:81
const EigRowVec< Float > & weights() const
Returns the weights associated with the points on which the integrand is evaluated.
Definition base.hpp:94
virtual void compute_points_weights(const Triangle< dim > &tri, std::function< EigRowVec< Complex >(ConstEigRef< EigMatNX< Float, dim > >)> eval={})=0
Computes and stores the points on which to evaluate the integrand, and the corresponding weights.
uint8_t order() const
Returns the quadrature order.
Definition base.hpp:74
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