Code review comment for lp:~g-gorman/fluidity/fluidity-petsc-3.3

Revision history for this message
Lawrence Mitchell (wence) wrote :

femtools/tests/test_multigrid.F90 needs a fix too:

#include "petscversion.h" needs to happen before the use statements too

In general, I don't like all this sprinkling of petsc version knowledge everywhere in the source tree. Can we do something like this:

file_that_needs_petsc.F90:

module foo

  use bar
#include "petsc_modules_maybe.h"
  implicit none
#include "petsc_headers_maybe.h"

  ...
  Write code that is petsc version-agnostic
end module foo

petsc_modules_maybe.h is something like

#ifdef HAVE_PETSC
#ifdef HAVE_PETSC_MODULES
   use petsc
#include "petscversion.h"
#if PETSC_VERSION_MINOR == 0
  use ...
#endif
#endif
#endif

and so forth.

Can we then get away without sprinkling all the code with VecSqrt/VecSqrtAbs etc...?

« Back to merge proposal