Advance V5 core capabilities and planning
This commit is contained in:
@@ -8,6 +8,7 @@ program test_sparse_csr
|
||||
|
||||
call check_basic_operations()
|
||||
call check_dirichlet()
|
||||
call check_export()
|
||||
call check_invalid_pattern()
|
||||
|
||||
contains
|
||||
@@ -100,6 +101,51 @@ contains
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(36)
|
||||
end subroutine check_dirichlet
|
||||
|
||||
subroutine check_export()
|
||||
type(csr_matrix) :: a
|
||||
integer :: ierr
|
||||
integer :: nrow
|
||||
integer :: ncol
|
||||
integer :: nnz
|
||||
integer :: row_ptr(4)
|
||||
integer :: col_ind(7)
|
||||
integer :: row_ptr0(4)
|
||||
integer :: col_ind0(7)
|
||||
integer :: row_ptr1(4)
|
||||
integer :: col_ind1(7)
|
||||
real(rk) :: val_out(7)
|
||||
|
||||
call csr_init(a)
|
||||
row_ptr = (/ 1, 3, 6, 8 /)
|
||||
col_ind = (/ 1, 2, 1, 2, 3, 2, 3 /)
|
||||
call csr_create_pattern(a, 3, 3, row_ptr, col_ind, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(60)
|
||||
call fill_tridiagonal(a, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(61)
|
||||
|
||||
call csr_get_shape(a, nrow, ncol, nnz, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(62)
|
||||
if (nrow .ne. 3 .or. ncol .ne. 3 .or. nnz .ne. 7) call fail(63)
|
||||
|
||||
call csr_export(a, 1, row_ptr1, col_ind1, val_out, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(64)
|
||||
if (any(row_ptr1 .ne. row_ptr)) call fail(65)
|
||||
if (any(col_ind1 .ne. col_ind)) call fail(66)
|
||||
call check_close(val_out(1), 2.0_rk, 67)
|
||||
call check_close(val_out(4), 2.0_rk, 68)
|
||||
|
||||
call csr_export(a, 0, row_ptr0, col_ind0, val_out, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(69)
|
||||
if (any(row_ptr0 .ne. row_ptr - 1)) call fail(70)
|
||||
if (any(col_ind0 .ne. col_ind - 1)) call fail(71)
|
||||
|
||||
call csr_export(a, 2, row_ptr1, col_ind1, val_out, ierr)
|
||||
if (ierr .eq. FEM_SUCCESS) call fail(72)
|
||||
|
||||
call csr_free(a, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) call fail(73)
|
||||
end subroutine check_export
|
||||
|
||||
subroutine check_invalid_pattern()
|
||||
type(csr_matrix) :: a
|
||||
integer :: ierr
|
||||
|
||||
Reference in New Issue
Block a user