The routine may be called by the names d03maf or nagf_pde_dim2_triangulate.
d03maf begins with a uniform triangular grid as shown in Figure 1 and assumes that the region to be triangulated lies within the rectangle given by the inequalities
This rectangle is drawn in bold in Figure 1. The region is specified by the isin 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.
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
1: – Real (Kind=nag_wp)Input
On entry: , the required length for the sides of the triangles of the uniform mesh.
2: – IntegerInput
3: – IntegerInput
On entry: values and such that all points inside the region satisfy the inequalities
4: – IntegerInput
On entry: 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 Section 7).
5: – IntegerOutput
On exit: the number of points in the triangulation.
6: – Real (Kind=nag_wp) arrayOutput
On exit: the and coordinates respectively of the th point of the triangulation.
7: – Integer arrayOutput
On exit: 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.
8: – IntegerInput
On entry: the second dimension of the arrays places and indx as declared in the (sub)program from which d03maf is called.
9: – Integer Function, supplied by the user.External Procedure
isin must return the value if the given point lies inside the region, and if it lies outside.
isin must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which d03maf is called. Arguments denoted as Input must not be changed by this procedure.
10: – Real (Kind=nag_wp) arrayWorkspace
11: – IntegerInput
On entry: the second dimension of the array dist as declared in the (sub)program from which d03maf is called.
12: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).