D06CBF (PDF version)
D06 Chapter Contents
D06 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

D06CBF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy
    9  Example

1  Purpose

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

2  Specification

SUBROUTINE D06CBF ( NV, NELT, NNZMAX, CONN, NNZ, IROW, ICOL, IFAIL)
INTEGER  NV, NELT, NNZMAX, CONN(3,NELT), NNZ, IROW(NNZMAX), ICOL(NNZMAX), IFAIL

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  Parameters

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:     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 subroutine from which D06CBF is called.
Constraint: 4×NELT+NVNNZMAXNV2.
4:     CONN(3,NELT) – INTEGER arrayInput
On entry: the connectivity of the mesh between triangles and vertices. For each triangle j, CONNij gives the indices of its three vertices (in anticlockwise order), for i=1,2,3 and j=1,2,,NELT.
Constraint: 1CONNijNV and CONN1jCONN2j and CONN1jCONN3j and CONN2jCONN3j, for i=1,2,3 and j=1,2,,NELT.
5:     NNZ – INTEGEROutput
On exit: the number of nonzero entries in the matrix associated with the input mesh.
6:     IROW(NNZMAX) – INTEGER arrayOutput
7:     ICOL(NNZMAX) – INTEGER arrayOutput
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 – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction 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 parameter, 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,NV<3,
orNELT>2×NV-1,
orNNZMAX<4×NELT+NV or NNZMAX>NV2
orCONNij<1 or CONNij>NV for some i=1,3 and j, 1jNELT,
orCONN1j=CONN2j or CONN1j=CONN3j or
CONN2j=CONN3j for some j=1,2,,NELT.
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 parameter CONN). Array dimensions should be checked as well. If the problem persists, contact NAG.

7  Accuracy

Not applicable.

8  Further Comments

None.

9  Example

See Section 9 in D06CCF.

D06CBF (PDF version)
D06 Chapter Contents
D06 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012