ndarray_oc_copy Subroutine

public subroutine ndarray_oc_copy(this, src, flags)

Subroutine to copy an array

Arguments

Type IntentOptional AttributesName
class(ndarray_oc), intent(inout) :: this
class(pf_encap_t), intent(in) :: src
integer, intent(in), optional :: flags

Contents

Source Code


Source Code

  subroutine ndarray_oc_copy(this, src, flags)
    class(ndarray_oc),    intent(inout)  :: this
    class(pf_encap_t),    intent(in   )  :: src
    integer,     intent(in   ), optional :: flags
    integer :: which

    which = 0
    if (present(flags)) which = flags
!     if(.not.present(flags)) print *, "copy without flags"
    
    select type(src)
    type is (ndarray_oc)
      select case (which)
      case (0)
        this%yflatarray = src%yflatarray
        this%pflatarray = src%pflatarray
      case (1)
        this%yflatarray = src%yflatarray
      case (2)
        this%pflatarray = src%pflatarray
      case default
        stop "ERROR in ndarray_oc_copy: only 0, 1, 2 allowed as flags"
      end select
    class default
      stop "TYPE ERROR in ndarray_oc_copy"
    end select
  end subroutine ndarray_oc_copy