test_compute_linear_map Subroutine

public subroutine test_compute_linear_map()

Arguments

None

Calls

proc~~test_compute_linear_map~~CallsGraph proc~test_compute_linear_map test_compute_linear_map anyexceptions anyexceptions proc~test_compute_linear_map->anyexceptions assert_that assert_that proc~test_compute_linear_map->assert_that assertequal assertequal proc~test_compute_linear_map->assertequal proc~compute_linear_map compute_linear_map proc~test_compute_linear_map->proc~compute_linear_map sourcelocation sourcelocation proc~test_compute_linear_map->sourcelocation add_row add_row proc~compute_linear_map->add_row interface~mapl_assert MAPL_Assert proc~compute_linear_map->interface~mapl_assert proc~mapl_return MAPL_Return proc~compute_linear_map->proc~mapl_return at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception

Source Code

   subroutine test_compute_linear_map()

      real(REAL32), allocatable :: vcoord_src(:), vcoord_dst(:)
      real(REAL32), allocatable :: fin(:)
      ! real(REAL32), allocatable :: matrix(:, :)
      type(SparseMatrix_sp) :: matrix
      integer :: status

      vcoord_src = [30., 20., 10.]
      vcoord_dst = [20., 10.]
      call compute_linear_map(vcoord_src, vcoord_dst, matrix, _RC)
      fin = [7., 8., 3.]
      @assertEqual([8., 3.], matmul(matrix, fin))

      vcoord_src = [30., 20., 10.]
      vcoord_dst = [25., 15.]
      call compute_linear_map(vcoord_src, vcoord_dst, matrix, _RC)
      fin = [2., 4., 6.]
      @assertEqual([3.,5.], matmul(matrix, fin))
      fin = [7., 8., 3.]
      @assertEqual([7.5, 5.5], matmul(matrix, fin))

      vcoord_src = [30., 20., 10.]
      vcoord_dst = [28., 12.]
      call compute_linear_map(vcoord_src, vcoord_dst, matrix, _RC)
      fin = [20., 10., 5.]
      @assertEqual([18., 6.], matmul(matrix, fin))

   end subroutine test_compute_linear_map