Skip to content

Commit 813c5a1

Browse files
authored
Merge pull request #2 from fverdugo/additional_api_methods
Additional api methods
2 parents ae0f782 + b6b1320 commit 813c5a1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/api.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,13 +508,18 @@ Mat() = Mat(Ptr{Cvoid}())
508508
Base.convert(::Type{Mat},p::Ptr{Cvoid}) = Mat(p)
509509
Base.unsafe_convert(::Type{Ptr{Cvoid}},v::Mat) = v.ptr
510510

511+
@wrapper(:MatCreate,PetscErrorCode,(MPI.Comm,Ptr{Mat}),(comm,mat),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreate.html")
511512
@wrapper(:MatCreateAIJ,PetscErrorCode,(MPI.Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,Ptr{PetscInt},PetscInt,Ptr{PetscInt},Ptr{Mat}),(comm,m,n,M,N,d_nz,d_nnz,o_nz,o_nnz,mat),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateAIJ.html")
512513
@wrapper(:MatCreateSeqAIJ,PetscErrorCode,(MPI.Comm,PetscInt,PetscInt,PetscInt,Ptr{PetscInt},Ptr{Mat}),(comm,m,n,nz,nnz,mat),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateSeqAIJ.html")
513514
@wrapper(:MatCreateSeqAIJWithArrays,PetscErrorCode,(MPI.Comm,PetscInt,PetscInt,Ptr{PetscInt},Ptr{PetscInt},Ptr{PetscScalar},Ptr{Mat}),(comm,m,n,i,j,a,mat),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateSeqAIJWithArrays.html")
514515
@wrapper(:MatCreateMPIAIJWithArrays,PetscErrorCode,(MPI.Comm,PetscInt,PetscInt,PetscInt,PetscInt,Ptr{PetscInt},Ptr{PetscInt},Ptr{PetscScalar},Ptr{Mat}),(comm,m,n,M,N,i,j,a,mat),"https://petsc.org/release/docs/manualpages/Mat/MatCreateMPIAIJWithArrays.html")
515516
@wrapper(:MatCreateMPIAIJWithSplitArrays,PetscErrorCode,(MPI.Comm,PetscInt,PetscInt,PetscInt,PetscInt,Ptr{PetscInt},Ptr{PetscInt},Ptr{PetscScalar},Ptr{PetscInt},Ptr{PetscInt},Ptr{PetscScalar},Ptr{Mat}),(comm,m,n,M,N,i,j,a,oi,oj,oa,mat),"https://petsc.org/release/docs/manualpages/Mat/MatCreateMPIAIJWithSplitArrays.html")
516517
@wrapper(:MatDestroy,PetscErrorCode,(Ptr{Mat},),(A,),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatDestroy.html")
517518
@wrapper(:MatView,PetscErrorCode,(Mat,PetscViewer),(mat,viewer),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatView.html")
519+
@wrapper(:MatSetType,PetscErrorCode,(Mat,MatType),(mat,matype),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetType.html")
520+
@wrapper(:MatSetSizes,PetscErrorCode,(Mat,PetscInt,PetscInt,PetscInt,PetscInt),(A,m,n,M,N),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetSizes.html")
521+
@wrapper(:MatSetPreallocationCOO,PetscErrorCode,(Mat,PetscInt,Ptr{PetscInt},Ptr{PetscInt}),(A,ncoo,coo_i,coo_j),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetPreallocationCOO.html")
522+
@wrapper(:MatSetValuesCOO,PetscErrorCode,(Mat,Ptr{PetscScalar},InsertMode),(A,coo_v,imode),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValuesCOO.html")
518523
@wrapper(:MatSetValues,PetscErrorCode,(Mat,PetscInt,Ptr{PetscInt},PetscInt,Ptr{PetscInt},Ptr{PetscScalar},InsertMode),(mat,m,idxm,n,idxn,v,addv),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValues.html")
519524
@wrapper(:MatGetValues,PetscErrorCode,(Mat,PetscInt,Ptr{PetscInt},PetscInt,Ptr{PetscInt},Ptr{PetscScalar}),(mat,m,idxm,n,idxn,v),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetValues.html")
520525
@wrapper(:MatAssemblyBegin,PetscErrorCode,(Mat,MatAssemblyType),(mat,typ),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatAssemblyBegin.html")
@@ -531,6 +536,7 @@ Base.unsafe_convert(::Type{Ptr{Cvoid}},v::Mat) = v.ptr
531536
@wrapper(:MatSetBlockSize,PetscErrorCode,(Mat,PetscInt),(mat,bs),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetBlockSize.html")
532537
@wrapper(:MatMumpsSetIcntl,PetscErrorCode,(Mat,PetscInt,PetscInt),(mat,icntl,val),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMumpsSetIcntl.html")
533538
@wrapper(:MatMumpsSetCntl,PetscErrorCode,(Mat,PetscInt,PetscReal),(mat,icntl,val),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMumpsSetCntl.html")
539+
@wrapper(:MatMPIAIJSetPreallocation,PetscErrorCode,(Mat,PetscInt,Ptr{PetscInt},PetscInt,Ptr{PetscInt}),(B,d_nz,d_nnz,o_nz,o_nnz),"https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMPIAIJSetPreallocation.html")
534540

535541
# Null space related
536542

src/ksp.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ end
173173

174174
function ksp_finalize!(setup::KspSeqSetup)
175175
if ! setup.user_handles
176-
ksp_destroy_handles!(setup.handles)
176+
ownership = setup.ownership
177+
handles = setup.handles
178+
GC.@preserve ownership ksp_destroy_handles!(handles)
177179
end
178180
nothing
179181
end

0 commit comments

Comments
 (0)