35#include "MeshKernel/Constants.hpp"
36#include "MeshKernel/Definitions.hpp"
37#include "MeshKernel/Entities.hpp"
38#include "MeshKernel/Exceptions.hpp"
39#include "MeshKernel/Operations.hpp"
40#include "MeshKernel/Point.hpp"
41#include "MeshKernel/Utilities/RTreeFactory.hpp"
47 template <const UInt Dimension>
60 if (m_size == Dimension - 1)
65 m_indices[m_size] = index;
72 return m_indices[index];
78 return m_indices[index];
82 std::array<UInt, Dimension>::const_iterator
begin()
const
84 return m_indices.begin();
82 std::array<UInt, Dimension>::const_iterator
begin()
const {
…}
88 std::array<UInt, Dimension>::const_iterator
end()
const
90 return m_indices.begin() + m_size;
88 std::array<UInt, Dimension>::const_iterator
end()
const {
…}
101 std::array<UInt, Dimension> m_indices;
120 const std::span<const double> yNodes,
162 static constexpr UInt MaximumNumberOfEdgesPerNode = 16;
165 void Compute(
const std::span<const double>& xNodes,
166 const std::span<const double>& yNodes);
168 std::vector<Point> m_nodes;
169 std::vector<UInt> m_faceNodes;
170 std::vector<UInt> m_edgeNodes;
171 std::vector<UInt> m_faceEdges;
172 std::vector<std::array<UInt, 2>> m_edgesFaces;
173 std::vector<std::vector<UInt>> m_nodesEdges;
175 std::vector<Point> m_elementCentres;
180 Projection m_projection = Projection::cartesian;
181 std::unique_ptr<RTreeBase> m_elementCentreRTree;
182 std::unique_ptr<RTreeBase> m_nodeRTree;
194 return static_cast<UInt>(m_nodes.size());
209 if (nodeId == constants::missing::uintValue)
214 if (nodeId >= NumberOfNodes())
216 throw ConstraintError(
"node id out of range: {} >= {}", nodeId, NumberOfNodes());
219 return m_nodes[nodeId];
224 if (edgeId == constants::missing::uintValue)
229 if (edgeId >= m_numEdges)
231 throw ConstraintError(
"edge id out of range: {} >= {}", edgeId, m_numEdges);
234 return {m_edgeNodes[2 * edgeId], m_edgeNodes[2 * edgeId + 1]};
239 if (edgeId == constants::missing::uintValue)
244 if (edgeId >= m_numEdges)
246 throw ConstraintError(
"edge id out of range: {} >= {}", edgeId, m_numEdges);
249 return m_edgesFaces[edgeId];
A simple bounded stack.
Definition MeshTriangulation.hpp:49
std::array< UInt, Dimension >::const_iterator begin() const
The iterator at the start of the array.
Definition MeshTriangulation.hpp:82
UInt & operator[](const UInt index)
Get the element at the position.
Definition MeshTriangulation.hpp:76
bool contains(const UInt index) const
Does the array contain the element value or not.
Definition MeshTriangulation.hpp:94
UInt size() const
Number of elements in the array.
Definition MeshTriangulation.hpp:52
void push_back(const UInt index)
Add an element to the end of the array.
Definition MeshTriangulation.hpp:58
UInt operator[](const UInt index) const
Get the element at the position.
Definition MeshTriangulation.hpp:70
std::array< UInt, Dimension >::const_iterator end() const
The iterator at the end of the array.
Definition MeshTriangulation.hpp:88
An exception class thrown when an attempt is made that violates a range constraint.
Definition Exceptions.hpp:267
Contains a mesh triangulated from a set of points.
Definition MeshTriangulation.hpp:112
const std::array< UInt, 2 > & GetFaceIds(const UInt edgeId) const
Get the id's of faces either side of the edge.
Definition MeshTriangulation.hpp:237
UInt NumberOfFaces() const
Get the number of faces/elements in the triangulation.
Definition MeshTriangulation.hpp:202
bool PointIsInElement(const Point &pnt, const UInt faceId) const
Determine if the point lies within the element.
std::array< Point, 3 > GetNodes(const UInt faceId) const
Get the node values of the element.
std::array< UInt, 3 > GetEdgeIds(const UInt faceId) const
Get the edge id's of the element.
Point GetNode(const UInt nodeId) const
Get node as the position.
Definition MeshTriangulation.hpp:207
MeshTriangulation(const std::span< const Point > nodes, const Projection projection)
Constructor with array of points.
UInt NumberOfNodes() const
Get the number of nodes in the triangulation.
Definition MeshTriangulation.hpp:192
MeshTriangulation(const std::span< const double > xNodes, const std::span< const double > yNodes, const Projection projection)
Constructor with separate arrays of x- and y-coordinates.
Edge GetEdge(const UInt nodeId) const
Get edge as the position.
Definition MeshTriangulation.hpp:222
Projection GetProjection() const
Get the projection type used in the triangulation.
Definition MeshTriangulation.hpp:187
UInt FindNearestFace(const Point &pnt) const
Find the nearest face to the point.
UInt NumberOfEdges() const
Get the number of edges in the triangulation.
Definition MeshTriangulation.hpp:197
std::array< UInt, 3 > GetNodeIds(const UInt faceId) const
Get the node id's of the element.
A struct describing a point in a two-dimensional space.
Definition Point.hpp:41
Contains the logic of the C++ static library.
Definition AveragingInterpolation.hpp:37
std::pair< UInt, UInt > Edge
Describes an edge with two indices.
Definition Entities.hpp:50
Projection
Enumerator describing the supported projections.
Definition Definitions.hpp:43
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition Definitions.hpp:39