ndarray_oc_setval Subroutine

public subroutine ndarray_oc_setval(this, val, flags)

Subroutine to set array to a scalar value.

Arguments

Type IntentOptional AttributesName
class(ndarray_oc), intent(inout) :: this
real(kind=pfdp), intent(in) :: val
integer, intent(in), optional :: flags

Contents

Source Code


Source Code

  subroutine ndarray_oc_setval(this, val, flags)
    class(ndarray_oc), intent(inout)     :: this
    real(pfdp),  intent(in   )           :: val
    integer,     intent(in   ), optional :: flags
    integer :: which

    which = 0
    if (present(flags)) which = flags
!     if(.not.present(flags)) print *, "setval without flags"

    select case (which)
    case (0)
      this%yflatarray = val
      this%pflatarray = val
    case (1)
      this%yflatarray = val
    case (2)
      this%pflatarray = val
    case default
       stop "ERROR in ndarray_oc_setval: only 0, 1, 2 allowed as flags"
    end select

  end subroutine ndarray_oc_setval