NAG FL Interface
d06dbf (dim2_​join)

Settings help

FL Name Style:


FL Specification Language:


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 <nag.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)
The routine may be called by the names d06dbf or nagf_mesh_dim2_join.

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 Integer Input
On entry: the total number of vertices in the first input mesh.
Constraint: nv13.
3: nelt1 Integer Input
On entry: the number of triangular elements in the first input mesh.
Constraint: nelt12×nv1-1.
4: nedge1 Integer Input
On entry: the number of boundary edges in the first input mesh.
Constraint: nedge11.
5: coor1(2,nv1) Real (Kind=nag_wp) array Input
On entry: coor1(1,i) contains the x coordinate of the ith vertex of the first input mesh, for i=1,2,,nv1; while coor1(2,i) contains the corresponding y coordinate.
6: edge1(3,nedge1) Integer array Input
On entry: the specification of the boundary edges of the first input mesh. edge1(1,j) and edge1(2,j) contain the vertex numbers of the two end points of the jth boundary edge. edge1(3,j) is a user-supplied tag for the jth boundary edge.
Constraint: 1edge1(i,j)nv1 and edge1(1,j)edge1(2,j), for i=1,2 and j=1,2,,nedge1.
7: conn1(3,nelt1) Integer array Input
On entry: the connectivity between triangles and vertices of the first input mesh. For each triangle j, conn1(i,j) gives the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,nelt1.
Constraints:
  • 1conn1(i,j)nv1;
  • conn1(1,j)conn1(2,j);
  • conn1(1,j)conn1(3,j) and conn1(2,j)conn1(3,j), for i=1,2,3 and j=1,2,,nelt1.
8: reft1(nelt1) Integer array Input
On entry: reft1(k) contains the user-supplied tag of the kth triangle from the first input mesh, for k=1,2,,nelt1.
9: nv2 Integer Input
On entry: the total number of vertices in the second input mesh.
Constraint: nv23.
10: nelt2 Integer Input
On entry: the number of triangular elements in the second input mesh.
Constraint: nelt22×nv2-1.
11: nedge2 Integer Input
On entry: the number of boundary edges in the second input mesh.
Constraint: nedge21.
12: coor2(2,nv2) Real (Kind=nag_wp) array Input
On entry: coor2(1,i) contains the x coordinate of the ith vertex of the second input mesh, for i=1,2,,nv2; while coor2(2,i) contains the corresponding y coordinate.
13: edge2(3,nedge2) Integer array Input
On entry: the specification of the boundary edges of the second input mesh. edge2(1,j) and edge2(2,j) contain the vertex numbers of the two end points of the jth boundary edge. edge2(3,j) is a user-supplied tag for the jth boundary edge.
Constraint: 1edge2(i,j)nv2 and edge2(1,j)edge2(2,j), for i=1,2 and j=1,2,,nedge2.
14: conn2(3,nelt2) Integer array Input
On entry: the connectivity between triangles and vertices of the second input mesh. For each triangle j, conn2(i,j) gives the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,nelt2.
Constraints:
  • 1conn2(i,j)nv2;
  • conn2(1,j)conn2(2,j);
  • conn2(1,j)conn2(3,j) and conn2(2,j)conn2(3,j), for i=1,2,3 and j=1,2,,nelt2.
15: reft2(nelt2) Integer array Input
On entry: reft2(k) contains the user-supplied tag of the kth triangle from the second input mesh, for k=1,2,,nelt2.
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(2,*) Real (Kind=nag_wp) array Output
Note: the second dimension of the array coor3 must be at least nv1+nv2.
On exit: coor3(1,i) will contain the x coordinate of the ith vertex of the resulting mesh, for i=1,2,,nv3; while coor3(2,i) will contain the corresponding y coordinate.
20: edge3(3,*) Integer array Output
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. edge3(i,j) 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, edge3(3,j) 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,
  1. (i)if the jth edge is part of the partition interface, edge3(3,j) 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;
  2. (ii)otherwise, edge3(3,j) will contain the same tag as the corresponding edge belonging to the first and/or the second input mesh.
21: conn3(3,*) Integer array Output
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. conn3(i,j) will give the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,nelt3.
22: reft3(*) Integer array Output
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, reft3(k) 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, reft3(k) 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 Integer Input
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: iwork(liwork) Integer array Workspace
25: liwork Integer Input
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 Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. 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, conn1(I,J)=value, I=value, J=value and nv1=value.
Constraint: conn1(I,J)1 and conn1(I,J)nv1.
On entry, conn2(I,J)=value, I=value, J=value and nv2=value.
Constraint: conn2(I,J)1 and conn2(I,J)nv2.
On entry, edge1(I,J)=value, I=value, J=value and nv1=value.
Constraint: edge1(I,J)1 and edge1(I,J)nv1.
On entry, edge2(I,J)=value, I=value, J=value and nv2=value.
Constraint: edge2(I,J)1 and edge2(I,J)nv2.
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: nelt1(2×nv1-1).
On entry, nelt2=value and nv2=value.
Constraint: nelt2(2×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 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
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,1]2 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:
  1. (a)overlapping meshes (u1=15.0, u2=17.0),
  2. (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 5.4 patchlevel 6 '-' Example Program Figure 1: Boundary and Interior Interface of Partitioned Squares
GnuplotProduced by GNUPLOT 5.4 patchlevel 6 "d06dbfe.r" ind 2 Figure 2: Interior Mesh of Partitioned Squares
GnuplotProduced by GNUPLOT 5.4 patchlevel 6 '-' Figure 3: Boundary and Interior Interface of Overlapping Squares
GnuplotProduced by GNUPLOT 5.4 patchlevel 6 "d06dbfe.r" ind 1 Figure 4: Interior Mesh of Overlapping Squares
GnuplotProduced by GNUPLOT 5.4 patchlevel 6 '-' Figure 5: Boundary and Interior Interfaces for Key Shape
GnuplotProduced by GNUPLOT 5.4 patchlevel 6 "d06dbfe.r" ind 3 Figure 6: Interior Mesh of KeyShape