D06CAF uses a barycentering technique to smooth a given mesh.
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) |
|
D06CAF uses a barycentering approach to improve the smoothness of a given mesh. The measure of quality used for a triangle
is
where
is the diameter (length of the longest edge) of
,
is the radius of its inscribed circle and
is a normalization factor chosen to give
for an equilateral triangle.
ranges from
, 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 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).
- 1: NV – INTEGERInput
On entry: the total number of vertices in the input mesh.
Constraint:
.
- 2: NELT – INTEGERInput
On entry: the number of triangles in the input mesh.
Constraint:
.
- 3: NEDGE – INTEGERInput
On entry: the number of the boundary and interface edges in the input mesh.
Constraint:
.
- 4: COOR(,NV) – REAL (KIND=nag_wp) arrayInput/Output
On entry: contains the coordinate of the th input mesh vertex, for ; while contains the corresponding coordinate.
On exit:
will contain the
coordinate of the
th smoothed mesh vertex, for
; while
will contain the corresponding
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(,NEDGE) – INTEGER arrayInput
On entry: the specification of the boundary or interface edges. and contain the vertex numbers of the two end points of the th boundary edge. is a user-supplied tag for the th boundary or interface edge: for an interior edge and has a nonzero tag otherwise.
Constraint:
and , for and .
- 6: CONN(,NELT) – INTEGER arrayInput
On entry: the connectivity of the mesh between triangles and vertices. For each triangle
, gives the indices of its three vertices (in anticlockwise order), for and .
Constraint:
and and and , for and .
- 7: NVFIX – INTEGERInput
On entry: the number of fixed vertices in the input mesh.
Constraint:
.
- 8: NUMFIX() – INTEGER arrayInput
-
Note: the dimension of the array
NUMFIX
must be at least
.
On entry: the indices in
COOR of fixed interior vertices of the input mesh.
Constraint:
if , , for .
- 9: ITRACE – INTEGERInput
On entry: the level of trace information required from D06CAF.
- No output is generated.
- 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.
- The output is similar to that produced when 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 , 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
,
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:
.
- 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:
.
- 15: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. 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
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value 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).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Not applicable.
None.
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.