NAG Library Routine Document

d06dbf (dim2_join)

 Contents

    1  Purpose
    7  Accuracy

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,eps0.0,
ornv1<3,
ornelt1>2×nv1-1,
ornedge1<1,
oredge1ij<1 or edge1ij>nv1 for some i=1,2 and j=1,2,,nedge1,
oredge11j=edge12j for some j=1,2,,nedge1,
orconn1ij<1 or conn1ij>nv1 for some i=1,2,3 and j=1,2,,nelt1,
orconn11j=conn12j or conn11j=conn13j or conn12j=conn13j for some j=1,2,,nelt1,
ornv2<3,
ornelt2>2×nv2-1,
ornedge2<1,
oredge2ij<1 or edge2ij>nv2 for some i=1,2 and j=1,2,,nedge2,
oredge21j=edge22j for some j=1,2,,nedge2,
orconn2ij<1 or conn2ij>nv2 for some i=1,2,3 and j=1,2,,nelt2,
orconn21j=conn22j or conn21j=conn23j or
conn22j=conn23j for some j=1,2,,nelt2,
orliwork<2×nv1+3×nv2+nelt1+nelt2+nedge1+nedge2+1024.
ifail=2
Using the input precision eps, the routine has detected fewer than two coincident vertices between the two input meshes. You are advised to try another value of eps; if this error still occurs the two meshes are probably not stitchable.
ifail=3
A serious error has occurred in an internal call to the restitching routine. You should check the input of the two meshes, especially the edge/vertex and/or the triangle/vertex connectivities. If the problem persists, contact NAG.
ifail=4
The routine has detected a different number of coincident triangles from the two input meshes in the overlapping zone. You should check the input of the two meshes, especially the triangle/vertex connectivities.
ifail=5
The routine has detected a different number of coincident edges from the two meshes on the partition interface. You should check the input of the two meshes, especially the edge/vertex connectivities.
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
© The Numerical Algorithms Group Ltd, Oxford, UK. 2017