-
Notifications
You must be signed in to change notification settings - Fork 38
Description
I was playing with the branch bk/wrapping_tests.
I was trying to follow the examples. It seems as if the codes/functions have been updated since the examples were written.
But somehow, I could make things work. I tried laplacian.jl and then I was trying ex_50.jl.
But, when we call, PETSc.KSPSetComputeOperators!(ksp, jacobian!),
the higher level function calls a function in petsc_library.jl.
I kept on getting the same error , " Cannot convert a value to nothing for assignment".
When I looked deeper, this KSPSetComputeOperators behaves similarly to KSPSetComputeRHS and there is only one small difference in the structure of two functions.
PetscErrorCode,
(KSP, Ptr{KSPComputeRHSFn}, Ptr{Cvoid}),
arg1,
arg2,
arg3, in KSPComputeRHS but
@for_petsc function KSPSetComputeOperators(::$UnionPetscLib, arg1, arg2, arg3)
@chk ccall(
(:KSPSetComputeOperators, $petsc_library),
PetscErrorCode,
(KSP, KSPComputeOperatorsFn, Ptr{Cvoid}),
arg1,
arg2,
arg3,
)end. No Ptr in this.
Then, I defined my own function with Ptr, such that Julia higher level function will call this one, it worked fine.
I am just pointing it out since I am not 100 percent sure if I am doing this correct ( I have almost no experience with C) or was there another way to call the same function.
Thank you in advance.