[petsc-users] Fortran interface of MatNullSpaceCreate
Smith, Barry F.
bsmith at mcs.anl.gov
Mon Feb 26 16:53:19 CST 2018
> On Feb 26, 2018, at 4:47 PM, frank <hengjiew at uci.edu> wrote:
>
> Hello,
>
> It works after changing PETSC_NULL_INTEGER to 0. Thank you so much.
>
> Does this mean the 3rd argument is a Fortran integer rather than PestcInt?
No it is actually a PetscInt so technically you should declare
PetscInt zero
zero = 0
and pass in zero.
The reason PETSC_NULL_INTEGER doesn't work is 1) it should not be used as a synonym for 0; it is a "pointer" to null not zero 2) PETSC_NULL_INTEGER is actually declared as an array of size 1 (this is why you get the confusing message about no specific subroutine that matches). PETSC_NULL_INTEGER can only be passed where PETSc expects and integer array, not an integer scalar.
Barry
>
> Regards,
>
> Frank
>
> On 02/26/2018 02:35 PM, Smith, Barry F. wrote:
>> It should be
>>
>>> call MatNullSpaceCreate( PETSC_COMM_WORLD, PETSC_TRUE, 0, dummyVecs, nullspace, ierr)
>> If this doesn't work please send your test code that I can compile myself and figure out what is going on.
>>
>> Barry
>>
>>
>>
>>
>>> On Feb 26, 2018, at 4:18 PM, frank <hengjiew at uci.edu> wrote:
>>>
>>> Hello,
>>>
>>> I have a question of the Fortran interface of subroutine MatNullSpaceCreate.
>>>
>>> I tried to call the subroutine in the following form:
>>>
>>> Vec :: dummyVec, dummyVecs(1)
>>> MatNullSpace :: nullspace
>>> INTEGER :: ierr
>>>
>>> (a) call MatNullSpaceCreate( PETSC_COMM_WORLD, PETSC_TRUE, PETSC_NULL_INTEGER, dummyVec, nullspace, ierr)
>>>
>>> (b) call MatNullSpaceCreate( PETSC_COMM_WORLD, PETSC_TRUE, PETSC_NULL_INTEGER, dummyVecs, nullspace, ierr)
>>>
>>> (a) and (b) gave me the same error during compilation: no specific subroutine for the generic MatNullSpaceCreate.
>>>
>>> I am using the latest version of Petsc. I just did a "git pull" and re-build it.
>>> How can I call the subroutine ?
>>>
>>> In addition, I found two 'petscmat.h90' : petsc/include/petsc/finclude/ftn-auto/petscmat.h90 and petsc/src/mat/f90-mod/petscmat.h90.
>>> The former defines a subroutine MatNullSpaceCreate in the above form (b). The latter provides generic interface for both (a) and (b).
>>> I am not sure if this relates to the error I get.
>>>
>>> Thank you.
>>>
>>> Frank
>
More information about the petsc-users
mailing list