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_TRI_QUAD_H
19#define GAUSS_TRI_QUAD_H
20
21#include <functional>
22
23#include "types.hpp"
24#include "constants.hpp"
28
29
30namespace bem
31{
32
42template <uint8_t dim>
44{
45
46 using base = TriangleQuadratureBase<dim>;
47
48public:
49
59 GaussTriangleQuadrature(const uint8_t order = TRI_DEFAULT_ORDER)
60 {
61 EigColVec<Index> orders = EigColVec<Index>::LinSpaced(TRI_MAX_ORDER, 1, TRI_MAX_ORDER);
62 rules_ = load_rules<2> (rule_file_, orders);
64 return;
65 };
66
67
72 void set_order(const uint8_t order) override;
73
74
81 const Triangle<dim>& tri,
82 std::function<EigRowVec<Complex> (ConstEigRef<EigMatNX<Float, dim>>)> eval = {}
83 ) override;
84
85
90 const EigMatNX<Float, 2>& ref_points() const { return rules_[base::order_ - 1].nodes;};
91
92
97 const EigRowVec<Float>& ref_weights() const { return rules_[base::order_ - 1].weights; };
98
99
100private:
101
102 std::string rule_file_ = "tri_quad_xiao_gimbutas.json";
103 std::vector<QuadratureRule<2>> rules_;
104
105};
106
111}
112
113#ifndef BEM_LINKED
115#endif
116
117#endif
Class for Gaussian quadrature over a triangle.
Definition gauss.hpp:44
const EigRowVec< Float > & ref_weights() const
Returns the weights associated with the evaluation points in the reference unit triangle.
Definition gauss.hpp:97
const EigMatNX< Float, 2 > & ref_points() const
Returns the evaluation points in the reference unit triangle.
Definition gauss.hpp:90
GaussTriangleQuadrature(const uint8_t order=TRI_DEFAULT_ORDER)
Constructs a GaussTriangleQuadrature object with a specified quadrature order.
Definition gauss.hpp:59
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
Base class for quadrature over a triangle.
Definition base.hpp:46
uint8_t order() const
Returns the quadrature order.
Definition base.hpp:74
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