[petsc-users] using PETSC_NULL_INTEGER in preallocation routines

Satish Balay balay at mcs.anl.gov
Mon May 14 10:45:59 CDT 2018


Its best to avoid passing 'constant' values directly to petsc fortran routines.


For eg: src/ksp/ksp/examples/tests/ex16f.F90

      PetscInt izero
      izero = 0

etc..

Satish


On Mon, 14 May 2018, Smith, Barry F. wrote:

> Chris,
> 
>    These arguments should never have been PETSC_NULL_INTEGER since they are integers (and not pointers or arrays), you should pass 0 for them.
> 
>   Barry
> 
> 
> > On May 14, 2018, at 4:45 AM, Klaij, Christiaan <C.Klaij at marin.nl> wrote:
> > 
> > With petsc-3.7.5, I had F90 code like this:
> > 
> >  CALL MatSeqAIJSetPreallocation(aa_symmetric,PETSC_NULL_INTEGER,d_nnz,ierr); CHKERRQ(ierr)
> >  CALL MatMPIAIJSetPreallocation(aa_symmetric,PETSC_NULL_INTEGER,d_nnz,PETSC_NULL_INTEGER,o_nnz,ierr); CHKERRQ(ierr)
> > 
> > which worked fine. Now, with petsc-3.8.4, the same code gives this compilation error:
> > 
> >  error #6634: The shape matching rules of actual arguments and dummy arguments have been violated.   [PETSC_NULL_INTEGER]
> >  CALL MatSeqAIJSetPreallocation(aa_symmetric,PETSC_NULL_INTEGER,d_nnz,ierr); if (ierr .ne. 0) then ; call PetscErrorF(ierr); return; endif
> > ----------------------------------------------^
> >  error #6634: The shape matching rules of actual arguments and dummy arguments have been violated.   [PETSC_NULL_INTEGER]
> >  CALL MatMPIAIJSetPreallocation(aa_symmetric,PETSC_NULL_INTEGER,d_nnz,PETSC_NULL_INTEGER,o_nnz,ierr); if (ierr .ne. 0) then ; call PetscErrorF(ierr); return; endif
> > ----------------------------------------------^
> > 
> > What's the intended usage now, simply 0 instead of PETSC_NULL_INTEGER?
> > 
> > Chris
> > 
> > 
> > dr. ir. Christiaan Klaij  | Senior Researcher | Research & Development
> > MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl
> > 
> > MARIN news: http://www.marin.nl/web/News/News-items/120-papers-presented-at-NAV2018.htm
> > 
> 
> 



More information about the petsc-users mailing list