[petsc-users] Check if allocated in Fortran
Sanjay Govindjee
s_g at berkeley.edu
Mon Feb 26 14:42:28 CST 2018
Thanks. That did the trick.
On 2/26/18 7:11 PM, Satish Balay wrote:
> Perhaps the following code?
>
> Vec x
>
> x = PETSC_NULL_VEC
> if (x .eq. PETSC_NULL_VEC) then
> print*,'vec is null'
> endif
>
> Satish
>
> On Mon, 26 Feb 2018, Sanjay Govindjee wrote:
>
>> I am trying to update some code that works in version 3.7.6 to version 3.8.3.
>>
>> What is the recommended way to check if a petsc type, such as Vec, has already
>> been created?
>>
>> Current code looks like:
>>
>> Vec xvec
>>
>> if(xvec.eq.0) then ! Check if xvec needs to be created
>> call VecCreate(PETSC_COMM_WORLD, xvec, ierr)
>> endif
>>
>> In PETSc 3.8.3 I am now getting a compiler error
>>
>> parkv.F(60): error #6355: This binary operation is invalid for this data
>> type. [XVEC]
>> if(xvec.eq.0) then
>> ---------^
>>
>>
More information about the petsc-users
mailing list