Skip to content

Commit 101c76d

Browse files
committed
DONT MERGE: temp. revert
1 parent ff404b4 commit 101c76d

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

femtools/Sparse_Tools_Petsc.F90

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ subroutine allocate_petsc_csr_matrix_from_nnz(matrix, rows, columns, &
411411
! Create serial block matrix:
412412
call MatCreateBAIJ(MPI_COMM_SELF, element_size, &
413413
urows, ucols, urows, ucols, &
414-
0, dnnz, 0, PETSC_NULL_INTEGER_ARRAY, matrix%M, ierr)
414+
0, dnnz, 0, PETSC_NULL_INTEGER, matrix%M, ierr)
415415

416416
elseif (use_element_blocks) then
417417

@@ -429,7 +429,7 @@ subroutine allocate_petsc_csr_matrix_from_nnz(matrix, rows, columns, &
429429

430430
! Create serial matrix:
431431
call MatCreateAIJ(MPI_COMM_SELF, urows, ucols, urows, ucols, &
432-
0, dnnz, 0, PETSC_NULL_INTEGER_ARRAY, matrix%M, ierr)
432+
0, dnnz, 0, PETSC_NULL_INTEGER, matrix%M, ierr)
433433
call MatSetBlockSizes(matrix%M, lgroup_size(1), lgroup_size(2), ierr)
434434

435435
else
@@ -735,20 +735,12 @@ function petsc_csr_entries(matrix) result (entries)
735735
integer :: entries
736736
type(petsc_csr_matrix), intent(in) :: matrix
737737

738-
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR<23)
739738
double precision, dimension(MAT_INFO_SIZE):: matrixinfo
740-
#else
741-
MatInfo :: matrixinfo
742-
#endif
743739
PetscErrorCode:: ierr
744740

745741
! get the necessary info about the matrix:
746742
call MatGetInfo(matrix%M, MAT_LOCAL, matrixinfo, ierr)
747-
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR<23)
748743
entries=matrixinfo(MAT_INFO_NZ_USED)
749-
#else
750-
entries=int(matrixinfo%nz_used)
751-
#endif
752744

753745
end function petsc_csr_entries
754746

@@ -780,26 +772,6 @@ subroutine petsc_csr_addto(matrix, blocki, blockj, i, j, val)
780772

781773
end subroutine petsc_csr_addto
782774

783-
subroutine fix_column_numbers(idxm, idxn)
784-
! for some rows that we are not assembling (indicated with negative index)
785-
! the column indices are not reliable, as they are outside any halo and thus
786-
! have not been filled in in the gnn2unn numbering (we don't know their universal petsc number)
787-
! this is fine because we're telling petsc to skip these entries (with a negative row index)
788-
! but the random column index may still trip some internal petsc checks
789-
! therefore here we set these to negative as well
790-
791-
PetscInt, dimension(:), intent(in) :: idxm ! row numbers
792-
PetscInt, dimension(:), intent(inout) :: idxn ! column numbers
793-
integer i
794-
795-
do i=1, size(idxm)
796-
if (idxm(i)<0) then
797-
idxn(i) = -1
798-
end if
799-
end do
800-
801-
end subroutine fix_column_numbers
802-
803775
subroutine petsc_csr_vaddto(matrix, blocki, blockj, i, j, val)
804776
!!< Add multiple values to matrix(blocki, blockj, i,j)
805777
type(petsc_csr_matrix), intent(inout) :: matrix
@@ -813,7 +785,6 @@ subroutine petsc_csr_vaddto(matrix, blocki, blockj, i, j, val)
813785

814786
idxm=matrix%row_numbering%gnn2unn(i,blocki)
815787
idxn=matrix%column_numbering%gnn2unn(j,blockj)
816-
call fix_column_numbers(idxm, idxn)
817788

818789
call MatSetValues(matrix%M, size(i), idxm, size(j), idxn, &
819790
real(reshape(val, (/ size(val) /)), kind=PetscScalar_kind), &
@@ -837,7 +808,6 @@ subroutine petsc_csr_block_addto(matrix, i, j, val)
837808

838809
idxm=matrix%row_numbering%gnn2unn(i,:)
839810
idxn=matrix%column_numbering%gnn2unn(j,:)
840-
call fix_column_numbers(idxm, idxn)
841811

842812
call MatSetValues(matrix%M, size(idxm), idxm, size(idxn), idxn, &
843813
real(reshape(val, (/ size(val) /)), kind=PetscScalar_kind), ADD_VALUES, ierr)
@@ -865,7 +835,6 @@ subroutine petsc_csr_blocks_addto(matrix, i, j, val)
865835
idxm=matrix%row_numbering%gnn2unn(i,blocki)
866836
do blockj=1, size(matrix%column_numbering%gnn2unn,2)
867837
idxn=matrix%column_numbering%gnn2unn(j,blockj)
868-
call fix_column_numbers(idxm, idxn)
869838
! unfortunately we need a copy here to pass contiguous memory
870839
value=reshape(val(blocki, blockj, :, :), (/ size(value) /))
871840
call MatSetValues(matrix%M, size(i), idxm, size(j), idxn, &
@@ -898,7 +867,6 @@ subroutine petsc_csr_blocks_addto_withmask(matrix, i, j, val, block_mask)
898867
do blockj=1, size(matrix%column_numbering%gnn2unn,2)
899868
if (block_mask(blocki,blockj)) then
900869
idxn=matrix%column_numbering%gnn2unn(j,blockj)
901-
call fix_column_numbers(idxm, idxn)
902870
! unfortunately we need a copy here to pass contiguous memory
903871
value=reshape(val(blocki, blockj, :, :), (/ size(value) /))
904872
call MatSetValues(matrix%M, size(i), idxm, size(j), idxn, &

0 commit comments

Comments
 (0)