code design

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


So follow up my puzzles for code design, do I have the same problem if
I want to use SUNDIALS control script, and link it to Petsc library?

I am trying to building up my own C++ library, handle it over to PVODE
control script, and solve the underlying system using Petsc.

Jianing

> > 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....
>
> OO is really orthogonal to the introduction of new types.
>
> > 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.
>
> Yes, this is the correct way to handle .it.
>
>   Matt
>
> > Just wondering what is a good solution for an efficient and neat design?
> >
> > Thanks,
> >
> > Jianing




More information about the petsc-users mailing list