test_010 Subroutine

subroutine test_010(id, nfail)

Uses

  • proc~~test_010~~UsesGraph proc~test_010 test_010 module~forcolormap_parameters forcolormap_parameters proc~test_010->module~forcolormap_parameters module~forcolormap_utils forcolormap_utils proc~test_010->module~forcolormap_utils iso_fortran_env iso_fortran_env module~forcolormap_parameters->iso_fortran_env module~forcolormap_utils->module~forcolormap_parameters

At each node t_i, the Lagrange basis should satisfy B_j(t_i)=δ_ij.

Arguments

Type IntentOptional Attributes Name
integer, intent(inout) :: id
integer, intent(inout) :: nfail

Calls

proc~~test_010~~CallsGraph proc~test_010 test_010 proc~lagrange_poly lagrange_poly proc~test_010->proc~lagrange_poly proc~report_test report_test proc~test_010->proc~report_test

Called by

proc~~test_010~~CalledByGraph proc~test_010 test_010 program~check check program~check->proc~test_010

Source Code

   subroutine test_010(id, nfail)
      use forcolormap_parameters, only: wp
      use forcolormap_utils,      only: lagrange_poly
      integer, intent(inout) :: id, nfail
      character(len=*), parameter :: name = "lagrange_poly: nodal Kronecker delta property (n=7)"
      logical :: ok
      real(wp), parameter :: tol = 1.0e-12_wp
      integer :: n, i, j
      real(wp) :: inv, t
      real(wp), allocatable :: B(:)

      n = 7
      allocate(B(n))
      inv = 1.0_wp / real(n-1, wp)

      ok = .true.
      do i = 1, n
         t = real(i-1, wp) * inv
         B = lagrange_poly(t, n)
         do j = 1, n
            if (j == i) then
               ok = ok .and. (abs(B(j) - 1.0_wp) <= tol)
            else
               ok = ok .and. (abs(B(j)) <= tol)
            end if
         end do
      end do

      call report_test(name, ok, id, nfail)
   end subroutine test_010