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 LINE_QUAD_BASE_H
19#define LINE_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 LINE_DEFAULT_ORDER = 10;
33const uint8_t LINE_MAX_ORDER = 30;
34
44template <uint8_t dim>
46{
47
48 static_assert((dim == 1 || dim == 2 || dim == 3), "`dim` must be 1, 2, or 3.");
49
50public:
51
61 std::function<EigRowVec<Complex> (ConstEigRef<EigMatNX<Float, dim>>)> eval = {}
62 ) = 0;
63
64
69 virtual void set_order(const uint8_t order) { order_ = order; return; };
70
71
76 uint8_t order() const { return order_; };
77
78
84 {
85 if (!points_weights_computed_)
86 throw std::runtime_error(
87 "LineQuadratureBase::points(): must call `compute_points_weights()` first.");
88 return points_;
89 };
90
91
97 {
98 if (!points_weights_computed_)
99 throw std::runtime_error(
100 "LineQuadratureBase::weights(): must call `compute_points_weights()` first.");
101 return weights_;
102 };
103
104
105protected:
106
107 EigMatNX<Float, dim> points_;
108 EigRowVec<Float> weights_;
109
110 uint8_t order_ = LINE_DEFAULT_ORDER;
111 bool points_weights_computed_ = false;
112
113};
114
119}
120
121#endif
Base class for quadrature over a line segment.
Definition base.hpp:46
uint8_t order() const
Returns the quadrature order.
Definition base.hpp:76
const EigMatNX< Float, dim > & points() const
Returns the points on which to evaluate the integrand.
Definition base.hpp:83
virtual void set_order(const uint8_t order)
Sets the quadrature order.
Definition base.hpp:69
virtual void compute_points_weights(ConstEigRef< EigColVecN< Float, dim > > p1, ConstEigRef< EigColVecN< Float, dim > > p2, 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.
const EigRowVec< Float > & weights() const
Returns the weights associated with the points on which the integrand is evaluated.
Definition base.hpp:96
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