OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
structure.hpp
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_STRUCTURE_H
19#define BEM_STRUCTURE_H
20
21#include <string>
22#include <vector>
23
24#include "materials.hpp"
25
26
27namespace bem
28{
29
30// Forward declarations
31template <typename MeshType> class Component;
32template <typename MeshType> class MeshView;
33
43template <typename MeshType>
45{
46public:
47
54 ): background_material_(background_material) {};
55
56
63 const MeshType& mesh,
65 ): mesh_(mesh), background_material_(background_material) {};
66
67
73 {
74 components_.push_back(component);
75 return;
76 };
77
78
84 {
85 metacomponents_.push_back(metacomponent);
86 return;
87 };
88
89
95 { return mesh_; };
96
97
102 const MeshType& mesh() const
103 { return mesh_; };
104
105
111 { return background_material_; };
112
113
118 std::vector<Component<MeshType>>& components()
119 { return components_; };
120
121
126 const std::vector<Component<MeshType>>& components() const
127 { return components_; };
128
129
134 std::vector<Component<MeshType>>& metacomponents()
135 { return metacomponents_; };
136
137
142 const std::vector<Component<MeshType>>& metacomponents() const
143 { return metacomponents_; };
144
145
153 std::vector<Component<MeshType>> components_by_name(
154 const std::string name,
155 const bool search_metacomponents = false,
156 const bool case_sensitive = false
157 );
158
159
167 std::vector<MeshView<MeshType>> mesh_views_by_name(
168 const std::string name,
169 const bool search_metacomponents = false,
170 const bool case_sensitive = false
171 );
172
173
174private:
175
176 MeshType mesh_;
177 Material background_material_ = PerfectDielectricMaterial(1, 1);
178
179 std::vector<Component<MeshType>> components_;
180 std::vector<Component<MeshType>> metacomponents_;
181
182};
183
188}
189
190#include "geometry/structure.tpp"
191
192#endif
Class defining a general material with a constant (zero or non-zero) electrical conductivity and real...
Definition materials.hpp:43
Class defining a perfect lossless dielectric material.
Class that defines a structure.
Definition structure.hpp:45
const std::vector< Component< MeshType > > & components() const
Returns a read-only list of the components in the structure.
std::vector< Component< MeshType > > & metacomponents()
Returns an editable list of the metacomponents in the structure.
Structure(const MeshType &mesh, const Material background_material=PerfectDielectricMaterial(1, 1))
Constructs a Structure with a given mesh.
Definition structure.hpp:62
std::vector< MeshView< MeshType > > mesh_views_by_name(const std::string name, const bool search_metacomponents=false, const bool case_sensitive=false)
Returns a list of mesh views associated with components whose name contains a given string.
Definition structure.tpp:67
void add_metacomponent(const Component< MeshType > &metacomponent)
Adds a metaComponent to the structure which corresponds to a given subset of the mesh.
Definition structure.hpp:83
std::vector< Component< MeshType > > components_by_name(const std::string name, const bool search_metacomponents=false, const bool case_sensitive=false)
Returns a list of the components whose name contains a given string.
Definition structure.tpp:32
const Material & background_material() const
Returns the background material of the structure.
const std::vector< Component< MeshType > > & metacomponents() const
Returns a read-only list of the metacomponents in the structure.
const MeshType & mesh() const
Returns the mesh associated with the structure in read-only form.
MeshType & mesh()
Returns the mesh associated with the structure in editable form.
Definition structure.hpp:94
void add_component(const Component< MeshType > &component)
Adds a component to the structure.
Definition structure.hpp:72
Structure(const Material background_material=PerfectDielectricMaterial(1, 1))
Constructs an empty Structure.
Definition structure.hpp:52
std::vector< Component< MeshType > > & components()
Returns an editable list of the components in the structure.
Eigen::Matrix< T, N, 1 > EigColVecN
Fixed-size column vector of size N containing type T.
Definition types.hpp:86
Primary namespace for the OpenBEM library.
Definition constants.hpp:31