Using petsc in user code

Matthew Knepley knepley at gmail.com
Thu Apr 30 06:48:29 CDT 2009


No, you can only call them once for the entire program.

  Matt

On Thu, Apr 30, 2009 at 1:25 AM, #DOMINIC DENVER JOHN CHANDAR# <
DOMI0002 at ntu.edu.sg> wrote:

>  Hi,
>
>          I have a C++ code in which I plan to call PETSc for solving a
> system of equations. My doubt is regarding PETScInitialize() and
> PETScFinalize().
> For example, I have a class called classX
>
> classX
> {
>
> public:
> initialize();
> finalize();
> };
>
> classX::initialize()
> {
> PetscInitialize(...)
> ..
> ..
> more initializations..
> }
>
> classX::finalize()
> {
> PetscFinalize();
> ...
> ...
> }
>
> main()
> {
>    classX  ob1, ob2 ; // 2 objects
>
>     // Is the following acceptable ??
> ob1.initialize();
> ob2.initialize();
>
> }
>
> Do I need to call PetscInitialize() /PetscFinalize() for each object ?
>
> -Dominic
>



-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090430/de55bc94/attachment.htm>


More information about the petsc-users mailing list