get_array2d_oc Function

public function get_array2d_oc(x, flags) result(r)

Arguments

Type IntentOptional AttributesName
class(pf_encap_t), intent(in) :: x
integer, intent(in), optional :: flags

Return Value real(kind=pfdp), pointer,(:,:)


Contents

Source Code


Source Code

  function get_array2d_oc(x, flags) result(r)
    class(pf_encap_t), intent(in) :: x
    integer,     intent(in   ), optional :: flags
    real(pfdp), pointer :: r(:,:)
    integer                :: which

    which = 0
    if (present(flags)) which = flags
!     if(.not.present(flags)) print *, "array2d_oc without flags"
    
    select type (x)
    type is (ndarray_oc)
      select case (which)
        case (1)
          r(1:x%shape(1),1:x%shape(2)) => x%yflatarray
        case (2)
          r(1:x%shape(1),1:x%shape(2)) => x%pflatarray
        case default
          stop "ERROR in get_array2d_oc: only 1, 2 allowed as flags"
       end select
    class default
       stop "ERROR: get_array2d_oc type mismatch."
    end select
  end function get_array2d_oc