MeshKernel
Public Types | Public Member Functions | List of all members
meshkernel::MeshRefinement Class Reference

A class used to refine a Mesh2D instance. More...

#include <MeshRefinement.hpp>

Public Types

enum  RefinementType { WaveCourant = 1, RefinementLevels = 2, RidgeDetection = 3 }
 Enumerator describing the different refinement types.
 

Public Member Functions

 MeshRefinement (Mesh2D &mesh, std::unique_ptr< MeshInterpolation > interpolant, const MeshRefinementParameters &meshRefinementParameters)
 The constructor for refining based on samples. More...
 
 MeshRefinement (Mesh2D &mesh, std::unique_ptr< MeshInterpolation > interpolant, const MeshRefinementParameters &meshRefinementParameters, bool useNodalRefinement)
 The constructor for refining based on samples. More...
 
 MeshRefinement (Mesh2D &mesh, const Polygons &polygon, const MeshRefinementParameters &meshRefinementParameters)
 The constructor for refining based on polygons. More...
 
std::unique_ptr< UndoAction > Compute ()
 Compute mesh refinement (refinecellsandfaces2). More...
 

Detailed Description

A class used to refine a Mesh2D instance.

Mesh refinement operates on Mesh2D and is based on iteratively splitting the edges until the desired level of refinement or the maximum number of iterations is reached. Refinement can be based on samples or based on a polygon. The refinement based on samples uses the averaging interpolation algorithm to compute the level of refinement from the samples to the centers of the edges. At a high level, the mesh refinement is performed as follow:

As with OrthogonalizationAndSmoothing, MeshRefinement modifies an existing Mesh2D instance.

Constructor & Destructor Documentation

◆ MeshRefinement() [1/3]

meshkernel::MeshRefinement::MeshRefinement ( Mesh2D mesh,
std::unique_ptr< MeshInterpolation interpolant,
const MeshRefinementParameters meshRefinementParameters 
)

The constructor for refining based on samples.

Parameters
[in]meshThe mesh to be refined
[in]interpolantThe averaging interpolation to use
[in]meshRefinementParametersThe mesh refinement parameters

◆ MeshRefinement() [2/3]

meshkernel::MeshRefinement::MeshRefinement ( Mesh2D mesh,
std::unique_ptr< MeshInterpolation interpolant,
const MeshRefinementParameters meshRefinementParameters,
bool  useNodalRefinement 
)

The constructor for refining based on samples.

Parameters
[in]meshThe mesh to be refined
[in]interpolantThe averaging interpolation to use
[in]meshRefinementParametersThe mesh refinement parameters
[in]useNodalRefinementUse nodal refinement

◆ MeshRefinement() [3/3]

meshkernel::MeshRefinement::MeshRefinement ( Mesh2D mesh,
const Polygons polygon,
const MeshRefinementParameters meshRefinementParameters 
)

The constructor for refining based on polygons.

Parameters
[in]meshThe mesh to be refined
[in]polygonThe polygon where to refine
[in]meshRefinementParametersThe mesh refinement parameters

Member Function Documentation

◆ Compute()

std::unique_ptr<UndoAction> meshkernel::MeshRefinement::Compute ( )

Compute mesh refinement (refinecellsandfaces2).

Steps:

  1. Masks the node to be refined (those inside a polygon)
  2. Find the brother edges, the edge sharing a hanging node, FindBrotherEdges
  3. Mask nodes at the polygon perimeter, ComputeNodeMaskAtPolygonPerimeter
  4. Do refinement iterations
    1. Find the brother edges, FindBrotherEdges
    2. Compute the edge refinement mask based on samples, ComputeRefinementMasksFromSamples
    3. Compute the edge refinement mask based on polygon, ComputeEdgesRefinementMask
    4. Compute if a face should be split, ComputeIfFaceShouldBeSplit
    5. Compute face by splitting edges, RefineFacesBySplittingEdges
  5. Connect hanging nodes if requested, DeleteIsolatedHangingnodes, connect_hanging_nodes

The documentation for this class was generated from the following file: