code design

Hong Zhang hzhang at mcs.anl.gov
Fri Feb 16 13:30:20 CST 2007


Jianing,
>
> On 2/15/07, Jianing Shi <jianings at gmail.com> wrote:
> > 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 don't know what is SUNDIALS control script. We do support
CVODE through petsc-sundials interface.
> >
> > I am trying to building up my own C++ library, handle it over to PVODE
> > control script, and solve the underlying system using Petsc.

We have intention to use CVODE's multi-time-step control, and use Petsc
solving linear and non-linear systems at each time step.
Is this what you need?
Current interface uses SUNDAILS solvers.

The interface is implemented in
~petsc/src/ts/impls/implicit/sundials/sundials.c

Hong

> >
> > 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
> >
> >
>
>
> --
> One trouble is that despite this system, anyone who reads journals widely
> and critically is forced to realize that there are scarcely any bars to eventual
> publication. There seems to be no study too fragmented, no hypothesis too
> trivial, no literature citation too biased or too egotistical, no design too
> warped, no methodology too bungled, no presentation of results too
> inaccurate, too obscure, and too contradictory, no analysis too self-serving,
> no argument too circular, no conclusions too trifling or too unjustified, and
> no grammar and syntax too offensive for a paper to end up in print. --
> Drummond Rennie
>
>




More information about the petsc-users mailing list