compare_real_1d Function

public function compare_real_1d(label, got, exp, tol)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: label
real, intent(in) :: got(:)
real, intent(in) :: exp(:)
real, intent(in) :: tol

Return Value logical


Called by

proc~~compare_real_1d~~CalledByGraph proc~compare_real_1d compare_real_1d proc~tests_mpi_operators tests_mpi_operators proc~tests_mpi_operators->proc~compare_real_1d proc~execute_runmode_actions execute_runmode_actions proc~execute_runmode_actions->proc~tests_mpi_operators program~udales uDALES program~udales->proc~execute_runmode_actions

Source Code

  logical function compare_real_1d(label, got, exp, tol)
    implicit none
    character(len=*), intent(in) :: label
    real, intent(in) :: got(:), exp(:)
    real, intent(in) :: tol
    real :: max_abs
    integer :: imax(1)

    max_abs = maxval(abs(got - exp))
    compare_real_1d = max_abs <= tol
    if ((.not. compare_real_1d) .and. myid == 0) then
      imax = maxloc(abs(got - exp))
      write(*,'(A,1X,A,1X,ES12.4,1X,A,I0,1X,A,ES12.4,1X,A,ES12.4)') &
           'FAIL', trim(label), max_abs, 'idx', imax(1), 'got', got(imax(1)), 'exp', exp(imax(1))
    end if
  end function compare_real_1d