LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
entity.h
1#ifndef INCG37e385afbd3b4b1dba8611fb71787822
2#define INCG37e385afbd3b4b1dba8611fb71787822
3
4#include <fmt/ostream.h>
5#include <lf/base/base.h>
6#include <lf/geometry/geometry.h>
7
8#include <span>
9
10namespace lf::mesh {
11
22enum class Orientation : int { positive = 1, negative = -1 };
23
24int to_sign(Orientation o);
25char to_char(Orientation o);
26
42class Entity {
43 protected:
44 Entity() = default;
45 Entity(const Entity&) = default;
46 Entity(Entity&&) = default;
47 Entity& operator=(const Entity&) = default;
48 Entity& operator=(Entity&&) = default;
49
50 public:
55 [[nodiscard]] virtual unsigned Codim() const = 0;
56
89 [[nodiscard]] virtual std::span<const Entity* const> SubEntities(
90 unsigned rel_codim) const = 0;
91
103 [[nodiscard]] virtual std::span<const Orientation> RelativeOrientations()
104 const = 0;
105
120 [[nodiscard]] virtual const geometry::Geometry* Geometry() const = 0;
121
126 [[nodiscard]] virtual base::RefEl RefEl() const = 0;
127
135 [[nodiscard]] virtual bool operator==(const Entity& rhs) const = 0;
136
141 [[nodiscard]] bool operator!=(const Entity& rhs) const {
142 return !operator==(rhs);
143 }
144
148 virtual ~Entity() = default;
149
150}; // class entity
151
161std::ostream& operator<<(std::ostream& stream, const lf::mesh::Entity& entity);
162
163} // namespace lf::mesh
164
166
170template <>
171struct fmt::formatter<lf::mesh::Entity> : ostream_formatter {};
173
174#endif // INCG37e385afbd3b4b1dba8611fb71787822
Represents a reference element with all its properties.
Definition ref_el.h:109
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:42
Entity()=default
virtual ~Entity()=default
Virtual Destructor.
virtual std::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!...
virtual bool operator==(const Entity &rhs) const =0
Check if two entities are the same.
virtual std::span< const Orientation > RelativeOrientations() const =0
return span of relative orientations of sub-entities of the next higher co-dimension.
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
bool operator!=(const Entity &rhs) const
Check if two entities are different.
Definition entity.h:141
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:22
Definition assemble.h:31