OGS
EdgeReturn.cpp
Go to the documentation of this file.
1
11#include "EdgeReturn.h"
12
13#include "BaseLib/Logging.h"
14#include "Element.h"
15#include "Line.h"
16#include "MeshLib/Node.h"
17
18namespace MeshLib
19{
20const Element* LinearEdgeReturn::getEdge(const Element* e, unsigned i)
21{
22 if (i < e->getNumberOfEdges())
23 {
24 auto** nodes = new Node*[2];
25 nodes[0] = const_cast<Node*>(e->getEdgeNode(i, 0));
26 nodes[1] = const_cast<Node*>(e->getEdgeNode(i, 1));
27 return new Line(nodes, e->getID());
28 }
29 ERR("Error in MeshLib::Element::getEdge() - Index does not exist.");
30 return nullptr;
31}
32
33const Element* QuadraticEdgeReturn::getEdge(const Element* e, unsigned i)
34{
35 if (i < e->getNumberOfEdges())
36 {
37 auto** nodes = new Node*[3];
38 nodes[0] = const_cast<Node*>(e->getEdgeNode(i, 0));
39 nodes[1] = const_cast<Node*>(e->getEdgeNode(i, 1));
40 nodes[2] = const_cast<Node*>(e->getEdgeNode(i, 2));
41 return new Line3(nodes, e->getID());
42 }
43 ERR("Error in MeshLib::Element::getEdge() - Index does not exist.");
44 return nullptr;
45}
46
47} // namespace MeshLib
Definition of the Element class.
Definition of the Line class.
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:45
Definition of the Node class.
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
virtual Node * getEdgeNode(unsigned edge_id, unsigned node_id) const =0
Return a specific edge node.
static const Element * getEdge(const Element *e, unsigned i)
Returns i-th edge of the given element.
static const Element * getEdge(const Element *e, unsigned i)
Returns i-th edge of the given element.
TemplateElement< MeshLib::LineRule2 > Line
Definition Line.h:25
TemplateElement< MeshLib::LineRule3 > Line3
Definition Line.h:26