adding macro in petscversion.h
Lisandro Dalcin
dalcinl at gmail.com
Mon Dec 1 07:37:20 CST 2008
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
More information about the petsc-dev
mailing list