OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
gauss.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 GAUSS_LINE_QUAD_H
19#define GAUSS_LINE_QUAD_H
20
21#include <vector>
22#include <string>
23#include <functional>
24
25#include "types.hpp"
26#include "constants.hpp"
29
30
31namespace bem
32{
33
43template <uint8_t dim>
45{
46
47 using base = LineQuadratureBase<dim>;
48
49public:
50
60 GaussLineQuadrature(const uint8_t order = LINE_DEFAULT_ORDER)
61 {
62 EigColVec<Index> orders = EigColVec<Index>::LinSpaced(LINE_MAX_ORDER, 1, LINE_MAX_ORDER);
63 rules_ = load_rules<1> (rule_file_, orders);
65 return;
66 };
67
68
73 void set_order(const uint8_t order) override;
74
75
85 std::function<EigRowVec<Complex> (ConstEigRef<EigMatNX<Float, dim>>)> eval = {}
86 ) override;
87
88
93 const EigRowVec<Float>& ref_points() const { return rules_[base::order_ - 1].nodes; };
94
95
100 const EigRowVec<Float>& ref_weights() const { return rules_[base::order_ - 1].weights; };
101
102
103protected:
104
105 std::string rule_file_ = "line_quad_gauss.json";
106 std::vector<QuadratureRule<1>> rules_;
107
108};
109
114}
115
116#ifndef BEM_LINKED
118#endif
119
120#endif
Class for Gaussian quadrature over a line segment.
Definition gauss.hpp:45
const EigRowVec< Float > & ref_points() const
Returns the evaluation points in the reference unit line segment.
Definition gauss.hpp:93
const EigRowVec< Float > & ref_weights() const
Returns the weights associated with the evaluation points in the reference unit line segment.
Definition gauss.hpp:100
GaussLineQuadrature(const uint8_t order=LINE_DEFAULT_ORDER)
Constructs a GaussLineQuadrature object with a specified quadrature order.
Definition gauss.hpp:60
void compute_points_weights(ConstEigRef< EigColVecN< Float, dim > > p1, ConstEigRef< EigColVecN< Float, dim > > p2, 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:47
void set_order(const uint8_t order) override
Sets the quadrature order.
Definition gauss.cpp:29
Base class for quadrature over a line segment.
Definition base.hpp:46
uint8_t order() const
Returns the quadrature order.
Definition base.hpp:76
Eigen::Matrix< T, Eigen::Dynamic, 1 > EigColVec
Dynamic-size column vector containing type T.
Definition types.hpp:82
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