code design

Matthew Knepley knepley at gmail.com
Fri Feb 16 12:45:34 CST 2007


I don't really understand the question, I guess.

   Matt

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 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
>
>


-- 
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