bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
element.h
Go to the documentation of this file.
1#ifndef ELEMENT_H
2#define ELEMENT_H
3
5#include "bitrl/bitrl_types.h"
10
11#include <any>
12
13#include <functional>
14#include <map>
15#include <string>
16
17namespace bitrl
18{
19namespace utils
20{
21namespace geom
22{
23
24template <int dim> class Node;
25
29template <int dim> class Element : public MeshEntity
30{
31
32 public:
45
47 virtual ~Element();
48
50 virtual uint_t n_vertices() const = 0;
51
53 virtual uint_t n_nodes() const = 0;
54
56 virtual void set_node(uint_t i, node_ptr_t node);
57
59 virtual void append_node(node_ptr_t node);
60
62 virtual void resize_nodes();
63
65 virtual node_ptr_t get_node(uint_t n);
66
68 virtual uint_t n_edges() const = 0;
69
71 virtual uint_t n_faces() const = 0;
72
74 virtual void resize_faces() = 0;
75
77 virtual cface_ref_t get_face(uint_t f) const = 0;
78
81
83 virtual void set_face(uint_t f, face_ptr_t face) = 0;
84
87
89 virtual uint_t n_neighbors() const = 0;
90
92 virtual void resize_neighbors();
93
95 virtual cneighbor_ref_t get_neighbor(uint_t n) const;
96
99
101 virtual const neighbor_ptr_t neighbor_ptr(uint_t n) const;
102
105 virtual void face_vertices(uint_t f, std::vector<uint_t> &ids) const = 0;
106
108 virtual real_t volume() const = 0;
109
112 virtual GeomPoint<dim> centroid() const;
113
116 virtual uint_t which_face_am_i(cface_ref_t face) const = 0;
117
119 virtual const DynVec<real_t> face_normal_vector(uint_t f) const = 0;
120
123 uint_t which_neighbor_am_i(const Element<dim> &element) const;
124
126 std::vector<node_ptr_t> get_vertices() const;
127
128 protected:
130 Element();
131
134
136 Element(uint_t id, uint_t pid, const std::any &data);
137
139 std::vector<neighbor_ptr_t> neginbors_;
140
142 std::vector<node_ptr_t> nodes_;
143};
144
145} // namespace geom
146
147} // namespace utils
148} // namespace bitrl
149
150#endif // ELEMENT_H
Wraps the notion of an element.
Definition element.h:30
virtual uint_t n_nodes() const =0
How many nodes the element has.
virtual uint_t n_faces() const =0
How many faces the element has.
virtual GeomPoint< dim > centroid() const
Returns the average location of the vertices of the element.
Definition element.cpp:147
virtual void resize_neighbors()
Reserve space for neighbors.
Definition element.cpp:36
element_traits< Element< dim > >::edge_ref_t edge_ref_t
Definition element.h:39
std::vector< node_ptr_t > get_vertices() const
Return the vertices of the element.
Definition element.cpp:161
virtual uint_t n_edges() const =0
How many edges the element has.
element_traits< Element< dim > >::face_ref_t face_ref_t
Definition element.h:43
element_traits< Element< dim > >::cedge_ref_t cedge_ref_t
Definition element.h:40
virtual node_ptr_t get_node(uint_t n)
Returns the i-th node.
Definition element.cpp:88
virtual const DynVec< real_t > face_normal_vector(uint_t f) const =0
Returns the face normal vector.
Element()
Constructor.
Definition element.cpp:13
virtual uint_t which_face_am_i(cface_ref_t face) const =0
Returns the local id relevant to the calling object of the passed object.
virtual void append_node(node_ptr_t node)
Append a node to the nodes list.
Definition element.cpp:72
element_traits< Element< dim > >::cface_ref_t cface_ref_t
Definition element.h:44
element_traits< Element< dim > >::cface_ptr_t cface_ptr_t
Definition element.h:42
element_traits< Element< dim > >::edge_ptr_t edge_ptr_t
Definition element.h:37
uint_t which_neighbor_am_i(const Element< dim > &element) const
Returns the local id relevant to the calling object of the passed object.
Definition element.cpp:128
virtual ~Element()
Destructor.
Definition element.cpp:27
Element< dim > * neighbor_ptr_t
Definition element.h:33
std::vector< neighbor_ptr_t > neginbors_
The neighbors of the element.
Definition element.h:139
virtual real_t volume() const =0
Returns the volume of the element.
virtual cface_ref_t get_face(uint_t f) const =0
Returns the f-face.
element_traits< Element< dim > >::face_ptr_t face_ptr_t
Definition element.h:41
virtual void face_vertices(uint_t f, std::vector< uint_t > &ids) const =0
Returns the node ids of the vertices of the given face.
virtual uint_t n_vertices() const =0
How many vertices the element has.
element_traits< Element< dim > >::cedge_ptr_t cedge_ptr_t
Definition element.h:38
virtual uint_t n_neighbors() const =0
Returns the number of neighbors.
virtual face_ref_t get_face(uint_t f)=0
Returns the f-face.
Element< dim > & neighbor_ref_t
Definition element.h:34
virtual cneighbor_ref_t get_neighbor(uint_t n) const
Access the n-th neighbor.
Definition element.cpp:100
virtual neighbor_ptr_t neighbor_ptr(uint_t n)
Access the n-th neighbor pointer.
Definition element.cpp:31
const Element< dim > & cneighbor_ref_t
Definition element.h:35
std::vector< node_ptr_t > nodes_
The nodes of the element.
Definition element.h:142
virtual void resize_nodes()
Reserve space for nodes.
Definition element.cpp:29
virtual void resize_faces()=0
Resize the space for the faces.
virtual void set_node(uint_t i, node_ptr_t node)
Set the i-th node.
Definition element.cpp:54
Node< dim > * node_ptr_t
Definition element.h:36
virtual void set_neighbor(uint_t n, neighbor_ptr_t neigh)
Set the i-th neighbor.
Definition element.cpp:42
virtual void set_face(uint_t f, face_ptr_t face)=0
Set the f-th face of the element.
A class that describes a point with spacedim spatial dimension space.
Definition geom_point.h:22
Helper class that wraps non template dependent parameters and common to every mesh entity.
Definition mesh_entity.h:23
Wraps the notion of a node. A node is simply a point in dim-space that can hold dofs.
Definition node.h:24
OutT resolve(const std::string &name, const std::map< std::string, std::any > &input)
Definition std_map_utils.h:25
Definition bitrl_consts.h:14
double real_t
real_t
Definition bitrl_types.h:23
Eigen::RowVectorX< T > DynVec
Dynamically sized row vector.
Definition bitrl_types.h:74
std::size_t uint_t
uint_t
Definition bitrl_types.h:43
Definition element_traits.h:16