Skip to main content

SetSparsity

SetSparsity() method sets the sparsity pattern in the sparse matrix.

There are two interfaces for this purpose. The use of this method is exactly the same as the one described for CSRSparsity.

note

While calling SetSparsity() user has to deal with the node numbers only, because this routine reads the information stored inside the DOF object field, and take care of sparsity patterns for all degrees of freedom.

info

please note that when you are done with setting the sparsity pattern make sure you call SetSparsity(obj). This will clean up the workspace, and prepare the compacted data inside CSRMatrix_ object.

Interface

INTERFACE
MODULE SUBROUTINE SetSparsity(obj, row, col)
TYPE(CSRMatrix_), INTENT(INOUT) :: obj
INTEGER(I4B), INTENT(IN) :: row
INTEGER(I4B), INTENT(IN) :: col(:)
END SUBROUTINE SetSparsity
END INTERFACE

This method should be used for setting sparsity pattern for problems in which there is only primary unknown (i.e., single physical variable).

  • This subroutine sets the sparsity pattern of a given row.
  • If obj%tdof is equal to 1, then Col is sorted in increasing order, and appended to obj%Row(Row)
  • If obj%tdof is not equal to 1, then based on the storage format (see DOF_) we generate Col connectivity information.