NAG Library Function Document

nag_mesh2d_renum (d06ccc)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

nag_mesh2d_renum (d06ccc) renumbers the vertices of a given mesh using a Gibbs method, in order the reduce the bandwidth of Finite Element matrices associated with that mesh.

2
Specification

#include <nag.h>
#include <nagd06.h>
void  nag_mesh2d_renum (Integer nv, Integer nelt, Integer nedge, Integer nnzmax, Integer *nnz, double coor[], Integer edge[], Integer conn[], Integer irow[], Integer icol[], Integer itrace, const char *outfile, NagError *fail)

3
Description

nag_mesh2d_renum (d06ccc) uses a Gibbs method to renumber the vertices of a given mesh in order to reduce the bandwidth of the associated finite element matrix A. This matrix has elements aij such that:
aij0i​ and ​j​ are vertices belonging to the same triangle.  
This function reduces the bandwidth m, which is the smallest integer such that aij0 whenever i-j>m (see Gibbs et al. (1976) for details about that method). nag_mesh2d_renum (d06ccc) also returns the sparsity structure of the matrix associated with the renumbered mesh.
This function is derived from material in the MODULEF package from INRIA (Institut National de Recherche en Informatique et Automatique).

4
References

Gibbs N E, Poole W G Jr and Stockmeyer P K (1976) An algorithm for reducing the bandwidth and profile of a sparse matrix SIAM J. Numer. Anal. 13 236–250

5
Arguments

1:     nv IntegerInput
On entry: the total number of vertices in the input mesh.
Constraint: nv3.
2:     nelt IntegerInput
On entry: the number of triangles in the input mesh.
Constraint: nelt2×nv-1.
3:     nedge IntegerInput
On entry: the number of boundary edges in the input mesh.
Constraint: nedge1.
4:     nnzmax IntegerInput
On entry: the maximum number of nonzero entries in the matrix based on the input mesh. It is the dimension of the arrays irow and icol as declared in the function from which nag_mesh2d_renum (d06ccc) is called.
Constraint: 4×nelt+nvnnzmaxnv2.
5:     nnz Integer *Output
On exit: the number of nonzero entries in the matrix based on the input mesh.
6:     coor[2×nv] doubleInput/Output
Note: the i,jth element of the matrix is stored in coor[j-1×2+i-1].
On entry: coor[i-1×2] contains the x coordinate of the ith input mesh vertex, for i=1,2,,nv; while coor[i-1×2+1] contains the corresponding y coordinate.
On exit: coor[i-1×2] will contain the x coordinate of the ith renumbered mesh vertex, for i=1,2,,nv; while coor[i-1×2+1] will contain the corresponding y coordinate.
7:     edge[3×nedge] IntegerInput/Output
Note: the i,jth element of the matrix is stored in edge[j-1×3+i-1].
On entry: the specification of the boundary or interface edges. edge[j-1×3] and edge[j-1×3+1] contain the vertex numbers of the two end points of the jth boundary edge. edge[j-1×3+2] is a user-supplied tag for the jth boundary or interface edge: edge[j-1×3+2]=0 for an interior edge and has a nonzero tag otherwise. Note that the edge vertices are numbered from 1 to nv.
Constraint: 1edge[j-1×3+i-1]nv and edge[j-1×3]edge[j-1×3+1], for i=1,2 and j=1,2,,nedge.
On exit: the renumbered specification of the boundary or interface edges.
8:     conn[3×nelt] IntegerInput/Output
Note: the i,jth element of the matrix is stored in conn[j-1×3+i-1].
On entry: the connectivity of the mesh between triangles and vertices. For each triangle j, conn[j-1×3+i-1] gives the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,nelt. Note that the mesh vertices are numbered from 1 to nv.
Constraint: 1conn[j-1×3+i-1]nv and conn[j-1×3]conn[j-1×3+1] and conn[j-1×3]conn[j-1×3+2] and conn[j-1×3+1]conn[j-1×3+2], for i=1,2,3 and j=1,2,,nelt.
On exit: the renumbered connectivity of the mesh between triangles and vertices.
9:     irow[nnzmax] IntegerOutput
10:   icol[nnzmax] IntegerOutput
On exit: the first nnz elements contain the row and column indices of the nonzero elements supplied in the finite element matrix A.
11:   itrace IntegerInput
On entry: the level of trace information required from nag_mesh2d_renum (d06ccc).
itrace0
No output is generated.
itrace=1
Information about the effect of the renumbering on the finite element matrix are output. This information includes the half bandwidth and the sparsity structure of this matrix before and after renumbering.
itrace>1
The output is similar to that produced when itrace=1 but the sparsities (for each row of the matrix, indices of nonzero entries) of the matrix before and after renumbering are also output.
12:   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.
13:   fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6
Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_FAIL_SPARSITY
An error has occurred during the computation of the compact sparsity of the finite element matrix. Check the Triangle/Vertices connectivity.
NE_INT
On entry, nedge=value.
Constraint: nedge1.
On entry, nv=value.
Constraint: nv3.
NE_INT_2
On entry, nelt=value and nv=value.
Constraint: nelt2×nv-1.
On entry, the end points of the edge J have the same index I: J=value and I=value.
On entry, vertices 1 and 2 of the triangle K have the same index I: K=value and I=value.
On entry, vertices 1 and 3 of the triangle K have the same index I: K=value and I=value.
On entry, vertices 2 and 3 of the triangle K have the same index I: K=value and I=value.
NE_INT_3
On entry, nnzmax=value, nelt=value and nv=value.
Constraint: nnzmax4×nelt+nv and nnzmaxnv2.
NE_INT_4
On entry, connI,J=value, I=value, J=value and nv=value.
Constraint: connI,J1 and connI,Jnv, where connI,J denotes conn[J-1×3+I-1].
On entry, edgeI,J=value, I=value, J=value and nv=value.
Constraint: edgeI,J1 and edgeI,Jnv, where edgeI,J denotes edge[J-1×3+I-1].
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.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
A serious error has occurred in an internal call to the renumbering function. Check the input mesh especially the connectivity. Seek expert help.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_NOT_CLOSE_FILE
Cannot close file value.
NE_NOT_WRITE_FILE
Cannot open file value for writing.

7
Accuracy

Not applicable.

8
Parallelism and Performance

nag_mesh2d_renum (d06ccc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
Further Comments

None.

10
Example

In this example, a geometry with two holes (two interior circles inside an exterior one) is considered. The geometry has been meshed using the simple incremental method (nag_mesh2d_inc (d06aac)) and it has 250 vertices and 402 triangles (see Figure 1 in Section 10.3). The function nag_mesh2d_bound (d06bac) is used to renumber the vertices, and one can see the benefit in terms of the sparsity of the finite element matrix based on the renumbered mesh (see Figure 2 and 3 inSection 10.3).

10.1
Program Text

Program Text (d06ccce.c)

10.2
Program Data

Program Data (d06ccce.d)

10.3
Program Results

Program Results (d06ccce.r)

GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Example Program Figure 1: Mesh of the Geometry gnuplot_plot_1
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Figure 2: Sparsity of the FE Matrix Before Renumbering gnuplot_plot_1
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 Figure 3: Sparsity of the FE Matrix After Renumbering gnuplot_plot_1
© The Numerical Algorithms Group Ltd, Oxford, UK. 2017