Skip to content

Commit

Permalink
GRIDEDIT-1548 Fixed clang formating and doxygen warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
BillSenior committed Dec 16, 2024
1 parent 5d73d56 commit 52fde8f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
29 changes: 15 additions & 14 deletions libs/MeshKernel/include/MeshKernel/MeshTriangulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,21 @@
namespace meshkernel
{

/// @brief A simple bounded array
template <const UInt Dimension>
class BoundedArray
{
public:
/// @brief Constructor
BoundedArray() : m_size(0) {}

/// @brief Number of elements inthe array

Check failure on line 55 in libs/MeshKernel/include/MeshKernel/MeshTriangulation.hpp

View workflow job for this annotation

GitHub Actions / Codespell Check

inthe ==> in the
UInt size() const
{
return m_size;
}

/// @brief Add an element to the end of the array
void push_back(const UInt index)
{
if (m_size == Dimension - 1)
Expand All @@ -67,46 +71,41 @@ namespace meshkernel
++m_size;
}

/// @brief Get the element at the position
UInt operator[](const UInt index) const
{
return m_indices[index];
}

/// @brief Get the element at the position
UInt& operator[](const UInt index)
{
return m_indices[index];
}

// begin and end (probably const only needed) for stl algos

// auto begin() const
// {
// return m_indices.begin();
// }

// auto end() const
// {
// return m_indices.begin() + m_size;
// }

/// @brief The iterator at the start of the array
std::array<UInt, Dimension>::const_iterator begin() const
{
return m_indices.begin();
}

/// @brief The iterator at the end of the array
std::array<UInt, Dimension>::const_iterator end() const
{
return m_indices.begin() + m_size;
}

/// @brief Does the array contain the element value or not.
bool contains(const UInt index) const
{
return std::find(begin(), end(), index) != end();
}

private:
// std::vector<UInt> m_indices;
/// @brief stack based array containing the values.
std::array<UInt, Dimension> m_indices;

/// @brief The current number of elements in the array
UInt m_size = 0;
};

Expand Down Expand Up @@ -155,6 +154,9 @@ namespace meshkernel
/// @brief Get the edge id's of the element
std::array<UInt, 3> GetEdgeIds(const UInt faceId) const;

/// @brief Get the id's of faces either side of the edge.
///
/// May return invalid identifier in one or both values
const std::array<UInt, 2>& GetFaceIds(const UInt edgeId) const;

/// @brief Find the nearest face to the point
Expand All @@ -179,7 +181,6 @@ namespace meshkernel
std::vector<UInt> m_faceEdges; ///< Face edges flat array passed to the triangulation library
std::vector<std::array<UInt, 2>> m_edgesFaces; ///< edge-face connectivity, generated from triangulation data
std::vector<std::vector<UInt>> m_nodesEdges; ///< node-edge connectivity, generated from triangulation data
// std::vector<BoundedArray<2 * MaximumNumberOfEdgesPerNode>> m_nodesEdges; ///< node-edge connectivity, generated from triangulation data

std::vector<Point> m_elementCentres; ///< Array of the centres of the elements

Expand Down
10 changes: 7 additions & 3 deletions libs/MeshKernel/src/Utilities/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ void meshkernel::PrintVtk(const std::vector<Point>& nodes, const std::vector<std
vtkFile << " <UnstructuredGrid>" << std::endl;

vtkFile << " <Piece"
<< " NumberOfPoints=\"" << nodes.size() << "\""
<< " NumberOfCells=\"" << numberOfElements << "\">"
<< " NumberOfPoints=\""
<< nodes.size() << "\""
<< " NumberOfCells=\""
<< numberOfElements
<< "\">"
<< std::endl;

vtkFile << " <Points>" << std::endl;
Expand All @@ -82,7 +85,8 @@ void meshkernel::PrintVtk(const std::vector<Point>& nodes, const std::vector<std
<< "\" Name=\""
<< "connectivity"
<< "\" format=\""
<< "ascii" << "\">"
<< "ascii"
<< "\">"
<< std::endl;

for (size_t i = 0; i < faces.size(); ++i)
Expand Down

0 comments on commit 52fde8f

Please sign in to comment.