Re: [petsc-users] MatNest error with null matrix blocks

2025-07-06 Thread Randall Mackie
Thanks Barry - this is a very helpful clarification. Randy > On Jul 6, 2025, at 9:59 AM, Barry Smith wrote: > > >Yes, they are automatically initialized to something ((void*)-2 actually). > They are NOT automatically initialized to PETSC_NULL_XXX > >#define PetscObjectIsNull(obj) (

Re: [petsc-users] MatNest error with null matrix blocks

2025-07-06 Thread Barry Smith
Yes, they are automatically initialized to something ((void*)-2 actually). They are NOT automatically initialized to PETSC_NULL_XXX #define PetscObjectIsNull(obj) (obj%v == 0 .or. obj%v == -2 .or. obj%v == -3) PETSc Fortran has multiple representations of NULL objects. When you want t

Re: [petsc-users] MatNest error with null matrix blocks

2025-07-04 Thread Randall Mackie
Thanks Barry We were confused because the online manual says: PETSc objects are always automatically initialized when declared so you do not need to (and should not) do type(tXXX) x = PETSC_NULL_XXX XXX x = PETSC_NULL_XXX Randy > On Jul 4, 2025, at 6:56 PM, Barry Smith wrote: > > >You

Re: [petsc-users] MatNest error with null matrix blocks

2025-07-04 Thread Barry Smith
You need to pass PETSC_NULL_MAT in those locations, you cannot just pass a Mat that has never been created (that is a different kind of NULL matrix :-). I have added clearer error checking in https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/merge_requests/8526__;!!G_uCfscf7eWS!c7m