Skip to content

Commit

Permalink
GRIDEDIT-1502 Fixed clang- formatting warning
Browse files Browse the repository at this point in the history
  • Loading branch information
BillSenior committed Oct 29, 2024
1 parent a09df0b commit 88cbee7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,8 @@ namespace meshkernel
void CommitAction(const ResetCurvilinearNodeAction& undoAction);

private:

/// @brief One dimensional array of NodeType
using NodeTypeArray1D = std::array<meshkernel::NodeType, 2>;
using NodeTypeArray1D = std::array<meshkernel::NodeType, 2>;

/// @brief Two dimensional array of NodeType
using NodeTypeArray2D = std::array<NodeTypeArray1D, 2>;
Expand All @@ -479,7 +478,7 @@ namespace meshkernel
using NodeTypeArray4D = std::array<NodeTypeArray3D, 2>;

/// @brief Get interior node type array
static NodeTypeArray4D InitialiseInteriorNodeType ();
static NodeTypeArray4D InitialiseInteriorNodeType();

/// @brief Remove invalid nodes.
/// This function is recursive
Expand Down Expand Up @@ -530,20 +529,19 @@ namespace meshkernel
void SetFacesRTreeRequiresUpdate(bool value) { m_facesRTreeRequiresUpdate = value; }

/// @brief Get the node type of the bottom row of nodes, m = 0
NodeType GetBottomNodeType (const UInt n) const;
NodeType GetBottomNodeType(const UInt n) const;

/// @brief Get the node type of the top row of nodes, m = NumM - 1
NodeType GetTopNodeType (const UInt n) const;
NodeType GetTopNodeType(const UInt n) const;

/// @brief Get the node type of the left row of nodes, n = 0
NodeType GetLeftNodeType (const UInt m) const;
NodeType GetLeftNodeType(const UInt m) const;

/// @brief Get the node type of the right row of nodes, m = NumN - 1
NodeType GetRightNodeType (const UInt m) const;
NodeType GetRightNodeType(const UInt m) const;

/// @brief Get the node type of the interior nodes
NodeType GetInteriorNodeType (const UInt n, const UInt m) const;

NodeType GetInteriorNodeType(const UInt n, const UInt m) const;

Projection m_projection; ///< The curvilinear grid projection
lin_alg::Matrix<Point> m_gridNodes; ///< Member variable storing the grid
Expand Down
32 changes: 14 additions & 18 deletions libs/MeshKernel/src/CurvilinearGrid/CurvilinearGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ void CurvilinearGrid::RemoveInvalidNodes(bool invalidNodesToRemove)
RemoveInvalidNodes(invalidNodesToRemove);
}

meshkernel::NodeType CurvilinearGrid::GetBottomNodeType (const UInt n) const
meshkernel::NodeType CurvilinearGrid::GetBottomNodeType(const UInt n) const
{
NodeType result = NodeType::Bottom;

Expand All @@ -454,7 +454,7 @@ meshkernel::NodeType CurvilinearGrid::GetBottomNodeType (const UInt n) const
return result;
}

meshkernel::NodeType CurvilinearGrid::GetTopNodeType (const UInt n) const
meshkernel::NodeType CurvilinearGrid::GetTopNodeType(const UInt n) const
{
NodeType result = NodeType::Up;
UInt m = NumM() - 1;
Expand All @@ -463,7 +463,7 @@ meshkernel::NodeType CurvilinearGrid::GetTopNodeType (const UInt n) const
{
result = NodeType::UpperLeft;
}
else if (n == NumN () - 1)
else if (n == NumN() - 1)
{
result = NodeType::UpperRight;
}
Expand All @@ -479,8 +479,7 @@ meshkernel::NodeType CurvilinearGrid::GetTopNodeType (const UInt n) const
return result;
}


meshkernel::NodeType CurvilinearGrid::GetLeftNodeType (const UInt m) const
meshkernel::NodeType CurvilinearGrid::GetLeftNodeType(const UInt m) const
{
NodeType result = NodeType::Left;

Expand All @@ -491,18 +490,17 @@ meshkernel::NodeType CurvilinearGrid::GetLeftNodeType (const UInt m) const
else if (!GetNode(0, m + 1).IsValid())
{
// TODO SHould this be NodeType::UpperLeft
result = NodeType::UpperLeft;//UpperRight;
result = NodeType::UpperLeft; // UpperRight;
}

return result;
}

meshkernel::NodeType CurvilinearGrid::GetRightNodeType (const UInt m) const
meshkernel::NodeType CurvilinearGrid::GetRightNodeType(const UInt m) const
{
NodeType result = NodeType::Right;
UInt n = NumN() - 1;


if (!GetNode(n, m - 1).IsValid())
{
result = NodeType::BottomRight;
Expand All @@ -515,7 +513,8 @@ meshkernel::NodeType CurvilinearGrid::GetRightNodeType (const UInt m) const
return result;
}

meshkernel::CurvilinearGrid::NodeTypeArray4D CurvilinearGrid::InitialiseInteriorNodeType () {
meshkernel::CurvilinearGrid::NodeTypeArray4D CurvilinearGrid::InitialiseInteriorNodeType()
{

NodeTypeArray4D result;

Expand All @@ -537,23 +536,20 @@ meshkernel::CurvilinearGrid::NodeTypeArray4D CurvilinearGrid::InitialiseInterior
result[1][1][1][1] = NodeType::InternalValid;

return result;

}


meshkernel::NodeType CurvilinearGrid::GetInteriorNodeType (const UInt n, const UInt m) const
meshkernel::NodeType CurvilinearGrid::GetInteriorNodeType(const UInt n, const UInt m) const
{
static const NodeTypeArray4D InteriorNodeType = InitialiseInteriorNodeType ();
static const NodeTypeArray4D InteriorNodeType = InitialiseInteriorNodeType();

const size_t isTopRightFaceValid = IsFaceMaskValid(n, m) ? 1u : 0u;
const size_t isTopLeftFaceValid = IsFaceMaskValid(n - 1, m) ? 1u : 0u;
const size_t isBottomLeftFaceValid = IsFaceMaskValid(n - 1, m - 1) ? 1u : 0u;
const size_t isBottomRightFaceValid = IsFaceMaskValid(n, m - 1) ? 1u : 0u;

return InteriorNodeType [isTopRightFaceValid][isTopLeftFaceValid][isBottomLeftFaceValid][isBottomRightFaceValid];
return InteriorNodeType[isTopRightFaceValid][isTopLeftFaceValid][isBottomLeftFaceValid][isBottomRightFaceValid];
}


void CurvilinearGrid::ComputeGridNodeTypes()
{
RemoveInvalidNodes(true);
Expand All @@ -574,14 +570,14 @@ void CurvilinearGrid::ComputeGridNodeTypes()
// Bottom side
if (m == 0)
{
GetNodeType(n, m) = GetBottomNodeType (n);
GetNodeType(n, m) = GetBottomNodeType(n);
continue;
}

// Upper side
if (m == NumM() - 1)
{
GetNodeType(n, m) = GetTopNodeType (n);
GetNodeType(n, m) = GetTopNodeType(n);
continue;
}

Expand All @@ -599,7 +595,7 @@ void CurvilinearGrid::ComputeGridNodeTypes()
continue;
}

GetNodeType(n, m) = GetInteriorNodeType (n, m);
GetNodeType(n, m) = GetInteriorNodeType(n, m);
}
}
}
Expand Down

0 comments on commit 88cbee7

Please sign in to comment.