get_sparsity_pattern Subroutine

private subroutine get_sparsity_pattern(me, irow, icol, linear_irow, linear_icol, linear_vals, maxgrp, ngrp)

Returns the sparsity pattern from the class. If it hasn't been computed, the output arrays will not be allocated.

Type Bound

numdiff_type

Arguments

Type IntentOptional Attributes Name
class(numdiff_type), intent(inout) :: me
integer, intent(out), dimension(:), allocatable :: irow

sparsity pattern nonzero elements row indices

integer, intent(out), dimension(:), allocatable :: icol

sparsity pattern nonzero elements column indices

integer, intent(out), optional, dimension(:), allocatable :: linear_irow

linear sparsity pattern nonzero elements row indices

integer, intent(out), optional, dimension(:), allocatable :: linear_icol

linear sparsity pattern nonzero elements column indices

real(kind=wp), intent(out), optional, dimension(:), allocatable :: linear_vals

linear sparsity values (constant elements of the Jacobian)

integer, intent(out), optional :: maxgrp

DSM sparsity partition

integer, intent(out), optional, dimension(:), allocatable :: ngrp

DSM sparsity partition


Called by

proc~~get_sparsity_pattern~~CalledByGraph proc~get_sparsity_pattern numerical_differentiation_module::numdiff_type%get_sparsity_pattern proc~compute_sparsity_pattern numerical_differentiation_module::numdiff_type%compute_sparsity_pattern proc~compute_sparsity_pattern->proc~get_sparsity_pattern

Source Code

    subroutine get_sparsity_pattern(me,irow,icol,&
                                    linear_irow,linear_icol,linear_vals,&
                                    maxgrp,ngrp)

    implicit none

    class(numdiff_type),intent(inout) :: me
    integer,dimension(:),allocatable,intent(out)  :: irow  !! sparsity pattern nonzero elements row indices
    integer,dimension(:),allocatable,intent(out)  :: icol  !! sparsity pattern nonzero elements column indices
    integer,dimension(:),allocatable,intent(out),optional  :: linear_irow !! linear sparsity pattern
                                                                          !! nonzero elements row indices
    integer,dimension(:),allocatable,intent(out),optional  :: linear_icol !! linear sparsity pattern nonzero
                                                                          !! elements column indices
    real(wp),dimension(:),allocatable,intent(out),optional :: linear_vals !! linear sparsity values (constant
                                                                          !! elements of the Jacobian)
    integer,intent(out),optional                           :: maxgrp      !! DSM sparsity partition
    integer,dimension(:),allocatable,intent(out),optional  :: ngrp        !! DSM sparsity partition

    if (me%exception_raised) return ! check for exceptions

    if (allocated(me%sparsity%irow) .and. allocated(me%sparsity%icol)) then
        irow = me%sparsity%irow
        icol = me%sparsity%icol
    end if

    ! optional linear pattern output:
    if (present(linear_irow)) then
        if (allocated(me%sparsity%linear_irow)) linear_irow = me%sparsity%linear_irow
    end if
    if (present(linear_icol)) then
        if (allocated(me%sparsity%linear_icol)) linear_icol = me%sparsity%linear_icol
    end if
    if (present(linear_vals)) then
        if (allocated(me%sparsity%linear_vals)) linear_vals = me%sparsity%linear_vals
    end if

    ! optional DSM partition:
    if (present(ngrp) .and. allocated(me%sparsity%ngrp)) ngrp = me%sparsity%ngrp
    if (present(maxgrp)) maxgrp = me%sparsity%maxgrp

    end subroutine get_sparsity_pattern