naginterfaces.library.pde.dim2_​triangulate

naginterfaces.library.pde.dim2_triangulate(h, m, n, nb, sdindx, isin, data=None)[source]

dim2_triangulate places a triangular mesh over a given two-dimensional region. The region may have any shape, including one with holes.

For full information please refer to the NAG Library document for d03ma

https://support.nag.com/numeric/nl/nagdoc_30.1/flhtml/d03/d03maf.html

Parameters
hfloat

, the required length for the sides of the triangles of the uniform mesh.

mint

The value such that all points inside the region satisfy the documented inequalities.

nint

The value such that all points inside the region satisfy the documented inequalities.

nbint

The number of times a triangle side is bisected to find a point on the boundary. A value of is adequate for most purposes (see Accuracy).

sdindxint

The second dimension of the arrays and .

isincallable retval = isin(x, y, data=None)

must return the value if the given point lies inside the region, and if it lies outside.

Parameters
xfloat

The coordinates of the given point.

yfloat

The coordinates of the given point.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
retvalint

The value if the given point lies inside the region, and if it lies outside.

dataarbitrary, optional

User-communication data for callback functions.

Returns
nptsint

The number of points in the triangulation.

placesfloat, ndarray, shape

The and coordinates respectively of the th point of the triangulation.

indxint, ndarray, shape

contains if point is inside the region and if it is on the boundary. For each triangle side between points and with , , , contains or according to whether point is internal or on the boundary. There can never be more than three such points. If there are less, some values , , are zero.

Raises
NagValueError
(errno )

is too small: .

(errno )

A point inside the region violates one of the constraints.

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

dim2_triangulate begins with a uniform triangular grid as shown in Figure [label omitted] and assumes that the region to be triangulated lies within the rectangle given by the inequalities

This rectangle is drawn in bold in Figure [label omitted]. The region is specified by the which must determine whether any given point lies in the region. The uniform grid is processed column-wise, with preceding if or , . Points near the boundary are moved onto it and points well outside the boundary are omitted. The direction of movement is chosen to avoid pathologically thin triangles. The points accepted are numbered in exactly the same order as the corresponding points of the uniform grid were scanned. The output consists of the coordinates of all grid points and integers indicating whether they are internal and to which other points they are joined by triangle sides.

The mesh size must be chosen small enough for the essential features of the region to be apparent from testing all points of the original uniform grid for being inside the region. For instance if any hole is within of another hole or the outer boundary then a triangle may be found with all vertices within of a boundary. Such a triangle is taken to be external to the region so the effect will be to join the hole to another hole or to the external region.

Further details of the algorithm are given in the references.

[figure omitted]

References

Reid, J K, 1970, Fortran subroutines for the solutions of Laplace’s equation over a general routine in two dimensions, Harwell Report TP422

Reid, J K, 1972, On the construction and convergence of a finite-element solution of Laplace’s equation, J. Instr. Math. Appl. (9), 1–13