Test_VerticalLinearMap.pf Source File


This file depends on

sourcefile~~test_verticallinearmap.pf~~EfferentGraph sourcefile~test_verticallinearmap.pf Test_VerticalLinearMap.pf sourcefile~csr_sparsematrix.f90 CSR_SparseMatrix.F90 sourcefile~test_verticallinearmap.pf->sourcefile~csr_sparsematrix.f90 sourcefile~verticallinearmap.f90 VerticalLinearMap.F90 sourcefile~test_verticallinearmap.pf->sourcefile~verticallinearmap.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~csr_sparsematrix.f90->sourcefile~keywordenforcer.f90 sourcefile~verticallinearmap.f90->sourcefile~csr_sparsematrix.f90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~verticallinearmap.f90->sourcefile~errorhandling.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90

Source Code

#include "MAPL_TestErr.h"

module Test_VerticalLinearMap

   use mapl3g_CSR_SparseMatrix, only: SparseMatrix_sp => CSR_SparseMatrix_sp, matmul
   use mapl3g_VerticalLinearMap, only: compute_linear_map
   use funit
   use, intrinsic :: iso_fortran_env, only: REAL32

   implicit none

contains

   @test
   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

end module Test_VerticalLinearMap