[petsc-users] Checking for NULL Objects in Fortran

Fabian.Jakub Fabian.Jakub at physik.uni-muenchen.de
Mon Sep 10 16:02:31 CDT 2018


Greetings my dear PETSc list.

In my Fortran Code, I usually checked against PETSC_NULL_DM or
PETSC_NULL_IS after calling methods such as DMPlexDistribute or
DMGetStratumIS.

Recently this fails me.

I saw the DMPlexDistribute example in
dm/label/examples/tutorials/ex1f90.F90

where the value of dm_distributed%v is compared against -1

Now, after the recent change of PETSC_NULL_DM (tDM(1) -> tDM(0) in
3d1df95b1) I am not 100% percent sure how to deal with it.

Could you please clarify if testing against ``-1`` is the intended way
to do it or may this change again soonish?

Many Thanks,

Fabian


Here some code snippets to clarify what lead me to put up this question...

This used to validate:

call DMGetStratumIS(dm, 'DomainBoundary', SIDEFACE, bc_idx, ierr)
if (bc_ids.eq.PETSC_NULL_IS) then ! dont have domain boundary points
...
endif

or

call DMPlexDistribute(dm, i0, PETSC_NULL_SF, dmdist, ierr)
if (dmdist.eq.PETSC_NULL_DM) then ! DM was not distributed
endif


Now I could do something like:

if(bc_ids%v.eq.-1)

of (dmdist%v.eq.-1)

...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180910/b704be1b/attachment.sig>


More information about the petsc-users mailing list