NAG Library Routine Document

d06dbf (dim2_join)

1
Purpose

d06dbf joins together (restitches) two adjacent, or overlapping, meshes.

2
Specification

Fortran Interface
Integer, Intent (In):: nv1, nelt1, nedge1, edge1(3,nedge1), conn1(3,nelt1), reft1(nelt1), nv2, nelt2, nedge2, edge2(3,nedge2), conn2(3,nelt2), reft2(nelt2), itrace, liwork
Integer, Intent (Inout):: edge3(3,*), conn3(3,*), reft3(*), ifail
Integer, Intent (Out):: nv3, nelt3, nedge3, iwork(liwork)
Real (Kind=nag_wp), Intent (In):: eps, coor1(2,nv1), coor2(2,nv2)
Real (Kind=nag_wp), Intent (Inout):: coor3(2,*)
C Header Interface
#include <nagmk26.h>
void  d06dbf_ (const double *eps, const Integer *nv1, const Integer *nelt1, const Integer *nedge1, const double coor1[], const Integer edge1[], const Integer conn1[], const Integer reft1[], const Integer *nv2, const Integer *nelt2, const Integer *nedge2, const double coor2[], const Integer edge2[], const Integer conn2[], const Integer reft2[], Integer *nv3, Integer *nelt3, Integer *nedge3, double coor3[], Integer edge3[], Integer conn3[], Integer reft3[], const Integer *itrace, Integer iwork[], const Integer *liwork, Integer *ifail)

3
Description

d06dbf 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 routine is partly derived from material in the MODULEF package from INRIA (Institut National de Recherche en Informatique et Automatique).

4
References

None.

5
Arguments

1:     eps – Real (Kind=nag_wp)Input
On entry: the relative precision of the restitching of the two input meshes (see Section 9).
Suggested value: 0.001.
Constraint: eps>0.0.
2:     nv1 – IntegerInput
On entry: the total number of vertices in the first input mesh.
Constraint: nv13.
3:     nelt1 – IntegerInput
On entry: the number of triangular elements in the first input mesh.
Constraint: nelt12×nv1-1.
4:     nedge1 – IntegerInput
On entry: the number of boundary edges in the first input mesh.
Constraint: nedge11.
5:     coor12nv1 – Real (Kind=nag_wp) arrayInput
On entry: coor11i contains the x coordinate of the ith vertex of the first input mesh, for i=1,2,,nv1; while coor12i contains the corresponding y coordinate.
6:     edge13nedge1 – Integer arrayInput
On entry: the specification of the boundary edges of the first input mesh. edge11j and edge12j contain the vertex numbers of the two end points of the jth boundary edge. edge13j is a user-supplied tag for the jth boundary edge.
Constraint: 1edge1ijnv1 and edge11jedge12j, for i=1,2 and j=1,2,,nedge1.
7:     conn13nelt1 – Integer arrayInput
On entry: the connectivity between triangles and vertices of the first input mesh. For each triangle j, conn1ij gives the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,nelt1.
Constraints:
  • 1conn1ijnv1;
  • conn11jconn12j;
  • conn11jconn13j and conn12jconn13j, for i=1,2,3 and j=1,2,,nelt1.
