Re: changes for next PETSc release
Matthew Knepley wrote:
On Mon, Mar 17, 2008 at 1:06 PM, Barry Smith <[email protected]> wrote:
Fortran90 has namespaces??????
Not in the way I was thinking. Damn F90. Anyway, it looks like you can selectively use interface modules, so we might be able to get away with redundant names by just not using them together.
I jsut really hate the idea of putting "PETSc" in front of every word in the package. It is really the ugliest thing I can imagine and will make programming that much more of a slog.
I'm not confident that what I'm about to suggest is actually a good idea, but perhaps there could be two interfaces: one for C and one for C++. The C interface could use something like "petsc_" as a prefix for all PETSc functions and structs (e.g., petsc_Mat and petsc_KSPSolve()), and the C++ interface could define everything in the petsc namespace (e.g., petsc::Mat and petsc::KSPSolve()). I think that it should be straightforward to make a script to automate the generation of the C++ interface from the C interface, e.g. using typedefs for the various structs and inline functions that simply call the appropriate C function. Folks who really want to avoid re-writing large amounts of code could switch to using a C++ compiler instead of a C compiler and use "using namespace petsc". Possibly the "using namespace" declaration could be done automatically in the PETSc headers when an appropraite variable is #define'd (e.g., whenever PETSC_COMPATIBILITY_MODE is #define'd). -- Boyce
participants (1)
-
Boyce Griffith