> On May 14, 2018, at 10:45 AM, Sanjay Govindjee <[email protected]> wrote:
> 
> Barry,
>   Is it then incorrect (and potentially dangerous) to use 
> PETSC_NULL_INTEGER(1) for these arguments, even if that
> currently works?

   I thought you got warnings or errors because you are passing an array 
instead of a value?

   Anyways since Fortran is pass by reference passing either a PetscInt   II or 
 PetscInt II(1) does the same things but modern Fortran compilers require you 
to pass a scalar when expected (II) and an array when expected (II(1)) 
otherwise the compiler warns or errors. Better to pass what is expected, in 
this case a 0.

    Barry

> -sanjay
> 
> On 5/14/18 5:40 PM, 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 <[email protected]> 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:[email protected] | http://www.marin.nl
>>> 
>>> MARIN news: 
>>> http://www.marin.nl/web/News/News-items/120-papers-presented-at-NAV2018.htm
>>> 
> 

Reply via email to