NAG FL Interface
d06cbf (dim2_​sparsity)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

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

2 Specification

Fortran Interface
Subroutine d06cbf ( nv, nelt, nnzmax, conn, nnz, irow, icol, ifail)
Integer, Intent (In) :: nv, nelt, nnzmax, conn(3,nelt)
Integer, Intent (Inout) :: ifail
Integer, Intent (Out) :: nnz, irow(nnzmax), icol(nnzmax)
C Header Interface
#include <nag.h>
void  d06cbf_ (const Integer *nv, const Integer *nelt, const Integer *nnzmax, const Integer conn[], Integer *nnz, Integer irow[], Integer icol[], Integer *ifail)
The routine may be called by the names d06cbf or nagf_mesh_dim2_sparsity.

3 Description

d06cbf 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 routines in Chapter F11. More precisely d06cbf 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 routines 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 subroutine from which d06cbf is called.
Constraint: 4×nelt+nvnnzmaxnv2.
4: conn(3,nelt) Integer array Input
On entry: the connectivity of the mesh between triangles and vertices. For each triangle j, conn(i,j) gives the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,nelt.
Constraint: 1conn(i,j)nv and conn(1,j)conn(2,j) and conn(1,j)conn(3,j) and conn(2,j)conn(3,j), 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 array Output
7: icol(nnzmax) Integer array 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: 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, conn(I,J)=value, I=value, J=value and nv=value.
Constraint: conn(I,J)1 and conn(I,J)nv.
On entry, nelt=value and nv=value.
Constraint: nelt2×nv-1.
On entry, nnzmax=value, nelt=value and nv=value.
Constraint: nnzmax(4×nelt+nv).
On entry, nnzmax=value and nv=value.
Constraint: nnzmaxnv2.
On entry, nv=value.
Constraint: nv3.
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.
ifail=2
A serious error has occurred in an internal call to an auxiliary routine. 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.
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.
d06cbf 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

None.

10 Example

See d06ccf.