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

A class describing an 1d-2d contacts. More...

#include <Contacts.hpp>

Public Member Functions

 Contacts (Mesh1D &mesh1d, Mesh2D &mesh2d)
 Constructor taking the 1d and 2d meshes to connect. More...
 
void ComputeSingleContacts (const std::vector< bool > &oneDNodeMask, const Polygons &polygons, double projectionFactor)
 Computes 1d-2d contacts, where every single 1d node is connected to one 2d face circumcenter (ggeo_make1D2Dinternalnetlinks_dll). More...
 
void ComputeMultipleContacts (const std::vector< bool > &oneDNodeMask)
 Computes 1d-2d contacts, where a single 1d node is connected to multiple 2d face circumcenters (ggeo_make1D2Dembeddedlinks_dll). More...
 
void ComputeContactsWithPolygons (const std::vector< bool > &oneDNodeMask, const Polygons &polygons)
 Computes 1d-2d contacts, where a 2d face per polygon is connected to the closest 1d node (ggeo_make1D2Droofgutterpipes_dll). More...
 
void ComputeContactsWithPoints (const std::vector< bool > &oneDNodeMask, const std::vector< Point > &points)
 Computes 1d-2d contacts, where 1d nodes are connected to the 2d faces mass centers containing the input point (ggeo_make1D2Dstreetinletpipes_dll). More...
 
void ComputeBoundaryContacts (const std::vector< bool > &oneDNodeMask, const Polygons &polygons, double searchRadius)
 Computes 1d-2d contacts, where 1d nodes are connected to the closest 2d faces at the boundary (ggeo_make1D2DRiverLinks_dll). More...
 
std::vector< UInt > const & Mesh1dIndices () const
 Gets the 1d mesh indices. More...
 
std::vector< UInt > const & Mesh2dIndices () const
 Gets the 2d mesh indices. More...
 
void SetIndices (const std::vector< meshkernel::UInt > &mesh1dIndices, const std::vector< meshkernel::UInt > &mesh2dIndices)
 Sets the 1d and 2d mesh indices. More...
 
bool AreComputed () const
 checks whether contacts have been computed More...
 

Detailed Description

A class describing an 1d-2d contacts.

The responsibility of the Contacts class is connecting a 1d mesh to a 2d mesh. The class has a reference to the Mesh1D and the Mesh2D instances that will be connected. A contact is defined by the indices of the connected 1d node and 2d face.

Constructor & Destructor Documentation

◆ Contacts()

meshkernel::Contacts::Contacts ( Mesh1D mesh1d,
Mesh2D mesh2d 
)

Constructor taking the 1d and 2d meshes to connect.

Parameters
[in]mesh1dThe mesh1d to connect
[in]mesh2dThe mesh2d to connect

Member Function Documentation

◆ AreComputed()

bool meshkernel::Contacts::AreComputed ( ) const
inline

checks whether contacts have been computed

Returns
True if the contact is crossing an existing contact

◆ ComputeBoundaryContacts()

void meshkernel::Contacts::ComputeBoundaryContacts ( const std::vector< bool > &  oneDNodeMask,
const Polygons polygons,
double  searchRadius 
)

Computes 1d-2d contacts, where 1d nodes are connected to the closest 2d faces at the boundary (ggeo_make1D2DRiverLinks_dll).

The algorithms works as follows:

  • For each 1d node, find the closest 2d boundary faces within the search radius.
  • If a boundary face can be connected to multiple oned nodes, choose the closest one.
  • Generate the 1d-2d contacts.Index m_numM = 0; ///< Number of columns in the curvilinear grid
    1d mesh connecting to 2d mesh using the ComputeBoundaryContacts algorithm. Contacts are shown in red.
    The mesh 2d boundary faces are connected to the closest 1d nodes."
Parameters
[in]oneDNodeMaskThe mask to apply to 1d nodes (true = connect node, false = do not generate contacts)
[in]polygonsThe polygons selecting the area where the 1d-2d contacts will be generated.
[in]searchRadiusThe radius used for searching neighboring faces, if equal to constants::missing::doubleValue, the search radius will be calculated internally.

◆ ComputeContactsWithPoints()

void meshkernel::Contacts::ComputeContactsWithPoints ( const std::vector< bool > &  oneDNodeMask,
const std::vector< Point > &  points 
)

Computes 1d-2d contacts, where 1d nodes are connected to the 2d faces mass centers containing the input point (ggeo_make1D2Dstreetinletpipes_dll).

With this algorithm, each 2d face containing a point is connected to the 1d node closest to point itself. The search of the 2d faces and the closest 1d nodes uses RTrees.

