OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
gram.tpp
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 BEM_RWG_OPS_GRAM_I
19#define BEM_RWG_OPS_GRAM_I
20
21#include "types.hpp"
22#include "constants.hpp"
25
26
27namespace bem::rwg
28{
29
30template <typename TriangleQuadratureType>
32 const Complex k,
33 const Triangle<3>& obs_tri,
34 const Triangle<3>& src_tri
35 )
36{
37
39
41 return result;
42
43 tri_quad_.compute_points_weights(obs_tri);
44
45 // source triangle edges
46 for (uint8_t jj = 0; jj < 3; ++jj)
47 {
48 // observer triangle edges
49 for (uint8_t ii = 0; ii < 3; ++ii)
50 {
51 result(ii, jj) = tri_quad_.weights().dot(
52 ((tri_quad_.points().colwise() - obs_tri.v((ii + 2) % 3)).transpose() *
53 (tri_quad_.points().colwise() - src_tri.v((jj + 2) % 3))).diagonal()
54 );
55 }
56 }
57
58 result.array() *= (
60 ).array();
61
62 // if (src_tri.normal().dot(obs_tri.normal()) < 0)
63 // result.array() *= -1;
64
65 // if (src_tri.normal().dot(obs_tri.normal()) < 0)
66 // result.array() *= 0;
67
68 return result;
69
70};
71
72
73template <typename TriangleQuadratureType>
75 const Complex k,
76 const Triangle<3>& obs_tri,
77 const Triangle<3>& src_tri
78 )
79{
80
82
84 return result;
85
86 tri_quad_.compute_points_weights(obs_tri);
87
88 // source triangle edges
89 for (uint8_t jj = 0; jj < 3; ++jj)
90 {
91 // observer triangle edges
92 for (uint8_t ii = 0; ii < 3; ++ii)
93 {
94 result(ii, jj) = -tri_quad_.weights().dot(
95 (((tri_quad_.points().colwise() - obs_tri.v((ii + 2) % 3)
96 ).colwise().cross(obs_tri.normal())).transpose() * (
97 (tri_quad_.points().colwise() - src_tri.v((jj + 2) % 3)))).diagonal());
98 }
99 }
100
101 result.array() *= (
103 ).array();
104
105 // if (src_tri.normal().dot(obs_tri.normal()) < 0)
106 // result.array() *= -1;
107
108 return result;
109
110};
111
112}
113
114#endif
Geometry operations class.
EigMatMN< Complex, 3, 3 > compute(const Complex k, const Triangle< 3 > &obs_tri, const Triangle< 3 > &src_tri) override
Computes the rotationally-tested RWG identity operator.
Definition gram.tpp:74
EigMatMN< Complex, 3, 3 > compute(const Complex k, const Triangle< 3 > &obs_tri, const Triangle< 3 > &src_tri) override
Computes the RWG identity operator.
Definition gram.tpp:31
static EigRowVecN< Float, 3 > normalization(const Triangle< 3 > &tri)
Defines the normalization factor for each RWG function associated with a given triangle.
Eigen::Matrix< T, M, N > EigMatMN
Fixed-size matrix with M rows and N columns containing type T.
Definition types.hpp:70
std::complex< Float > Complex
Complex floating point number.
Definition types.hpp:51
Eigen::Matrix< T, N, 1 > EigColVecN
Fixed-size column vector of size N containing type T.
Definition types.hpp:86
Namespace for RWG-based BEM functionality.