LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
entity.h
1#ifndef __37e385afbd3b4b1dba8611fb71787822
2#define __37e385afbd3b4b1dba8611fb71787822
3
4#include <lf/base/base.h>
5#include <lf/geometry/geometry.h>
6
7namespace lf::mesh {
8
19enum class Orientation : int { positive = 1, negative = -1 };
20
21int to_sign(Orientation o);
22char to_char(Orientation o);
23
39class Entity {
40 protected:
41 Entity() = default;
42 Entity(const Entity&) = default;
43 Entity(Entity&&) = default;
44 Entity& operator=(const Entity&) = default;
45 Entity& operator=(Entity&&) = default;
46
47 public:
52 [[nodiscard]] virtual unsigned Codim() const = 0;
53
87 unsigned rel_codim) const = 0;
88
101 const = 0;
102
117 [[nodiscard]] virtual const geometry::Geometry* Geometry() const = 0;
118
123 [[nodiscard]] virtual base::RefEl RefEl() const = 0;
124
132 [[nodiscard]] virtual bool operator==(const Entity& rhs) const = 0;
133
138 [[nodiscard]] bool operator!=(const Entity& rhs) const {
139 return !operator==(rhs);
140 }
141
145 virtual ~Entity() = default;
146
147}; // class entity
148
158std::ostream& operator<<(std::ostream& stream, const lf::mesh::Entity& entity);
159
160} // namespace lf::mesh
161
162#endif // __37e385afbd3b4b1dba8611fb71787822
Represents a reference element with all its properties.
Definition: ref_el.h:106
Interface class for shape information on a mesh cell in the spirit of parametric finite element metho...
Interface class representing a topological entity in a cellular complex
Definition: entity.h:39
Entity()=default
virtual ~Entity()=default
Virtual Destructor.
virtual bool operator==(const Entity &rhs) const =0
Check if two entities are the same.
virtual unsigned Codim() const =0
The codimension of this entity w.r.t. the Mesh.dimMesh() of the owning mesh manager.
Entity(Entity &&)=default
Entity(const Entity &)=default
virtual const geometry::Geometry * Geometry() const =0
Describes the geometry of this entity.
Entity & operator=(const Entity &)=default
virtual nonstd::span< const Entity *const > SubEntities(unsigned rel_codim) const =0
Return all sub entities of this entity that have the given codimension (w.r.t. this entity!...
bool operator!=(const Entity &rhs) const
Check if two entities are different.
Definition: entity.h:138
virtual nonstd::span< const Orientation > RelativeOrientations() const =0
return span of relative orientations of sub-entities of the next higher co-dimension.
virtual base::RefEl RefEl() const =0
Describes the reference element type of this entity.
Entity & operator=(Entity &&)=default
Defines a set of interface classes that define a mesh manager and provides mesh-related tools that bu...
Definition: entity.cc:5
char to_char(Orientation o)
Definition: entity.cc:8
std::ostream & operator<<(std::ostream &stream, const lf::mesh::Entity &entity)
Operator overload to print the reference element of Entity to a stream, such as std::cout.
Definition: entity.cc:20
int to_sign(Orientation o)
Definition: entity.cc:7
Orientation
Relative orientation of a sub-entity.
Definition: entity.h:19