@@ -780,26 +780,6 @@ subroutine petsc_csr_addto(matrix, blocki, blockj, i, j, val)
780780
781781 end subroutine petsc_csr_addto
782782
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-
803783 subroutine petsc_csr_vaddto (matrix , blocki , blockj , i , j , val )
804784 ! !< Add multiple values to matrix(blocki, blockj, i,j)
805785 type (petsc_csr_matrix), intent (inout ) :: matrix
@@ -813,7 +793,6 @@ subroutine petsc_csr_vaddto(matrix, blocki, blockj, i, j, val)
813793
814794 idxm= matrix% row_numbering% gnn2unn(i,blocki)
815795 idxn= matrix% column_numbering% gnn2unn(j,blockj)
816- call fix_column_numbers(idxm, idxn)
817796
818797 call MatSetValues(matrix% M, size (i), idxm, size (j), idxn, &
819798 real (reshape (val, (/ size (val) / )), kind= PetscScalar_kind), &
@@ -837,7 +816,6 @@ subroutine petsc_csr_block_addto(matrix, i, j, val)
837816
838817 idxm= matrix% row_numbering% gnn2unn(i,:)
839818 idxn= matrix% column_numbering% gnn2unn(j,:)
840- call fix_column_numbers(idxm, idxn)
841819
842820 call MatSetValues(matrix% M, size (idxm), idxm, size (idxn), idxn, &
843821 real (reshape (val, (/ size (val) / )), kind= PetscScalar_kind), ADD_VALUES, ierr)
@@ -865,7 +843,6 @@ subroutine petsc_csr_blocks_addto(matrix, i, j, val)
865843 idxm= matrix% row_numbering% gnn2unn(i,blocki)
866844 do blockj= 1 , size (matrix% column_numbering% gnn2unn,2 )
867845 idxn= matrix% column_numbering% gnn2unn(j,blockj)
868- call fix_column_numbers(idxm, idxn)
869846 ! unfortunately we need a copy here to pass contiguous memory
870847 value= reshape (val(blocki, blockj, :, :), (/ size (value) / ))
871848 call MatSetValues(matrix% M, size (i), idxm, size (j), idxn, &
@@ -898,7 +875,6 @@ subroutine petsc_csr_blocks_addto_withmask(matrix, i, j, val, block_mask)
898875 do blockj= 1 , size (matrix% column_numbering% gnn2unn,2 )
899876 if (block_mask(blocki,blockj)) then
900877 idxn= matrix% column_numbering% gnn2unn(j,blockj)
901- call fix_column_numbers(idxm, idxn)
902878 ! unfortunately we need a copy here to pass contiguous memory
903879 value= reshape (val(blocki, blockj, :, :), (/ size (value) / ))
904880 call MatSetValues(matrix% M, size (i), idxm, size (j), idxn, &
0 commit comments