[petsc-users] Check if allocated in Fortran
Satish Balay
balay at mcs.anl.gov
Mon Feb 26 12:11:41 CST 2018
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