nag_mesh2d_smooth (d06cac) uses a barycentering technique to smooth a given mesh.
nag_mesh2d_smooth (d06cac) 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.
nag_mesh2d_smooth (d06cac) 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 function 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[] – doubleInput/Output
-
Note: the th element of the matrix is stored in .
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[] – const IntegerInput
-
Note: the th element of the matrix is stored in .
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. Note that the edge vertices are numbered from
to
nv.
Constraint:
and , for and .
- 6:
conn[] – const IntegerInput
-
Note: the th element of the matrix is stored in .
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
. Note that the mesh vertices are numbered from
to
nv.
Constraint:
and and and , for and .
- 7:
nvfix – IntegerInput
On entry: the number of fixed vertices in the input mesh.
Constraint:
.
- 8:
numfix[] – const IntegerInput
-
Note: the dimension,
dim, 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 nag_mesh2d_smooth (d06cac).
- No output is generated.
- A histogram of the triangular element qualities is printed 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:
outfile – const char *Input
On entry: the name of a file to which diagnostic output will be directed. If
outfile is
NULL the diagnostic output will be directed to standard output.
- 11:
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.
- 12:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_INT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_2
-
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, the endpoints of the edge have the same index : and .
On entry, vertices and of the triangle have the same index : and .
On entry, vertices and of the triangle have the same index : and .
On entry, vertices and of the triangle have the same index : and .
- NE_INT_3
-
On entry, , and .
Constraint: and .
- NE_INT_4
-
On entry, , , and .
Constraint: and , where denotes .
On entry, , , and .
Constraint: and , where denotes .
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
A serious error has occurred in an internal call to an auxiliary function. Check the input mesh especially the connectivity. Seek expert help.
- NE_NOT_CLOSE_FILE
-
Cannot close file .
- NE_NOT_WRITE_FILE
-
Cannot open file for writing.
Not applicable.
nag_mesh2d_smooth (d06cac) is not threaded by NAG in any implementation.
nag_mesh2d_smooth (d06cac) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
Users' Note for your implementation for any additional implementation-specific information.
None.
In this example, a uniform mesh on the unit square is randomly distorted using functions from
Chapter g05. nag_mesh2d_smooth (d06cac) is then used to smooth the distorted mesh and recover a uniform mesh.