sl.findneighbours: Find Node Neighbours Based on Triangular Elements

sl.findneighboursR Documentation

Find Node Neighbours Based on Triangular Elements

Description

Given the triangular elements (node triplets) of a regular mesh, find all neighbour nodes for each node.

Usage

sl.findneighbours(elem, maxmaxneigh = 12, reverse = TRUE, verbose = FALSE, max.iter = 10)

Arguments

elem

an Nex3 matrix with the node indices of the triangular elements in rows.

maxmaxneigh

an integer specifying an upper limit for the expected maximum number of neighbours for a node. For a typical (close to orthogonal) triangular mesh, there are 6 neighbours per node on average; the default value maxmaxneigh=12 is relatively safe. A too small value results in an error. A larger value implies more memory usage.

reverse

a logical value indicating whether the order of the node neighbours shall be reversed (clockwise/counterclockwise).

verbose

a logical value indicating whether print statements shall report on the function progess.

max.iter

an integer specifying the maximum number of iterations used to order the neighbours of each node. The default max.iter=10 should be on the safe side.

Details

It may happen that, despite a sufficiently high value of max.iter, node neighbours can't be arranged in order and a corresponding warning is printed. In this case the affected nodes might be 'bad' nodes connecting two or more separate regions of the mesh domain, for example two ocean basins (as well as two pieces of land); such a connection should be represented either by multiple nodes, or closed completely. If 'bad' nodes exists, only one contiguous part of the mesh (wrt neighbour nodes and adjacent elements) will be returned for those nodes.

Value

neighbour.nodes

an NxM matrix with each row containing all neighbours of one node. The neighbours are arranged in clockwise or counterclockwise order, depending on the direction of rotation provided in elem (can be reversed by the argument reverse). M is the maximum number of neighbours actually found for a node (M<=maxmaxneigh).

neighbour.elems

an NxM matrix with each row containing all triangular elements (identified by the row indices in elem) adjacent to one node. The elements are arranged in clockwise or counterclockwise order, depending on the direction of rotation provided in elem (can be reversed by the argument reverse). M is the maximum number of neighbours actually found for a node (M<=maxmaxneigh).

internal.nodes

a vector of length N with logical values indicating which nodes are internal, that is, non-coastal.

N.neighbour.nodes

a vector of length N with the number of neighbours for each node.

all.elements.arranged

a logical value indicating whether all neighbours and elements have been ordered successfully.

elems.completed

NULL if all.elements.arranged=TRUE, otherwise a vector of length N with logical values indicating which nodes were successfully arranged in order.

Note

This function is used by sl.grid.readFESOM.

Author(s)

Helge Goessling

See Also

sl.grid.readFESOM

Examples

## To be provided ...

FESOM/spheRlab documentation built on April 6, 2024, 6:52 p.m.