nag_mesh2d_join (d06dbc) joins together (restitches) two adjacent, or overlapping, meshes.
nag_mesh2d_join (d06dbc) joins together two adjacent, or overlapping, meshes. If the two meshes are adjacent then vertices belonging to the part of the boundary forming the common interface should coincide. If the two meshes overlap then vertices and triangles in the overlapping zone should coincide too.
This function is partly derived from material in the MODULEF package from INRIA (Institut National de Recherche en Informatique et Automatique).
None.
- 1:
– doubleInput
-
On entry: the relative precision of the restitching of the two input meshes (see
Section 9).
Suggested value:
.
Constraint:
.
- 2:
– IntegerInput
-
On entry: the total number of vertices in the first input mesh.
Constraint:
.
- 3:
– IntegerInput
-
On entry: the number of triangular elements in the first input mesh.
Constraint:
.
- 4:
– IntegerInput
-
On entry: the number of boundary edges in the first input mesh.
Constraint:
.
- 5:
– const doubleInput
-
Note: the th element of the matrix is stored in .
On entry: contains the coordinate of the th vertex of the first input mesh, for ; while contains the corresponding coordinate.
- 6:
– const IntegerInput
-
Note: the th element of the matrix is stored in .
On entry: the specification of the boundary edges of the first input mesh. 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.
Constraint:
and
, for and .
- 7:
– const IntegerInput
-
Note: the th element of the matrix is stored in .
On entry: the connectivity between triangles and vertices of the first input mesh. For each triangle
, gives the indices of its three vertices (in anticlockwise order), for and .
Constraints:
- ;
- ;
- and
, for and .
- 8:
– const IntegerInput
-
On entry: contains the user-supplied tag of the th triangle from the first input mesh, for .
- 9:
– IntegerInput
-
On entry: the total number of vertices in the second input mesh.
Constraint:
.
- 10:
– IntegerInput
-
On entry: the number of triangular elements in the second input mesh.
Constraint:
.
- 11:
– IntegerInput
-
On entry: the number of boundary edges in the second input mesh.
Constraint:
.
- 12:
– const doubleInput
-
Note: the th element of the matrix is stored in .
On entry: contains the coordinate of the th vertex of the second input mesh, for ; while contains the corresponding coordinate.
- 13:
– const IntegerInput
-
Note: the th element of the matrix is stored in .
On entry: the specification of the boundary edges of the second input mesh. 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.
Constraint:
and
, for and .
- 14:
– const IntegerInput
-
Note: the th element of the matrix is stored in .
On entry: the connectivity between triangles and vertices of the second input mesh. For each triangle
, gives the indices of its three vertices (in anticlockwise order), for and .
Constraints:
- ;
- ;
- and
, for and .
- 15:
– const IntegerInput
-
On entry: contains the user-supplied tag of the th triangle from the second input mesh, for .
- 16:
– Integer *Output
-
On exit: the total number of vertices in the resulting mesh.
- 17:
– Integer *Output
-
On exit: the number of triangular elements in the resulting mesh.
- 18:
– Integer *Output
-
On exit: the number of boundary edges in the resulting mesh.
- 19:
– doubleOutput
-
Note: the dimension,
dim, of the array
coor3
must be at least
.
The th element of the matrix is stored in .
On exit: will contain the coordinate of the th vertex of the resulting mesh, for ; while will contain the corresponding coordinate.
- 20:
– IntegerOutput
-
Note: the dimension,
dim, of the array
edge3
must be at least
. This may be reduced to
once that value is known.
The th element of the matrix is stored in .
On exit: the specification of the boundary edges of the resulting mesh.
will contain the vertex number of the
th end point (
) of the
th boundary or interface edge.
If the two meshes overlap, will contain the same tag as the corresponding edge belonging to the first and/or the second input mesh.
If the two meshes are adjacent,
(i) |
if the th edge is part of the partition interface, then will contain the value where and are the tags for the same edge of the first and the second mesh respectively; |
(ii) |
otherwise, will contain the same tag as the corresponding edge belonging to the first and/or the second input mesh. |
- 21:
– IntegerOutput
-
Note: the dimension,
dim, of the array
conn3
must be at least
. This may be reduced to
once that value is known.
The th element of the matrix is stored in .
On exit: the connectivity between triangles and vertices of the resulting mesh.
will give the indices of its three vertices (in anticlockwise order), for and .
- 22:
– IntegerOutput
-
Note: the dimension,
dim, of the array
reft3
must be at least
. This may be reduced to
once that value is known.
On exit: if the two meshes form a partition,
will contain the same tag as the corresponding triangle belonging to the first or the second input mesh, for . If the two meshes overlap, then
will contain the value where and are the user-supplied tags for the same triangle of the first and the second mesh respectively, for .
- 23:
– IntegerInput
-
On entry: the level of trace information required from nag_mesh2d_join (d06dbc).
- No output is generated.
- Details about the common vertices, edges and triangles to both meshes are printed.
- 24:
– 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.
- 25:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 3.2.1.2 in the Essential Introduction for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_INT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_2
-
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, the endpoints of edge in the first mesh have the same index : and .
On entry, the endpoints of edge in the second mesh have the same index : and .
On entry, vertices and of triangle in the first mesh have the same index : and .
On entry, vertices and of triangle in the second mesh have the same index : and .
On entry, vertices and of triangle in the first mesh have the same index : and .
On entry, vertices and of triangle in the second mesh have the same index : and .
On entry, vertices and of triangle in the first mesh have the same index : and .
On entry, vertices and of triangle in the second mesh have the same index : and .
- NE_INT_4
-
On entry, , , and .
Constraint: and , where denotes .
On entry, , , and .
Constraint: and , where denotes .
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.
An unexpected error has been triggered by this function. Please contact
NAG.
See
Section 3.6.6 in the Essential Introduction for further information.
- NE_MESH_ERROR
-
A serious error has occurred in an internal call to the restitching routine. Check the input of the two meshes, especially the edges/vertices and/or the triangles/vertices connectivities. Seek expert help.
The function has detected a different number of coincident edges from the two meshes on the partition interface . Check the input of the two meshes, especially the edges/vertices connectivity.
The function has detected a different number of coincident triangles from the two meshes in the overlapping zone . Check the input of the two meshes, especially the triangles/vertices connectivity.
The function has detected only
coincident vertices with a precision
. Either
eps should be changed or the two meshes are not restitchable.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 3.6.5 in the Essential Introduction for further information.
- NE_NOT_CLOSE_FILE
-
Cannot close file .
- NE_NOT_WRITE_FILE
-
Cannot open file for writing.
- NE_REAL
-
On entry, .
Constraint: .
Not applicable.
Not applicable.
nag_mesh2d_join (d06dbc) finds all the common vertices between the two input meshes using the relative precision of the restitching argument
eps. You are advised to vary the value of
eps in the neighbourhood of
with
to get the optimal value for the meshes under consideration.
For this function two examples are presented. There is a single example program for nag_mesh2d_join (d06dbc), with a main program and the code to solve the two example problems given in Example 1 (ex1) and Example 2 (ex2).
This example involves the unit square
meshed uniformly, and then translated by a vector
(using
nag_mesh2d_trans (d06dac)). This translated mesh is then restitched with the original mesh. Two cases are considered:
(a) |
overlapping meshes (, ), |
(b) |
partitioned meshes (, ). |
The mesh on the unit square has
vertices,
triangles and its boundary has
edges.
In the partitioned case the resulting geometry is shown in Figure 1 in
Section 10.3 while the restitched mesh is shown in Figure 2 in
Section 10.3.
In the overlapping case the geometry and mesh are shown in Figure 3 and Figure 4 in
Section 10.3.
This example restitches three geometries by calling the function nag_mesh2d_join (d06dbc) twice. The result is a mesh with three partitions. The first geometry is meshed by the Delaunay–Voronoi process (using
nag_mesh2d_delaunay (d06abc)), the second one meshed by an Advancing Front algorithm (using
nag_mesh2d_front (d06acc)), while the third one is the result of a rotation (by
) of the second one (using
nag_mesh2d_trans (d06dac)). The resulting geometry is shown in Figure 5 in
Section 10.3 and restitched mesh in Figure 6 in
Section 10.3.