# naginterfaces.library.mesh.dim2_​sparsity¶

naginterfaces.library.mesh.dim2_sparsity(nv, nnzmax, conn)[source]

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

For full information please refer to the NAG Library document for d06cb

https://www.nag.com/numeric/nl/nagdoc_28.7/flhtml/d06/d06cbf.html

Parameters
nvint

The total number of vertices in the input mesh.

nnzmaxint

The maximum number of nonzero entries in the matrix based on the input mesh. It is the dimension of the arrays and as declared in the function from which dim2_sparsity is called.

connint, array-like, shape

The connectivity of the mesh between triangles and vertices. For each triangle , gives the indices of its three vertices (in anticlockwise order), for , for .

Returns
nnzint

The number of nonzero entries in the matrix associated with the input mesh.

irowint, ndarray, shape

The first elements contain the row and column indices of the nonzero elements supplied in the finite element matrix .

icolint, ndarray, shape

The first elements contain the row and column indices of the nonzero elements supplied in the finite element matrix .

Raises
NagValueError
(errno )

On entry, , , and .

Constraint: and .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, vertices and of the triangle have the same index : and .

(errno )

On entry, vertices and of the triangle have the same index : and .

(errno )

On entry, vertices and of the triangle have the same index : and .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

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 ). Array dimensions should also be checked. If the problem persists, contact NAG.

Notes

dim2_sparsity 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 submodule sparse. More precisely dim2_sparsity 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 Introduction and in solving the resulting sparse linear system using functions from submodule sparse.

The output sparsity pattern is based on the fact that finite element matrix has elements satisfying: