77 enum class FaceLocation
100 std::unique_ptr<MeshInterpolation> interpolant,
111 std::unique_ptr<MeshInterpolation> interpolant,
113 bool useNodalRefinement);
136 [[nodiscard]] std::unique_ptr<UndoAction>
Compute();
140 void FindBrotherEdges();
144 void ComputeNodeMaskAtPolygonPerimeter();
147 void ComputeRefinementMasksFromSamples();
150 void ComputeRefinementMaskFromEdgeSize();
153 void ComputeRefinementMasksForRefinementLevels(
UInt face,
154 size_t& numberOfEdgesToRefine,
155 std::vector<UInt>& edgeToRefine)
const;
158 bool DetermineRequiredRefinement(
const UInt face,
159 const UInt edge)
const;
162 void ResetNumberOfEdgesToRefineForFace(
const UInt face,
163 const std::vector<UInt>& edgeToRefine,
164 size_t& numberOfEdgesToRefine)
const;
167 void DetermineEdgesToRefine(
const UInt face,
168 std::vector<UInt>& edgeToRefine,
169 size_t& numberOfEdgesToRefine)
const;
172 void ComputeRefinementMasksForWaveCourant(
UInt face,
173 size_t& numberOfEdgesToRefine,
174 std::vector<UInt>& edgeToRefine);
177 void ComputeRefinementMasksForRidgeDetection(
UInt face,
178 size_t& numberOfEdgesToRefine,
179 std::vector<UInt>& edgeToRefine)
const;
184 void ComputeRefinementMasksFromSamples(
UInt face);
187 void ComputeEdgesRefinementMask();
191 void FindHangingNodes(
UInt face);
195 UInt CountHangingNodes()
const;
199 UInt CountHangingEdges()
const;
204 UInt CountEdgesToRefine(
UInt face)
const;
207 void UpdateFaceMask(
const int level);
212 [[nodiscard]]
UInt DeleteIsolatedHangingnodes();
216 void ConnectOneHangingNodeForQuadrilateral(
const UInt numNonHangingNodes,
217 const std::vector<UInt>& edgeEndNodeCache,
218 std::vector<UInt>& hangingNodeCache,
219 CompoundUndoAction& hangingNodeAction);
222 void ConnectTwoHangingNodesForQuadrilateral(
const UInt numNonHangingNodes,
223 const std::vector<UInt>& edgeEndNodeCache,
224 std::vector<UInt>& hangingNodeCache,
225 CompoundUndoAction& hangingNodeAction);
228 void ConnectOneHangingNodeForTriangle(
const UInt numNonHangingNodes,
229 const std::vector<UInt>& edgeEndNodeCache,
230 std::vector<UInt>& hangingNodeCache,
231 CompoundUndoAction& hangingNodeAction);
234 void ConnectTwoHangingNodesForTriangle(
const UInt numNonHangingNodes,
235 std::vector<UInt>& hangingNodeCache,
236 CompoundUndoAction& hangingNodeAction);
239 std::unique_ptr<meshkernel::UndoAction> ConnectHangingNodes();
242 void FindEdgesToSplit(
const UInt faceId,
244 std::vector<bool>& splitEdge)
const;
247 void UpdateFaceRefinementMask(std::vector<bool>& splitEdge);
250 void UpdateEdgeRefinementMask();
253 void SmoothRefinementMasks();
256 bool IsSplittingIsRequiredForFace(
const UInt faceId)
const;
260 UInt UpdateEdgeMaskForNonHangingEdge(
const UInt faceId,
261 const UInt numFaceNodes,
266 void ComputeIfFaceShouldBeSplit();
269 Point ComputeMidPoint(
const Point& firstNode,
const Point& secondNode)
const;
272 int DetermineNodeMaskValue(
const int firstNodeMask,
const int secondNodeMask)
const;
275 bool DetermineIfParentIsCrossed(
const UInt faceId,
const UInt numEdges)
const;
278 bool FindNonHangingNodeEdges(
const UInt faceId,
280 std::vector<UInt>& notHangingFaceNodes,
281 std::vector<UInt>& nonHangingEdges,
282 UInt& numBrotherEdges)
const;
285 void ComputeSplittingNode(
const UInt faceId,
286 std::vector<Point>& facePolygonWithoutHangingNodes,
287 std::vector<UInt>& localEdgesNumFaces,
288 Point& splittingNode)
const;
291 void FindFacePolygonWithoutHangingNodes(
const UInt faceId,
292 const std::vector<UInt>& nonHangingEdges,
293 std::vector<Point>& facePolygonWithoutHangingNodes,
294 std::vector<UInt>& localEdgesNumFaces)
const;
297 void SplitEdges(
const bool isParentCrossed,
298 const std::vector<UInt>& localEdgesNumFaces,
299 const std::vector<UInt>& notHangingFaceNodes,
300 const Point& splittingNode,
301 CompoundUndoAction& refineFacesAction);
304 std::unique_ptr<meshkernel::UndoAction> RefineFacesBySplittingEdges();
310 bool IsEdgeToBeRefinedBasedFaceLocationTypeAndCourantCriteria(
UInt edge, FaceLocation faceLocationType)
const;
316 bool IsRefineNeededBasedOnCourantCriteria(
UInt edge,
double depthValues)
const;
319 void ComputeFaceLocationTypes();
322 void ComputeEdgeBelowMinSizeAfterRefinement();
324 std::unique_ptr<RTreeBase> m_samplesRTree;
326 std::vector<int> m_faceMask;
327 std::vector<int> m_edgeMask;
328 std::vector<bool> m_isEdgeBelowMinSizeAfterRefinement;
329 std::vector<int> m_nodeMask;
330 std::vector<UInt> m_brotherEdges;
333 std::vector<bool> m_isHangingNodeCache;
334 std::vector<bool> m_isHangingEdgeCache;
335 std::vector<Point> m_polygonNodesCache;
336 std::vector<UInt> m_localNodeIndicesCache;
337 std::vector<UInt> m_globalEdgeIndicesCache;
338 std::vector<UInt> m_refineEdgeCache;
339 std::vector<FaceLocation> m_faceLocationType;
340 std::vector<double> m_edgeLengths;
343 bool m_directionalRefinement =
false;
346 std::unique_ptr<MeshInterpolation> m_interpolant;
349 bool m_useNodalRefinement =
false;
350 const double m_mergingDistance = 0.001;
351 bool m_isRefinementBasedOnSamples =
false;