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:
eps – doubleInput
On entry: the relative precision of the restitching of the two input meshes (see
Section 8).
Suggested value:
.
Constraint:
.
- 2:
nv1 – IntegerInput
On entry:
the total number of vertices in the first input mesh.
Constraint:
.
- 3:
nelt1 – IntegerInput
On entry:
the number of triangular elements in the first input mesh.
Constraint:
.
- 4:
nedge1 – IntegerInput
On entry:
the number of boundary edges in the first input mesh.
Constraint:
.
- 5:
coor1[] – const doubleInput
-
On entry: contains the coordinate of the th vertex of the first input mesh, for ; while contains the corresponding coordinate.
- 6:
edge1[] – const IntegerInput
-
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:
conn1[] – const IntegerInput
-
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:
reft1[nelt1] – const IntegerInput
On entry: contains the user-supplied tag of the th triangle from the first input mesh, for .
- 9:
nv2 – IntegerInput
On entry:
the total number of vertices in the second input mesh.
Constraint:
.
- 10:
nelt2 – IntegerInput
On entry:
the number of triangular elements in the second input mesh.
Constraint:
.
- 11:
nedge2 – IntegerInput
On entry:
the number of boundary edges in the second input mesh.
Constraint:
.
- 12:
coor2[] – const doubleInput
-
On entry: contains the coordinate of the th vertex of the second input mesh, for ; while contains the corresponding coordinate.
- 13:
edge2[] – const IntegerInput
-
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:
conn2[] – const IntegerInput
-
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:
reft2[nelt2] – const IntegerInput
On entry: contains the user-supplied tag of the th triangle from the second input mesh, for .
- 16:
nv3 – Integer *Output
On exit: the total number of vertices in the resulting mesh.
- 17:
nelt3 – Integer *Output
On exit: the number of triangular elements in the resulting mesh.
- 18:
nedge3 – Integer *Output
On exit: the number of boundary edges in the resulting mesh.
- 19:
coor3[] – doubleOutput
-
Note: the dimension,
dim, of the array
coor3
must be at least
.
On exit: will contain the coordinate of the th vertex of the resulting mesh, for ; while will contain the corresponding coordinate.
- 20:
edge3[] – IntegerOutput
-
Note: the dimension,
dim, of the array
edge3
must be at least
. This may be reduced to
once that value is known.
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:
conn3[] – IntegerOutput
-
Note: the dimension,
dim, of the array
conn3
must be at least
. This may be reduced to
once that value is known.
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:
reft3[] – 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:
itrace – 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:
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.
- 25:
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: .
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.
- 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_NOT_CLOSE_FILE
Cannot close file .
- NE_NOT_WRITE_FILE
Cannot open file for writing.
- NE_REAL
On entry, .
Constraint: .
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 overlapping case the resulting geometry is shown in
Figure 1 and
Figure 2. The resulting geometry for the partitioned meshes is shown in
Figure 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 4 and
Figure 5.
Figure 1: The boundary and the interior interfaces of the two partitioned squares geometry
Figure 2: The interior mesh of the two partitioned squares geometry
Figure 3: The boundary and the interior interfaces (left); the interior mesh (right)
of the two overlapping squares geometry
Figure 4: The boundary and the interior interfaces of the double restitched geometry
Figure 5: The interior mesh of the double restitched geometry