2d faces containing the input points connecting to the 1d mesh. Contacts are shown in red and the input points in blue.
Parameters
[in]oneDNodeMaskThe mask to apply to 1d nodes (true = connect node, false = do not generate contacts)
[in]pointsThe points selecting the faces to connect

◆ ComputeContactsWithPolygons()

void meshkernel::Contacts::ComputeContactsWithPolygons ( const std::vector< bool > &  oneDNodeMask,
const Polygons polygons 
)

Computes 1d-2d contacts, where a 2d face per polygon is connected to the closest 1d node (ggeo_make1D2Droofgutterpipes_dll).

The algorithms works as follows:

  • Find the 2d face within each polygon closest to a 1d node.
  • Per polygon create one contact from the 2d circumcenters to the 1d node.
    1d mesh connecting to 2d mesh using the ComputeContactsWithPolygons algorithm. Contacts are shown in red. Polygons in green.
Parameters
[in]oneDNodeMaskThe mask to apply to 1d nodes (true = connect node, false = do not generate contacts)
[in]polygonsThe polygons to connect (Polygons class can have multiple polygons)

◆ ComputeMultipleContacts()

void meshkernel::Contacts::ComputeMultipleContacts ( const std::vector< bool > &  oneDNodeMask)

Computes 1d-2d contacts, where a single 1d node is connected to multiple 2d face circumcenters (ggeo_make1D2Dembeddedlinks_dll).

Each internal 1d node is connected to multiple 2d faces. This type of contacts should be used when the lengths of the 1d mesh edges are considerably larger than the 2d mesh edges and generating a single contact for each 1d node is not sufficient. In this algorithm, only the internal 1d nodes are connected. The following figure shows a 1d mesh overlapping a 2d mesh. For the node n, the closest 2d faces within a search radius are found and it is determined if those faces cross are crossed by the current 1d edge starting at node n and ending at and n+1. If the answer is positive, a contact is generated between the face and the closest 1d node composing the current 1d edge (i.e. n or n+1). The procedure is repeated for each 1d node.

1d mesh connecting to 2d mesh using the ComputeMultipleContacts algorithm. Contacts are shown in red.
Parameters
[in]oneDNodeMaskThe mask to apply to 1d nodes (true = connect node, false = do not generate contacts)

◆ ComputeSingleContacts()

void meshkernel::Contacts::ComputeSingleContacts ( const std::vector< bool > &  oneDNodeMask,
const Polygons polygons,
double  projectionFactor 
)

Computes 1d-2d contacts, where every single 1d node is connected to one 2d face circumcenter (ggeo_make1D2Dinternalnetlinks_dll).

Each non-boundary 1d node is connected to single 2d face. The figure below shows two 2d meshes, a 1d mesh between them, and the 1d-2d contacts (in red). For the 1d nodes not overlapping a 2d mesh, a ray starting from the current node n is computed (dashed blue ray). This ray is normal to the segment connecting the previous (n-1) and next one 1d node (n+1), the connecting segment is shown with a green dashed line. The ray is extended for 5 times the length of the connecting segment. The current 1d node is connected to the first boundary 2d face crossing the ray, first in the left direction and then in the right direction. By doing so a 1d mesh can be connected on the left and right sides of a mesh 2d boundary, for example when the 1d part represents a river and the 2d part the river banks. The 1d nodes overlapping the 2d mesh are directly connected to the face including them.

1d mesh connecting to 2d mesh using the ComputeSingleContacts algorithm. Contacts are shown in red.
Parameters
[in]oneDNodeMaskThe mask to apply to 1d nodes (true = connect node, false = do not generate contacts)
[in]polygonsThe polygons selecting the area where the 1d-2d contacts will be generated.
[in]projectionFactorThe projection factor used for generating contacts when 1d nodes are not inside mesh2d

◆ Mesh1dIndices()

std::vector<UInt> const& meshkernel::Contacts::Mesh1dIndices ( ) const
inline

Gets the 1d mesh indices.

Returns
Vector of 1d mesh indices

◆ Mesh2dIndices()

std::vector<UInt> const& meshkernel::Contacts::Mesh2dIndices ( ) const
inline

Gets the 2d mesh indices.

Returns
Vector of 2d mesh indices

◆ SetIndices()

void meshkernel::Contacts::SetIndices ( const std::vector< meshkernel::UInt > &  mesh1dIndices,
const std::vector< meshkernel::UInt > &  mesh2dIndices 
)

Sets the 1d and 2d mesh indices.

Parameters
[in]mesh1dIndicesThe 1d mesh indices
[in]mesh2dIndicesThe 2d mesh indices

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