code design

Jianing Shi jianings at gmail.com
Thu Feb 15 13:18:27 CST 2007


Hi Petsc masters,

I have a question which is more about code design using Petsc.

Suppose I need to implement a C++ library to provide an interface for
users to set up the ODE and/or PDE systems, which I will solve on
parallel computers using Petsc.  Since Petsc has defined its own data
type (in fact, a lot), PetscInt, PetscScalar, etc.  I would like to
link my own C++ library to the Petsc library.  I imagine there are two
solutions:

1) write an interface between my library and Petsc, i.e., between my
own data structure (object-oriented) with the DA structure of Petsc.
This requires translation between all the data type, for instance, int
and PetscInt....

2) use templated programming in my own library, so that when I link to
the Petsc library, I can easily reuse my own code to set up the Right
hand side, Jacobian and so on.

Just wondering what is a good solution for an efficient and neat design?

Thanks,

Jianing




More information about the petsc-users mailing list