[petsc-dev] (no subject)

Barry Smith bsmith at mcs.anl.gov
Sat Feb 16 17:02:05 CST 2013


On Feb 16, 2013, at 8:48 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> 
> On Sat, Feb 16, 2013 at 5:53 AM, Matthew Knepley <knepley at gmail.com> wrote:
> > Splitting petscconf.h by package or something would be cool because when reconfigure runs, any changes to petscconf.h usually don't affect anything, but I think trying to do that would be a maintenance disaster.
> 
>    Might not be too bad actually. If the Package class itself just handled it as a matter of course, declaring Info with a package (and when called from within a package) would automatically to into its own list and then its own file.
> 
> The file that it outputs into is set by the object, so all you need to do is reset the header filename in the
> constructor for Package.
> 
> The reason I thought it was hazardous was if, say, someone classified PETSC_HAVE_HYPRE as being relevant to KSP/PC, then anyone testing for it from code in petscmat would come up false for no apparent reason.

    No one would "classify" PETSC_HAVE_HYPRE as being relevant to any particular thing. Rather if you are writing code anywhere in PETSc (Mat, PC, whatever) and wished to use hypre you would have 

#include <petsc-private/petscconfhypre.h> 

#if defined(PETSC_HAVE_HYPE)
just like now

Of course this requires always creating includes for all packages but maybe no biggie?

   Barry


> To figure out why it's false, we would have to look through the petscconfxxx.h files, which is just more confusing.
> 
> An alternative is to #define PETSC_HAVE_X 0 instead of leaving it undefined, so that we can get a compilation error when we haven't included the right conf header. This would convert a lot of #if defined(X) ... #endif code to non-cpp if (X) { ... }.
> 
> Note that we could #define PETSC_HAVE_X_UNDEFINED 1 and write a PETSC_HAVE_(X) macro that errors if neither PETSC_HAVE_X or PETSC_HAVE_X_UNDEFINED is available, thus tests based on defined state would still be valid, but we could alert the user when they need to reconfigure.
> 
> I just don't know if any of this is worth it.




More information about the petsc-dev mailing list