8:     reft1nelt1 – Integer arrayInput
On entry: reft1k contains the user-supplied tag of the kth triangle from the first input mesh, for k=1,2,,nelt1.
9:     nv2 – IntegerInput
On entry: the total number of vertices in the second input mesh.
Constraint: nv23.
10:   nelt2 – IntegerInput
On entry: the number of triangular elements in the second input mesh.
Constraint: nelt22×nv2-1.
11:   nedge2 – IntegerInput
On entry: the number of boundary edges in the second input mesh.
Constraint: nedge21.
12:   coor22nv2 – Real (Kind=nag_wp) arrayInput
On entry: coor21i contains the x coordinate of the ith vertex of the second input mesh, for i=1,2,,nv2; while coor22i contains the corresponding y coordinate.
13:   edge23nedge2 – Integer arrayInput
On entry: the specification of the boundary edges of the second input mesh. edge21j and edge22j contain the vertex numbers of the two end points of the jth boundary edge. edge23j is a user-supplied tag for the jth boundary edge.
Constraint: 1edge2ijnv2 and edge21jedge22j, for i=1,2 and j=1,2,,nedge2.
14:   conn23nelt2 – Integer arrayInput
On entry: the connectivity between triangles and vertices of the second input mesh. For each triangle j, conn2ij gives the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,nelt2.
Constraints:
  • 1conn2ijnv2;
  • conn21jconn22j;
  • conn21jconn23j and conn22jconn23j, for i=1,2,3 and j=1,2,,nelt2.
15:   reft2nelt2 – Integer arrayInput
On entry: reft2k contains the user-supplied tag of the kth triangle from the second input mesh, for k=1,2,,nelt2.
16:   nv3 – IntegerOutput
On exit: the total number of vertices in the resulting mesh.
17:   nelt3 – IntegerOutput
On exit: the number of triangular elements in the resulting mesh.
18:   nedge3 – IntegerOutput
On exit: the number of boundary edges in the resulting mesh.
19:   coor32* – Real (Kind=nag_wp) arrayOutput
Note: the second dimension of the array coor3 must be at least nv1+nv2.
On exit: coor31i will contain the x coordinate of the ith vertex of the resulting mesh, for i=1,2,,nv3; while coor32i will contain the corresponding y coordinate.
20:   edge33* – Integer arrayOutput
Note: the second dimension of the array edge3 must be at least nedge1+nedge2. This may be reduced to nedge3 once that value is known.
On exit: the specification of the boundary edges of the resulting mesh. edge3ij will contain the vertex number of the ith end point (i=1,2) of the jth boundary or interface edge.
If the two meshes overlap, edge33j 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 jth edge is part of the partition interface, edge33j will contain the value 1000×k1+k2 where k1 and k2 are the tags for the same edge of the first and the second mesh respectively;
(ii) otherwise, edge33j will contain the same tag as the corresponding edge belonging to the first and/or the second input mesh.
21:   conn33* – Integer arrayOutput
Note: the second dimension of the array conn3 must be at least nelt1+nelt2. This may be reduced to nelt3 once that value is known.
On exit: the connectivity between triangles and vertices of the resulting mesh. conn3ij will give the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,nelt3.
22:   reft3* – Integer arrayOutput
Note: the dimension of the array reft3 must be at least nelt1+nelt2. This may be reduced to nelt3 once that value is known.
On exit: if the two meshes form a partition, reft3k will contain the same tag as the corresponding triangle belonging to the first or the second input mesh, for k=1,2,,nelt3. If the two meshes overlap, reft3k will contain the value 1000×k1+k2 where k1 and k2 are the user-supplied tags for the same triangle of the first and the second mesh respectively, for k=1,2,,nelt3.
23:   itrace – IntegerInput
On entry: the level of trace information required from d06dbf.
itrace0
No output is generated.
itrace1
Details about the common vertices, edges and triangles to both meshes are printed on the current advisory message unit (see x04abf).
24:   iworkliwork – Integer arrayWorkspace
25:   liwork – IntegerInput
On entry: the dimension of the array iwork as declared in the (sub)program from which d06dbf is called.
Constraint: liwork2×nv1+3×nv2+nelt1+nelt2+nedge1+nedge2+1024.
26:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, conn1I,J=value, I=value, J=value and nv1=value.
Constraint: conn1I,J1 and conn1I,Jnv1.
On entry, conn2I,J=value, I=value, J=value and nv2=value.
Constraint: conn2I,J1 and conn2I,Jnv2.
On entry, edge1I,J=value, I=value, J=value and nv1=value.
Constraint: edge1I,J1 and edge1I,Jnv1.
On entry, edge2I,J=value, I=value, J=value and nv2=value.
Constraint: edge2I,J1 and edge2I,Jnv2.
On entry, eps=value.
Constraint: eps>0.0.
On entry, liwork=value and LIWKMN=value.
Constraint: liworkLIWKMN.
On entry, nedge1=value.
Constraint: nedge11.
On entry, nedge2=value.
Constraint: nedge21.
On entry, nelt1=value and nv1=value.
Constraint: nelt12×nv1-1.
On entry, nelt2=value and nv2=value.
Constraint: nelt22×nv2-1.
On entry, nv1=value.
Constraint: nv13.
On entry, nv2=value.
Constraint: nv23.
On entry, the end points of edge J in the first mesh have the same index I: J=value and I=value.
On entry, the end points of edge J in the second mesh have the same index I: J=value and I=value.
On entry, vertices 1 and 2 of triangle K in the first mesh have the same index I: K=value and I=value.
On entry, vertices 1 and 2 of triangle K in the second mesh have the same index I: K=value and I=value.
On entry, vertices 1 and 3 of triangle K in the first mesh have the same index I: K=value and I=value.
On entry, vertices 1 and 3 of triangle K in the second mesh have the same index I: K=value and I=value.
On entry, vertices 2 and 3 of triangle K in the first mesh have the same index I: K=value and I=value.
On entry, vertices 2 and 3 of triangle K in the second mesh have the same index I: K=value and I=value.
ifail=2
The routine has detected only value coincident vertices with a precision eps=value. Either eps should be changed or the two meshes are not restitchable.
ifail=3
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.
ifail=4
The routine has detected a different number of coincident triangles from the two meshes in the overlapping zone value value. Check the input of the two meshes, especially the triangles/vertices connectivity.
ifail=5
The routine has detected a different number of coincident edges from the two meshes on the partition interface value value. Check the input of the two meshes, especially the edges/vertices connectivity.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

