[petsc-users] Cannot convert error

Jed Brown jedbrown at mcs.anl.gov
Wed Sep 19 06:49:36 CDT 2012


On Wed, Sep 19, 2012 at 6:25 AM, Eduardo <erocha.ssa at gmail.com> wrote:

> Is there a macro I can get the Petsc release? I'd like to link my code
> with libraries that are using a old version of Petsc. However, in the
> future these libraries may change to a newer version. So I want to
> write my code with ifdefs so that I can change from one version to the
> other easily.
>

See include/petscversion.h

Starting in petsc-3.3, there are convenience macros PETSC_VERSION_LT() and
PETSC_VERSION_LE(). You can add to your headers:

#if !defined(PETSC_VERSION_LT)
#  define PETSC_VERSION_LT (... copy from petscversion.h)
#endif

then in your source,

#if PETSC_VERSION_LE(3,3,0) /* last version doing it the old way */
  the old way
#else
  the new way
#endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120919/63707b29/attachment-0001.html>


More information about the petsc-users mailing list