PETSc 2.3.2/2.3.3 'forward' compatibility

Lisandro Dalcin dalcinl at gmail.com
Tue Aug 14 18:30:43 CDT 2007


Dear PETSc users,

Perhaps a small set of you know I'm actively developing PETSc for
Python (petsc4py). Currently, petsc4py can be built and used with
PETSc versions 2.3.2 / 2.3.3 / DEV. As you know, PETSc evolves fast
and introduces backward incompatible interface changes in each
release. I'm particularly happy with this, as the library is always
getting better and better.

However, I understand this is annoying for some users. In my
particular case, it's easier for me for my own code to be always
updated against petsc-dev repository. On the other side, I want
petsc4py to be usable with previous PETSc releases, at least the
latest official release.

Because of all this, I have some compatibility C headers that I think
could be usefull for any of you to be able to incrementally update
your code in a source file by file basis, being also updated (as your
time permits) against petsc-dev repo.

That is, you can include these headers in some C source file, update
it against petsc-dev interface, check that it compiles fine, and next
include my compatibility headers (using macros PETSC_VERSION_XXX will
make your like easier) to continue using your code in a production
scenario with the latest (or second to latest) official PETSc release.
The correct way to use those headers should be

#if (PETSC_VERSION_MAJOR    == 2 && \
     PETSC_VERSION_MINOR    == 3 && \
     PETSC_VERSION_SUBMINOR == 2 && \
     PETSC_VERSION_RELEASE  == 1)
#include "compat/232/petsc.h"
#include "compat/232/petscvec.h"
#include "compat/232/petscmat.h"
#include "compat/232/petscksp.h"
#include "compat/232/petscsnes.h"
#include "compat/232/petscts.h"
#endif

Until now, all this hackery was usable only for my petsc4py needs. But
today I factored-out all that code, in order to make it available to
any one interested in using or needing something like this.

The headers are available in petsc4py SVN at google code, just do

$ svn co svn co  http://petsc4py.googlecode.com/svn/trunk/petsc/lib/ext/compat

or user your browser to navigate the SVN repo
http://petsc4py.googlecode.com/svn/trunk/petsc/lib/ext/compat


Not all things are expected to work. However, by using this I can
build and use my Python wrappers with multiple PETSc versions.

In case any of you is interested and want to make
comments/suggestions/corrections/additions or even complaints, please
mail me directly.

Regards,


-- 
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