OpenBEM
Open-source framework for electromagnetic simulation with the boundary element method.
Loading...
Searching...
No Matches
component.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_COMPONENT_H
19#define BEM_COMPONENT_H
20
21#include <string>
22#include <memory>
23
24
25namespace bem
26{
27
28// Forward declarations
29template <typename MeshType> class MeshView;
30class Material;
31
41template <typename MeshType>
43{
44public:
45
52 template <typename MaterialType>
55 const MaterialType& material,
56 const std::string name = "component"
57 ):
58 mesh_view_(mesh_view),
59 material_(std::make_shared<MaterialType> (material)),
60 name_(name) {};
61
62
68 template <typename MaterialType>
71 const std::string name = "component"
72 ):
73 mesh_view_(mesh_view),
74 material_(std::make_shared<PerfectDielectricMaterial> (PerfectDielectricMaterial(1, 1))),
75 name_(name) {};
76
77
83 { return mesh_view_; };
84
85
90 const Material& material() const
91 { return *material_; };
92
93
98 MeshType mesh() const
99 { return mesh_view_.mesh(); };
100
101
106 const std::string& name() const { return name_; };
107
108
113 template <typename MaterialType>
114 void set_material(const MaterialType& material)
115 { material_ = std::make_shared<MaterialType> (material); return; };
116
117
122 void set_name(const std::string& name)
123 { name_ = name; return; };
124
125
126private:
127
128 const MeshView<MeshType> mesh_view_;
129 std::shared_ptr<Material> material_ = std::make_shared<PerfectDielectricMaterial> (
131 );
132 std::string name_ = "component";
133
134};
135
140}
141
142#endif
Class that defines a component in a structure.
Definition component.hpp:43
const MeshView< MeshType > & mesh_view() const
Returns the mesh view associated with the component.
Definition component.hpp:82
void set_material(const MaterialType &material)
Sets the material of the component.
const std::string & name() const
Returns the name of the component.
Component(const MeshView< MeshType > &mesh_view, const MaterialType &material, const std::string name="component")
Constructs a Component with a mesh view and associated material.
Definition component.hpp:53
MeshType mesh() const
Returns the mesh associated with the component.
Definition component.hpp:98
const Material & material() const
Returns the material associated with the component.
Definition component.hpp:90
Component(const MeshView< MeshType > &mesh_view, const std::string name="component")
Constructs a Component with a mesh view.
Definition component.hpp:69
void set_name(const std::string &name)
Sets the name of the component.
Class defining a general material with a constant (zero or non-zero) electrical conductivity and real...
Definition materials.hpp:43
Class that provides a lightweight view into a MeshBase object.
Definition base.hpp:185
Class defining a perfect lossless dielectric material.
Primary namespace for the OpenBEM library.
Definition constants.hpp:31