NAG CL Interface
d06cbc (dim2_​sparsity)

1 Purpose

d06cbc generates the sparsity pattern of a finite element matrix associated with a given mesh.

2 Specification

#include <nag.h>
void  d06cbc (Integer nv, Integer nelt, Integer nnzmax, const Integer conn[], Integer *nnz, Integer irow[], Integer icol[], NagError *fail)
The function may be called by the names: d06cbc, nag_mesh_dim2_sparsity or nag_mesh2d_sparse.

3 Description

d06cbc generates the sparsity pattern of a finite element matrix associated with a given mesh. The sparsity pattern is returned in a coordinate storage format consistent with the sparse linear algebra functions in Chapter F11. More precisely d06cbc returns the number of nonzero elements in the associated sparse matrix, and their row and column indices. This is designed to assist you in applying finite element discretization to meshes from the D06 Chapter Introduction and in solving the resulting sparse linear system using functions from Chapter F11.
The output sparsity pattern is based on the fact that finite element matrix A has elements aij satisfying:
aij0 i​ and ​j ​ are vertices belonging to the same triangle.  

4 References

None.

5 Arguments

1: nv Integer Input
On entry: the total number of vertices in the input mesh.
Constraint: nv3.
2: nelt Integer Input
On entry: the number of triangles in the input mesh.
Constraint: nelt2×nv-1.
3: nnzmax Integer Input
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 d06cbc is called.
Constraint: 4×nelt+nvnnzmaxnv2.
4: conn[3×nelt] const Integer Input
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.
5: nnz Integer * Output
On exit: the number of nonzero entries in the matrix associated with the input mesh.
6: irow[nnzmax] Integer Output
7: icol[nnzmax] Integer Output
On exit: the first nnz elements contain the row and column indices of the nonzero elements supplied in the finite element matrix A.
8: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, nv=value.
Constraint: nv3.
NE_INT_2
On entry, nelt=value and nv=value.
Constraint: nelt2×nv-1.
On entry, nnzmax=value and nv=value.
Constraint: nnzmaxnv2.
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.
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].
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 7.5 in the Introduction to the NAG Library CL Interface for further information.
A serious error has occurred in an internal call to an auxiliary function. Check the input mesh, especially the connectivity between triangles and vertices (the argument conn). Array dimensions should also be checked. If the problem persists, contact NAG.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

d06cbc 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

See Section 10 in d06ccc.