set_array Module Subroutine

pure module subroutine set_array(this, input)

Set the array

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(inout) :: this

Instance of the array type

real(kind=real32), intent(in), dimension(..) :: input

Input array


Source Code

  pure module subroutine set_array(this, input)
    !! Set the array
    implicit none

    ! Arguments
    class(array_type), intent(inout) :: this
    !! Instance of the array type
    real(real32), dimension(..), intent(in) :: input
    !! Input array

    if( any(shape(input).ne.[this%shape, size(this%val,2)]) )then
       return
    end if
    select rank(input)
    rank(1)
       this%val(:,1) = input
    rank(2)
       this%val(:,:) = input
    rank(3)
       this%val(:,:) = reshape(input, shape(this%val))
    rank(4)
       this%val(:,:) = reshape(input, shape(this%val))
    rank(5)
       this%val(:,:) = reshape(input, shape(this%val))
    end select
  end subroutine set_array