diff --git a/Project.toml b/Project.toml index 6df6848..6c11929 100644 --- a/Project.toml +++ b/Project.toml @@ -14,11 +14,11 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" SparseMatricesCSR = "a0a7dd2c-ebf4-11e9-1f05-cf50bc540ca1" [compat] -Gridap = "0.16" +Gridap = "0.17" MPI = "0.14, 0.15, 0.16" PETSc_jll = "3.13" +PartitionedArrays = "0.2.4" SparseMatricesCSR = "0.6.1" -PartitionedArrays = "0.2.1" julia = "1.3" [extras] diff --git a/src/PETScAssembly.jl b/src/PETScAssembly.jl index 2d950b4..6799d94 100644 --- a/src/PETScAssembly.jl +++ b/src/PETScAssembly.jl @@ -2,17 +2,12 @@ # Some methods from the Gridap.Algebra interface # not sure if all are needed.... -function Algebra.fill_entries!(a::PETScMatrix,v) - @notimplementedif v!=0 +function LinearAlgebra.fillstored!(a::PETScMatrix,v) + @notimplementedif v!=zero(typeof(v)) @check_error_code PETSC.MatZeroEntries(a.mat[]) a end -function Algebra.fill_entries!(a::PETScVector,v) - fill!(a,v) - a -end - function Algebra.copy_entries!(a::PETScVector,b::PETScVector) if a!==b @check_error_code PETSC.VecCopy(b.vec[],a.vec[]) @@ -27,12 +22,12 @@ function Algebra.copy_entries!(a::PETScMatrix,b::PETScMatrix) a end -function Algebra.scale_entries!(a::PETScVector,b) +function LinearAlgebra.rmul!(a::PETScVector,b::Number) @check_error_code PETSC.VecScale(a.vec[],PetscScalar(b)) a end -function Algebra.scale_entries!(a::PETScMatrix,b) +function LinearAlgebra.rmul!(a::PETScMatrix,b::Number) @check_error_code PETSC.MatScale(a.mat[],PetscScalar(b)) a end @@ -301,4 +296,3 @@ function Algebra.create_from_nz(a::PETScMatrix) @check_error_code PETSC.MatAssemblyEnd(a.mat[],PETSC.MAT_FINAL_ASSEMBLY) a end - diff --git a/test/PETScAssemblyTests.jl b/test/PETScAssemblyTests.jl index 980bb49..9285df0 100644 --- a/test/PETScAssemblyTests.jl +++ b/test/PETScAssemblyTests.jl @@ -7,6 +7,7 @@ using Gridap.Arrays using GridapPETSc using GridapPETSc: PetscScalar, PetscInt using SparseArrays +using LinearAlgebra options = "-info" @@ -74,10 +75,10 @@ GridapPETSc.with(args=split(options)) do display(d) e = copy(d) - scale_entries!(d,PetscScalar(2)) + rmul!(d,PetscScalar(2)) @test d == 2*e @test nnz(d) == nnz(e) - fill_entries!(d,zero(PetscScalar)) + LinearAlgebra.fillstored!(d,zero(PetscScalar)) @test d == zeros(PetscScalar,size(d)) Tv = PETScVector @@ -106,9 +107,9 @@ GridapPETSc.with(args=split(options)) do display(d) e = copy(d) - scale_entries!(d,PetscScalar(2)) + rmul!(d,PetscScalar(2)) @test d == 2*e - fill_entries!(d,zero(PetscScalar)) + fill!(d,zero(PetscScalar)) @test d == zeros(PetscScalar,length(d)) end