add_array_ptr Module Function

module function add_array_ptr(a, idx1, idx2) result(c)

Add two autodiff arrays

Arguments

Type IntentOptional Attributes Name
type(array_ptr_type), intent(in), dimension(:) :: a
integer, intent(in) :: idx1
integer, intent(in) :: idx2

Return Value type(array_type), pointer


Source Code

  module function add_array_ptr(a, idx1, idx2) result(c)
    !! Add two autodiff arrays
    implicit none

    ! Arguments
    type(array_ptr_type), dimension(:), intent(in) :: a
    integer, intent(in) :: idx1, idx2
    type(array_type), pointer :: c

    ! Local variables
    integer :: i

    c => a(1)%array(idx1, idx2) + a(2)%array(idx1, idx2)
    do i = 3, size(a), 1
       c => c + a(i)%array(idx1, idx2)
    end do
  end function add_array_ptr