[petsc-users] from Petsc 3.7.4.0 to 3.13.3.0
Barry Smith
bsmith at petsc.dev
Mon Aug 2 20:45:54 CDT 2021
It is find to use such conditional checks if needed.
> On Aug 2, 2021, at 4:06 PM, Anthony Paul Haas <aph at email.arizona.edu> wrote:
>
> Hello,
>
> I recently updated our code from Petsc 3.7.4.0 to 3.13.3.0. Among other things I noticed is that all the includes (such as #include <petsc/finclude/petscvec.h>) have now to be accompanied with use statements (such as use petscvec).
>
> It seems that due to the use statements the compiler is now way more strict. In our code, we can solve stability equations in real arithmetic or in complex arithmetic, where some subroutines are used for complex arithmetic and some other ones for real arithmetic.
>
> My question is, is it good practice to wrap around a Petsc call with the pre-compiler flag PETSC_USE_COMPLEX in order to avoid compilation error if that call is not used say in the complex part of the code?
>
> Example, the call to MatSetValuesBlocked below is not used in the complex arithmetic code, so to avoid a compilation error, I wrapped the call with PETSC_USE_COMPLEX==0 (Mat1 is a real array in this example)
>
> #if (PETSC_USE_COMPLEX==0)
> call MatSetValuesBlocked(self%fieldLHSMat_ps,1,ptLoc-1,1,colIndex-1,transpose(Mat1(1:ndim1,1:ndim2)),INSERT_VALUES,ierr)
> #endif
>
> Thanks,
>
> Anthony
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210802/16d8743c/attachment-0001.html>
More information about the petsc-users
mailing list