OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
excitation_matrix.cpp
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
19
20#include "types.hpp"
22#include "matrix/base.hpp"
23
24
25namespace bem::rwg
26{
27
31 const Complex k
32 )
33{
34
35 Index obs_num_edges = base::obs_mesh_.num_edges();
36
37 mat.resize(obs_num_edges, exc.num_excitations());
38 mat.preallocate(obs_num_edges * exc.num_excitations());
39
40 for (Index ii = 0; ii < base::elems_.size(); ++ii)
41 {
42 Index face = base::elems_[ii];
43 Triangle<3> obs_tri = base::obs_mesh_.elem_primitive(face);
44
46
47 for (Index col = 0; col < values.cols(); col++)
48 {
49 for (uint8_t edge = 0; edge < 3; edge++)
50 {
51 Index row = base::obs_mesh_.elem_edges(edge, face);
52 mat.add_value(row, col, values(edge, col));
53 }
54 }
55 }
56
57 mat.assemble();
58
59 return;
60
61};
62
63
67 const Complex k
68 )
69{
70
71 Index obs_num_faces = base::obs_mesh_.num_elems();
72
73 mat.resize(obs_num_faces, exc.num_excitations());
74 mat.preallocate(obs_num_faces * exc.num_excitations());
75
76 for (Index ii = 0; ii < base::elems_.size(); ++ii)
77 {
78 Index face = base::elems_[ii];
79 Triangle<3> obs_tri = base::obs_mesh_.elem_primitive(face);
80
82
83 for (Index rhs = 0; rhs < values.cols(); rhs++)
84 mat.set_value(face, rhs, values(0, rhs));
85 }
86
87 mat.assemble();
88
89 return;
90
91};
92
93}
void assemble(MatrixBase< Complex > &mat, ExcitationBase< 3 > &exc, const Complex k) override
Assembles the excitation matrix for a given excitation object and observation triangle mesh.
void assemble(MatrixBase< Complex > &mat, ExcitationBase< 1 > &exc, const Complex k) override
Assembles the excitation matrix for a given excitation object and observation triangle mesh.
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
std::size_t Index
Unsigned integer type for indices and container sizes.
Definition types.hpp:54
Namespace for RWG-based BEM functionality.