OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
single_layer.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_PROJ_SINGLE_LAYER_I
19#define BEM_RWG_PROJ_SINGLE_LAYER_I
20
21#include "types.hpp"
22#include "constants.hpp"
25
26
27namespace bem::rwg
28{
29
30template <typename SrcIntegratorType>
32 const Complex k,
34 const Triangle<3>& src_tri
35 )
36{
37
38 // Convert to the source triangle's local coordinate system
41 transform_coordinates(obs_points_local, src_tri_local, obs_points, src_tri);
42
43 src_integrator_.set_compute_terms(true, false);
44 const SrcResult src_result = src_integrator_.integrate(k, src_tri_local, obs_points_local);
45
46 EigMatMN<Float, 3, 3> local_uvw = src_tri.local_coordinate_basis();
49
50 // source triangle edges
51 for (uint8_t jj = 0; jj < 3; ++jj)
52 {
54 result.col(jj) = (local_uvw.leftCols(2) * rwg_g).reshaped(3 * obs_points.cols(), 1) *
55 norms(jj);
56 }
57
58 return result;
59
60};
61
62
63template <typename SrcIntegratorType>
65 const Complex k,
67 const Triangle<3>& src_tri
68 )
69{
70
71 // Convert to the source triangle's local coordinate system
74 transform_coordinates(obs_points_local, src_tri_local, obs_points, src_tri);
75
76 src_integrator_.set_compute_terms(true, false);
77 const SrcResult src_result = src_integrator_.integrate(k, src_tri_local, obs_points_local);
78
79 return src_result.g.transpose() * Pulse::normalization(src_tri);
80
81};
82
83
84template <typename SrcIntegratorType>
86 const Complex k,
88 const Triangle<3>& src_tri
89 )
90{
91
92 // Convert to the source triangle's local coordinate system
95 transform_coordinates(obs_points_local, src_tri_local, obs_points, src_tri);
96
97 src_integrator_.set_compute_terms(false, true);
98 const SrcResult src_result = src_integrator_.integrate(k, src_tri_local, obs_points_local);
99
100 EigMatMN<Float, 3, 3> local_uvw = src_tri.local_coordinate_basis();
102 local_uvw * src_result.grad_g
104
105 return result;
106
107};
108
109
110template <typename SrcIntegratorType>
112 const Complex k,
114 const Triangle<3>& src_tri
115 )
116{
117 EigMatXN<Complex, 3> result = proj_g_.compute(k, obs_points, src_tri);
118 EigMatXN<Complex, 1> hessg_term = proj_gradg_.compute(k, obs_points, src_tri) / k / k;
119 result += hessg_term * src_tri.edge_polarities();
120 return result;
121};
122
123}
124
125#endif
EigMatXN< Complex, 1 > compute(const Complex k, ConstEigRef< EigMatNX< Float, 3 > > obs_points, const Triangle< 3 > &src_tri) override
Computes the gradient of the scalar single-layer projector.
static Float normalization(const Triangle< 3 > &tri)
Defines the normalization factor for the pulse function associated with a given triangle.
static EigRowVecN< Float, 3 > normalization(const Triangle< 3 > &tri)
Defines the normalization factor for each RWG function associated with a given triangle.
EigMatXN< Complex, 1 > compute(const Complex k, ConstEigRef< EigMatNX< Float, 3 > > obs_points, const Triangle< 3 > &src_tri) override
Computes the scalar single-layer projector.
EigMatXN< Complex, 3 > compute(const Complex k, ConstEigRef< EigMatNX< Float, 3 > > obs_points, const Triangle< 3 > &src_tri) override
Computes the vector hypersingular projector.
EigMatXN< Complex, 3 > compute(const Complex k, ConstEigRef< EigMatNX< Float, 3 > > obs_points, const Triangle< 3 > &src_tri) override
Computes the vector single-layer projector.
Eigen::Matrix< T, Eigen::Dynamic, N > EigMatXN
Fixed-width matrix with N columns containing type T.
Definition types.hpp:74
const Eigen::Ref< const EigObj > ConstEigRef
Read-only reference to an Eigen object.
Definition types.hpp:98
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.
Data structure to hold the results of integration over the source triangle.
Definition base.hpp:37