ndarray_oc_norm Function

public function ndarray_oc_norm(this, flags) result(norm)

Subroutine to define the norm of the array (here the max norm)

Arguments

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

Return Value real(kind=pfdp)


Contents

Source Code


Source Code

  function ndarray_oc_norm(this, flags) result (norm)
    class(ndarray_oc), intent(in   ) :: this
    integer,     intent(in   ), optional :: flags
    real(pfdp)   :: norm
    integer :: which

    which = 0
    if (present(flags)) which = flags
    if(.not.present(flags)) print *, "norm without flags"
    
    select case (which)
    case (0)
       norm = max(maxval(abs(this%yflatarray)), maxval(abs(this%pflatarray)))
    case (1)
       norm = maxval(abs(this%yflatarray))
    case (2)
       norm = maxval(abs(this%pflatarray))  
    case default
       stop "ERROR in ndarray_oc_norm: only 0, 1, 2 allowed as flags"
    end select
  end function ndarray_oc_norm