Not applicable.

8
Parallelism and Performance

d06dbf is not threaded in any implementation.

9
Further Comments

d06dbf 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 0.001 with itrace1 to get the optimal value for the meshes under consideration.

10
Example

For this routine two examples are presented. There is a single example program for d06dbf, with a main program and the code to solve the two example problems given in Example 1 (EX1) and Example 2 (EX2).
Example 1 (EX1)
This example involves the unit square 0,12 meshed uniformly, and then translated by a vector u= u1 u2  (using d06daf). This translated mesh is then restitched with the original mesh. Two cases are considered:
(a) overlapping meshes (u1=15.0, u2=17.0),
(b) partitioned meshes (u1=19.0, u2=0.0).
The mesh on the unit square has 400 vertices, 722 triangles and its boundary has 76 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.
Example 2 (EX2)
This example restitches three geometries by calling the routine d06dbf twice. The result is a mesh with three partitions. The first geometry is meshed by the Delaunay–Voronoi process (using d06abf), the second one meshed by an Advancing Front algorithm (using d06acf), while the third one is the result of a rotation (by -π/2) of the second one (using d06daf). The resulting geometry is shown in Figure 5 in Section 10.3 and restitched mesh in Figure 6 in Section 10.3.

10.1
Program Text

Program Text (d06dbfe.f90)

10.2
Program Data

Program Data (d06dbfe.d)

10.3
Program Results

Program Results (d06dbfe.r)

GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Example Program Figure 1: Boundary and Interior Interface of Partitioned Squares gnuplot_plot_1
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Figure 2: Interior Mesh of Partitioned Squares gnuplot_plot_1
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Figure 3: Boundary and Interior Interface of Overlapping Squares gnuplot_plot_1
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Figure 4: Interior Mesh of Overlapping Squares gnuplot_plot_1
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Figure 5: Boundary and Interior Interfaces for Key Shape gnuplot_plot_1
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Figure 6: Interior Mesh of KeyShape gnuplot_plot_1