It it is not too late, I would like to add the following macro in petscversion.h
#if !defined(PETSC_VERSION_)
#define PETSC_VERSION_(MAJOR,MINOR,SUBMINOR) \
(PETSC_VERSION_MAJOR == MAJOR && \
PETSC_VERSION_MINOR == MINOR && \
PETSC_VERSION_SUBMINOR == SUBMINOR && \
PETSC_VERSION_RELEASE == 1)
#endif
In petsc4py, I have to test the version in many places in order to
provide backward compatibility with previous releases. The new macro
is really handy for this,
#if PETSC_VERSION_(2,3,2)
/* code for the 2.3.2 case */
#elif PETSC_VERSION_(2,3,3)
/* code for the 2.3.2 case */
#elif PETSC_VERSION_(2,4,0)
/* code for latest release (once done)*/
#else
/* code for (future) petsc-dev
#endif
What do you think? Should I remove the last "_" in "PETSC_VERSION_".
Better name?
Of course, it I want to use this for 2.3.2/2.3.3 releases, I would
need to manage that in my code, but from 2.4.0 and above, that would
be already defined for user convenience needing to target the same
code for multiple PETSc releases.
--
Lisandro Dalc?n
---------------
Centro Internacional de M?todos Computacionales en Ingenier?a (CIMEC)
Instituto de Desarrollo Tecnol?gico para la Industria Qu?mica (INTEC)
Consejo Nacional de Investigaciones Cient?ficas y T?cnicas (CONICET)
PTLC - G?emes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594