30 #include "MeshKernel/Constants.hpp"
56 return m_weights[node][connectedNode];
65 return m_connectedNodes[node][connectedNode];
73 return m_numConnectedNodes[node];
78 struct InternalAngleData
80 UInt numSquaredTriangles = 0;
81 UInt numTriangles = 0;
82 double phiSquaredTriangles = 0.0;
83 double phiQuads = 0.0;
84 double phiTriangles = 0.0;
89 void ComputeInternalAngle(
const UInt currentNode,
90 const UInt numSharedFaces,
91 const std::vector<double>& thetaSquare,
92 const std::vector<bool>& isSquareFace,
93 InternalAngleData& internalAngleData,
94 UInt& numNonStencilQuad);
97 void UpdateThetaForInteriorFaces(
const UInt numSharedFaces, std::vector<double>& thetaSquare);
100 void UpdateXiEtaForSharedFace(
const UInt currentNode,
101 const UInt currentFace,
102 const UInt numFaceNodes,
107 void ComputeOptimalAngleForSharedFaces(
const UInt currentNode,
108 const UInt numSharedFaces,
109 const std::vector<double>& thetaSquare,
110 const std::vector<bool>& isSquareFace,
112 const double muSquaredTriangles,
113 const double muTriangles);
120 void ComputeTopologies();
123 void ComputeOperators();
128 bool ComputeCoordinates();
131 void ComputeWeights();
134 std::tuple<double, double> ComputeOperatorsForBoundaryNode(
const UInt f,
const UInt faceLeftIndex,
const UInt currentTopology);
137 std::tuple<double, double, double, double> ComputeOperatorsForInteriorNode(
const UInt f,
138 const UInt edgeIndex,
139 const UInt faceLeftIndex,
140 const UInt faceRightIndex,
141 const UInt currentTopology);
144 void ComputeNodeEdgeDerivative(
const UInt f,
145 const UInt edgeIndex,
146 const UInt currentTopology,
147 const UInt faceLeftIndex,
148 const UInt faceRightIndex,
150 const double facetaL,
152 const double facetaR);
156 void ComputeOperatorsNode(
UInt currentNode);
160 void NodeAdministration(
UInt currentNode);
164 void ComputeNodeXiEta(
UInt currentNode);
172 [[nodiscard]]
double OptimalEdgeAngle(
UInt numFaceNodes,
173 double theta1 = -1.0,
174 double theta2 = -1.0,
175 bool isBoundaryEdge =
false)
const;
179 void AllocateNodeOperators(
UInt topologyIndex);
183 void SaveNodeTopologyIfNeeded(
UInt currentNode);
188 void ComputeJacobian(
UInt currentNode, std::vector<double>& J)
const;
191 void ComputeCellCircumcentreCoefficients(
const UInt currentNode,
const UInt currentTopology);
194 void ComputeNodeToNodeGradients(
const UInt currentNode,
const UInt currentTopology);
197 void ComputeLaplacianSmootherWeights(
const UInt currentNode,
const UInt currentTopology);
200 const Mesh2D& m_mesh;
203 std::vector<std::vector<double>> m_weights;
206 std::vector<std::vector<std::vector<double>>> m_Gxi;
207 std::vector<std::vector<std::vector<double>>> m_Geta;
208 std::vector<std::vector<double>> m_Divxi;
209 std::vector<std::vector<double>> m_Diveta;
210 std::vector<std::vector<std::vector<double>>> m_Az;
211 std::vector<std::vector<double>> m_Jxi;
212 std::vector<std::vector<double>> m_Jeta;
213 std::vector<std::vector<double>> m_ww2;
216 std::vector<UInt> m_sharedFacesCache;
217 std::vector<UInt> m_connectedNodesCache;
218 std::vector<std::vector<UInt>> m_faceNodeMappingCache;
219 std::vector<double> m_xiCache;
220 std::vector<double> m_etaCache;
221 std::vector<double> m_leftXFaceCenterCache;
222 std::vector<double> m_leftYFaceCenterCache;
223 std::vector<double> m_rightXFaceCenterCache;
224 std::vector<double> m_rightYFaceCenterCache;
225 std::vector<double> m_xisCache;
226 std::vector<double> m_etasCache;
229 std::vector<UInt> m_nodeTopologyMapping;
230 std::vector<std::vector<double>> m_topologyXi;
231 std::vector<std::vector<double>> m_topologyEta;
232 std::vector<std::vector<UInt>> m_topologySharedFaces;
233 std::vector<std::vector<std::vector<UInt>>> m_topologyFaceNodeMapping;
234 std::vector<std::vector<UInt>> m_topologyConnectedNodes;
236 std::vector<UInt> m_numConnectedNodes;
237 std::vector<std::vector<UInt>> m_connectedNodes;
240 UInt m_maximumNumConnectedNodes = 0;
241 UInt m_maximumNumSharedFaces = 0;
243 static constexpr
int m_topologyInitialSize = 10;
244 static constexpr
double m_thetaTolerance = 1e-4;