compare_real_2d_jk Function

public function compare_real_2d_jk(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_2d_jk~~CalledByGraph proc~compare_real_2d_jk compare_real_2d_jk proc~tests_mpi_operators tests_mpi_operators proc~tests_mpi_operators->proc~compare_real_2d_jk 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_2d_jk(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(2)

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