OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
operator_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"
21#include "matrix/base.hpp"
23
24
25namespace bem::rwg
26{
27
29{
30 mat.resize(base::obs_mesh_.num_edges(), base::src_mesh_.num_edges());
31 mat.preallocate(base::elem_pairs_.cols() * 3 * 3);
32 return;
33};
34
35
40 )
41{
42 for (uint8_t src_edge = 0; src_edge < 3; ++src_edge)
43 {
44 Index col = base::src_mesh_.elem_edges(src_edge, elem_pair[1]);
45 for (uint8_t obs_edge = 0; obs_edge < 3; ++obs_edge)
46 {
47 Index row = base::obs_mesh_.elem_edges(obs_edge, elem_pair[0]);
48 mat.add_value(row, col, values(obs_edge, src_edge));
49 }
50 }
51 return;
52};
53
54
56{
57 mat.resize(base::obs_mesh_.num_elems(), base::src_mesh_.num_elems());
58 mat.preallocate(base::elem_pairs_.cols());
59 return;
60};
61
62
72
73
75{
76 mat.resize(base::obs_mesh_.num_elems(), base::src_mesh_.num_edges());
77 mat.preallocate(base::elem_pairs_.cols() * 3);
78 return;
79};
80
81
86 )
87{
88 Index row = elem_pair[0];
89 for (uint8_t src_edge = 0; src_edge < 3; ++src_edge)
90 {
91 Index col = base::src_mesh_.elem_edges(src_edge, elem_pair[1]);
92 mat.add_value(row, col, values(src_edge));
93 }
94 return;
95};
96
97
99{
100 mat.resize(base::obs_mesh_.num_edges(), base::src_mesh_.num_elems());
101 mat.preallocate(base::elem_pairs_.cols() * 3);
102 return;
103};
104
105
110 )
111{
112 Index col = elem_pair[1];
113 for (uint8_t obs_edge = 0; obs_edge < 3; ++obs_edge)
114 {
115 Index row = base::obs_mesh_.elem_edges(obs_edge, elem_pair[0]);
116 mat.add_value(row, col, values(obs_edge));
117 }
118 return;
119};
120
121
123{
124 mat.resize(base::obs_mesh_.num_edges() * 4, base::src_mesh_.num_edges());
125 mat.preallocate(base::elem_pairs_.cols() * 12 * 3);
126 return;
127};
128
129
134 )
135{
136 for (uint8_t op = 0; op < 4; ++op)
137 {
138 for (uint8_t src_edge = 0; src_edge < 3; ++src_edge)
139 {
140 Index col = base::src_mesh_.elem_edges(src_edge, elem_pair[1]);
141 for (uint8_t obs_edge = 0; obs_edge < 3; ++obs_edge)
142 {
143 Index row = base::obs_mesh_.elem_edges(obs_edge, elem_pair[0]) + base::obs_mesh_.num_edges() * op;
144 mat.add_value(row, col, values(obs_edge + 3 * op, src_edge));
145 }
146 }
147 }
148 return;
149};
150
151}
152
void fill_matrix(MatrixBase< Complex > &mat, ConstEigRef< EigColVecN< Index, 2 > > elem_pair, ConstEigRef< EigMatMN< Complex, 3, 1 > > values) override
Fills operator values in the matrix for face-based pulse source functions and edge-based RWG observat...
void prep_matrix(MatrixBase< Complex > &mat) override
Prepares the matrix for assembly (e.g., resizing and preallocation).
void prep_matrix(MatrixBase< Complex > &mat) override
Prepares the matrix for assembly (e.g., resizing and preallocation).
void fill_matrix(MatrixBase< Complex > &mat, ConstEigRef< EigColVecN< Index, 2 > > elem_pair, ConstEigRef< EigMatMN< Complex, 3, 3 > > values) override
Fills operator values in the matrix for edge-based RWG observation and source functions.
void prep_matrix(MatrixBase< Complex > &mat) override
Prepares the matrix for assembly (e.g., resizing and preallocation).
void fill_matrix(MatrixBase< Complex > &mat, ConstEigRef< EigColVecN< Index, 2 > > elem_pair, ConstEigRef< EigMatMN< Complex, 1, 3 > > values) override
Fills operator values in the matrix for face-based pulse observation functions and edge-based RWG sou...
void fill_matrix(MatrixBase< Complex > &mat, ConstEigRef< EigColVecN< Index, 2 > > elem_pair, ConstEigRef< EigMatMN< Complex, 1, 1 > > values) override
Fills operator values in the matrix for face-based pulse observation and source functions.
void prep_matrix(MatrixBase< Complex > &mat) override
Prepares the matrix for assembly (e.g., resizing and preallocation).
void fill_matrix(MatrixBase< Complex > &mat, ConstEigRef< EigColVecN< Index, 2 > > elem_pair, ConstEigRef< EigMatMN< Complex, 12, 3 > > values) override
Fills operator values in the matrix for edge-based RWG observation and source functions.
void prep_matrix(MatrixBase< Complex > &mat) override
Prepares the matrix for assembly (e.g., resizing and preallocation).
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
std::size_t Index
Unsigned integer type for indices and container sizes.
Definition types.hpp:54
Namespace for RWG-based BEM functionality.