OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
double_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_DOUBLE_LAYER_I
19#define BEM_RWG_PROJ_DOUBLE_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(false, true);
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();
51
52 // source triangle edges
53 for (uint8_t jj = 0; jj < 3; ++jj)
54 {
56 r_diff.topRows(2).colwise() -= src_tri_local.v((jj + 2) % 3);
57 result_local.row(0) = r_diff.row(1).array() * src_result.grad_g.row(2).array() -
58 r_diff.row(2).array() * src_result.grad_g.row(1).array();
59 result_local.row(1) = r_diff.row(2).array() * src_result.grad_g.row(0).array() -
60 r_diff.row(0).array() * src_result.grad_g.row(2).array();
61 result_local.row(2) = r_diff.row(0).array() * src_result.grad_g.row(1).array() -
62 r_diff.row(1).array() * src_result.grad_g.row(0).array();
63 result.col(jj) = -(local_uvw * result_local).reshaped(3 * obs_points.cols(), 1) *
64 norms(jj);
65 }
66
67 return result;
68
69};
70
71}
72
73#endif
static EigRowVecN< Float, 3 > normalization(const Triangle< 3 > &tri)
Defines the normalization factor for each RWG function associated with a given triangle.
EigMatXN< Complex, 3 > compute(const Complex k, ConstEigRef< EigMatNX< Float, 3 > > obs_points, const Triangle< 3 > &src_tri) override
Computes the vector double-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
Eigen::Matrix< T, N, Eigen::Dynamic > EigMatNX
Fixed-height matrix with N rows containing type T.
Definition types.hpp:78
Namespace for RWG-based BEM functionality.
Data structure to hold the results of integration over the source triangle.
Definition base.hpp:37