PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_mesh_2d_gen_inc (d06aa)
Purpose
nag_mesh_2d_gen_inc (d06aa) generates a triangular mesh of a closed polygonal region in , given a mesh of its boundary. It uses a simple incremental method.
Syntax
[
nv,
nelt,
coor,
conn,
ifail] = d06aa(
edge,
coor,
bspace,
smooth,
itrace, 'nvb',
nvb, 'nvmax',
nvmax, 'nedge',
nedge, 'coef',
coef, 'power',
power)
[
nv,
nelt,
coor,
conn,
ifail] = nag_mesh_2d_gen_inc(
edge,
coor,
bspace,
smooth,
itrace, 'nvb',
nvb, 'nvmax',
nvmax, 'nedge',
nedge, 'coef',
coef, 'power',
power)
Description
nag_mesh_2d_gen_inc (d06aa) generates the set of interior vertices using a process based on a simple incremental method. A smoothing of the mesh is optionally available. For more details about the triangulation method, 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).
References
George P L and Borouchaki H (1998) Delaunay Triangulation and Meshing: Application to Finite Elements Editions HERMES, Paris
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int array
-
The specification of the boundary 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 edge and is not used by nag_mesh_2d_gen_inc (d06aa).
Constraint:
and , for and .
- 2:
– double array
-
contains the coordinate of the th input boundary mesh vertex; while contains the corresponding coordinate, for .
- 3:
– double array
-
The desired mesh spacing (triangle diameter, which is the length of the longer edge of the triangle) near the boundary vertices.
Constraint:
, for .
- 4:
– logical scalar
-
Indicates whether or not mesh smoothing should be performed.
If , the smoothing is performed; otherwise no smoothing is performed.
- 5:
– int64int32nag_int scalar
-
The level of trace information required from
nag_mesh_2d_gen_inc (d06aa).
- No output is generated.
- Output from the meshing solver is printed on the current advisory message unit (see nag_file_set_unit_advisory (x04ab)). This output contains details of the vertices and triangles generated by the process.
You are advised to set , unless you are experienced with finite element mesh generation.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the array
bspace.
The number of vertices in the input boundary mesh.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the array
coor.
The maximum number of vertices in the mesh to be generated.
- 3:
– int64int32nag_int scalar
-
Default:
the dimension of the array
edge.
The number of boundary edges in the input mesh.
Constraint:
.
- 4:
– double scalar
Default:
.
The coefficient in the stopping criteria for the generation of interior vertices. This argument controls the triangle density and the number of triangles generated is in
. The mesh will be finer if
coef is greater than
and
is a good value.
- 5:
– double scalar
Default:
.
Controls the rate of change of the mesh size during the generation of interior vertices. The smaller the value of
power, the faster the decrease in element size away from the boundary.
Constraint:
.
Output Parameters
- 1:
– int64int32nag_int scalar
-
The total number of vertices in the output mesh (including both boundary and interior vertices). If , no interior vertices will be generated and .
- 2:
– int64int32nag_int scalar
-
The number of triangular elements in the mesh.
- 3:
– double array
-
will contain the coordinate of the th generated interior mesh vertex; while will contain the corresponding coordinate, for . The remaining elements are unchanged.
- 4:
– int64int32nag_int array
-
The connectivity of the mesh between triangles and vertices. For each triangle
, gives the indices of its three vertices (in anticlockwise order), for and .
- 5:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
On entry, | or , |
or | , |
or | or , for some and , |
or | , for some , |
or | , for some , |
or | or , |
or | , |
or | . |
-
-
An error has occurred during the generation of the interior mesh. Check the definition of the boundary (arguments
coor and
edge) as well as the orientation of the boundary (especially in the case of a multiple connected component boundary). Setting
may provide more details.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
Not applicable.
Further Comments
The position of the internal vertices is a function of the positions of the vertices on the given boundary. A fine mesh on the boundary results in a fine mesh in the interior. The algorithm allows you to obtain a denser interior mesh by varying
nvmax,
bspace,
coef and
power. But you are advised to manipulate the last two arguments with care.
You are advised to take care to set the boundary inputs properly, especially for a boundary with multiply connected components. The orientation of the interior boundaries should be in clockwise order and opposite to that of the exterior boundary. If the boundary has only one connected component, its orientation should be anticlockwise.
Example
In this example, a geometry with two holes (two interior circles inside an exterior one) is meshed using the simple incremental method (see the
D06 Chapter Introduction). The exterior circle is centred at the origin with a radius
, the first interior circle is centred at the point
with a radius
, and the second one is centred at the point
with a radius
. Note that the points
and
) are points of ‘near tangency’ between the exterior circle and the first and second circles.
The boundary mesh has
vertices and
edges. Note that the particular mesh generated could be sensitive to the
machine precision and therefore may differ from one implementation to another.
Open in the MATLAB editor:
d06aa_example
function d06aa_example
fprintf('d06aa example results\n\n');
edge = zeros(3, 100, 'int64');
coor = zeros(2, 250);
ncirc = 3;
nvertices = [40, 30, 30];
radii = [1, 0.49, 0.15];
centres = [ 0, 0;
-0.5, 0;
-0.5, 0.65];
csign = 1;
i1 = 0;
nvb = 0;
for icirc = 1:ncirc
for i = 0:nvertices(icirc)-1
i1 = i1+1;
theta = 2*pi*i/nvertices(icirc);
coor(1,i1) = radii(icirc)*cos(theta) + centres(icirc, 1);
coor(2,i1) = csign*radii(icirc)*sin(theta) + centres(icirc, 2);
edge(1,i1) = i1;
edge(2,i1) = i1 + 1;
edge(3,i1) = 1;
end
edge(2,i1) = nvb + 1;
nvb = nvb + nvertices(icirc);
csign = -1;
end
nedge = nvb;
bspace = zeros(1, 100);
bspace(1:nvb) = 0.05;
smooth = true;
itrace = int64(0);
[nv, nelt, coor, conn, ifail] = d06aa( ...
edge, coor, bspace, smooth, itrace);
fprintf('\nnv = %d\n', nv);
fprintf('nelt = %d\n', nelt);
fig1 = figure;
triplot(transpose(double(conn(:,1:nelt))), coor(1,:), coor(2,:));
axis equal;
d06aa example results
nv = 250
nelt = 402
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015