49 explicit Smoother(
const Mesh2D& mesh,
const std::vector<MeshNodeType>& nodeType);
57 return m_weights[node][connectedNode];
66 return m_connectedNodes[node][connectedNode];
74 return m_numConnectedNodes[node];
79 struct InternalAngleData
81 UInt numSquaredTriangles = 0;
82 UInt numTriangles = 0;
83 double phiSquaredTriangles = 0.0;
84 double phiQuads = 0.0;
85 double phiTriangles = 0.0;
90 void ComputeInternalAngle(
const UInt currentNode,
91 const UInt numSharedFaces,
92 const std::vector<double>& thetaSquare,
93 const std::vector<bool>& isSquareFace,
94 InternalAngleData& internalAngleData,
95 UInt& numNonStencilQuad);
98 void UpdateThetaForInteriorFaces(
const UInt numSharedFaces, std::vector<double>& thetaSquare);
101 void UpdateXiEtaForSharedFace(
const UInt currentNode,
102 const UInt currentFace,
103 const UInt numFaceNodes,
108 void ComputeOptimalAngleForSharedFaces(
const UInt currentNode,
109 const UInt numSharedFaces,
111 const std::vector<double>& thetaSquare,
112 const std::vector<bool>& isSquareFace,
114 const double muSquaredTriangles,
115 const double muTriangles);
122 void ComputeTopologies();
125 void ComputeOperators();
128 void ComputeWeights();
131 std::tuple<double, double> ComputeOperatorsForBoundaryNode(
const UInt f,
const UInt faceLeftIndex,
const UInt currentTopology);
134 std::tuple<double, double, double, double> ComputeOperatorsForInteriorNode(
const UInt f,
135 const UInt edgeIndex,
136 const UInt faceLeftIndex,
137 const UInt faceRightIndex,
138 const UInt currentTopology);
141 void ComputeNodeEdgeDerivative(
const UInt f,
142 const UInt edgeIndex,
143 const UInt currentTopology,
144 const UInt faceLeftIndex,
145 const UInt faceRightIndex,
147 const double facetaL,
149 const double facetaR);
158 void NodeAdministration(
UInt currentNode);
162 void ComputeNodeXiEta(
UInt currentNode);
170 [[nodiscard]]
double OptimalEdgeAngle(
UInt numFaceNodes,
171 double theta1 = -1.0,
172 double theta2 = -1.0,
173 bool isBoundaryEdge =
false)
const;
177 void AllocateNodeOperators(
UInt topologyIndex);
181 void SaveNodeTopologyIfNeeded(
UInt currentNode);
186 void ComputeJacobian(
UInt currentNode, std::vector<double>& J)
const;
189 void ComputeCellCircumcentreCoefficients(
const UInt currentNode,
const UInt currentTopology,
const MeshNodeType nodeType);
192 void ComputeNodeToNodeGradients(
const UInt currentNode,
const UInt currentTopology);
195 void ComputeLaplacianSmootherWeights(
const UInt currentNode,
const UInt currentTopology);
198 const Mesh2D& m_mesh;
200 const std::vector<MeshNodeType>& m_nodeType;
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;