D06CAF (PDF version)
D06 Chapter Contents
D06 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

D06CAF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

D06CAF uses a barycentering technique to smooth a given mesh.

2  Specification

SUBROUTINE D06CAF ( NV, NELT, NEDGE, COOR, EDGE, CONN, NVFIX, NUMFIX, ITRACE, NQINT, IWORK, LIWORK, RWORK, LRWORK, IFAIL)
INTEGER  NV, NELT, NEDGE, EDGE(3,NEDGE), CONN(3,NELT), NVFIX, NUMFIX(*), ITRACE, NQINT, IWORK(LIWORK), LIWORK, LRWORK, IFAIL
REAL (KIND=nag_wp)  COOR(2,NV), RWORK(LRWORK)

3  Description

D06CAF uses a barycentering approach to improve the smoothness of a given mesh. The measure of quality used for a triangle K is
QK=αhKρK;
where hK is the diameter (length of the longest edge) of K, ρK is the radius of its inscribed circle and α= 36  is a normalization factor chosen to give QK=1 for an equilateral triangle. QK ranges from 1, for an equilateral triangle, to , for a totally flat triangle.
D06CAF makes small perturbation to vertices (using a barycenter formula) in order to give a reasonably good value of QK for all neighbouring triangles. Some vertices may optionally be excluded from this process.
For more details about the smoothing method, especially with regard to differing quality, consult the D06 Chapter Introduction as well as George and Borouchaki (1998).
This routine is derived from material in the MODULEF package from INRIA (Institut National de Recherche en Informatique et Automatique).

4  References

George P L and Borouchaki H (1998) Delaunay Triangulation and Meshing: Application to Finite Elements Editions HERMES, Paris

5  Parameters

1:     NV – INTEGERInput
On entry: the total number of vertices in the input mesh.
Constraint: NV3.
2:     NELT – INTEGERInput
On entry: the number of triangles in the input mesh.
Constraint: NELT2×NV-1.
3:     NEDGE – INTEGERInput
On entry: the number of the boundary and interface edges in the input mesh.
Constraint: NEDGE1.
4:     COOR(2,NV) – REAL (KIND=nag_wp) arrayInput/Output
On entry: COOR1i contains the x coordinate of the ith input mesh vertex, for i=1,2,,NV; while COOR2i contains the corresponding y coordinate.
On exit: COOR1i will contain the x coordinate of the ith smoothed mesh vertex, for i=1,2,,NV; while COOR2i will contain the corresponding y coordinate. Note that the coordinates of boundary and interface edge vertices, as well as those specified by you (see the description of NUMFIX), are unchanged by the process.
5:     EDGE(3,NEDGE) – INTEGER arrayInput
On entry: the specification of the boundary or interface edges. EDGE1j and EDGE2j contain the vertex numbers of the two end points of the jth boundary edge. EDGE3j is a user-supplied tag for the jth boundary or interface edge: EDGE3j=0 for an interior edge and has a nonzero tag otherwise.
Constraint: 1EDGEijNV and EDGE1jEDGE2j, for i=1,2 and j=1,2,,NEDGE.
6:     CONN(3,NELT) – INTEGER arrayInput
On entry: the connectivity of the mesh between triangles and vertices. For each triangle j, CONNij gives the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,NELT.
Constraint: 1CONNijNV and CONN1jCONN2j and CONN1jCONN3j and CONN2jCONN3j, for i=1,2,3 and j=1,2,,NELT.
7:     NVFIX – INTEGERInput
On entry: the number of fixed vertices in the input mesh.
Constraint: 0NVFIXNV.
8:     NUMFIX(*) – INTEGER arrayInput
Note: the dimension of the array NUMFIX must be at least max1,NVFIX.
On entry: the indices in COOR of fixed interior vertices of the input mesh.
Constraint: if NVFIX>0, 1NUMFIXiNV, for i=1,2,,NVFIX.
9:     ITRACE – INTEGERInput
On entry: the level of trace information required from D06CAF.
ITRACE0
No output is generated.
ITRACE=1
A histogram of the triangular element qualities is printed on the current advisory message unit (see X04ABF) before and after smoothing. This histogram gives the lowest and the highest triangle quality as well as the number of elements lying in each of the NQINT equal intervals between the extremes.
ITRACE>1
The output is similar to that produced when ITRACE=1 but the connectivity between vertices and triangles (for each vertex, the list of triangles in which it appears) is given.
You are advised to set ITRACE=0, unless you are experienced with finite element meshes.
10:   NQINT – INTEGERInput
On entry: the number of intervals between the extreme quality values for the input and the smoothed mesh.
If ITRACE=0, NQINT is not referenced.
11:   IWORK(LIWORK) – INTEGER arrayWorkspace
12:   LIWORK – INTEGERInput
On entry: the dimension of the array IWORK as declared in the (sub)program from which D06CAF is called.
Constraint: LIWORK8×NELT+2×NV.
13:   RWORK(LRWORK) – REAL (KIND=nag_wp) arrayWorkspace
14:   LRWORK – INTEGERInput
On entry: the dimension of the array RWORK as declared in the (sub)program from which D06CAF is called.
Constraint: LRWORK2×NV+NELT.
15:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry,NV<3,
orNELT>2×NV-1,
orNEDGE<1,
orEDGEij<1 or EDGEij>NV for some i=1,2 and j=1,2,,NEDGE,
orEDGE1j=EDGE2j for some j=1,2,,NEDGE,
orCONNij<1 or CONNij>NV for some i=1,2,3 and j=1,2,,NELT,
orCONN1j=CONN2j or CONN1j=CONN3j or CONN2j=CONN3j for some j=1,2,,NELT,
orNVFIX<0 or NVFIX>NV,
orNUMFIXi<1 or NUMFIXi>NV for some i=1,2,,NVFIX if NVFIX>0,
orLIWORK<8×NELT+2×NV,
orLRWORK<2×NV+NELT.
IFAIL=2
A serious error has occurred in an internal call to an auxiliary routine. Check the input mesh, especially the connectivity between triangles and vertices (the parameter CONN). Setting ITRACE>1 may provide more information. If the problem persists, contact NAG.

7  Accuracy

Not applicable.

8  Further Comments

None.

9  Example

In this example, a uniform mesh on the unit square is randomly distorted using routines from Chapter G05. D06CAF is then used to smooth the distorted mesh and recover a uniform mesh.

9.1  Program Text

Program Text (d06cafe.f90)

9.2  Program Data

Program Data (d06cafe.d)

9.3  Program Results

Program Results (d06cafe.r)

Produced by GNUPLOT 4.4 patchlevel 0 Example Program Unform mesh on the unit square randomly distorted using routines from Chapter G05
Produced by GNUPLOT 4.4 patchlevel 0 Distorted mesh smoothed and a uniform mesh recovered

D06CAF (PDF version)
D06 Chapter Contents
D06 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012