<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>Hi,</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2> 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().</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial size=2>For example, I have
a class called classX</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>classX</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>{</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>public:</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>initialize();</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>finalize();</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009></SPAN><SPAN class=309391306-30042009><FONT
face=Arial size=2>};</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>classX::initialize()</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>{</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>PetscInitialize(...)</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>..</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>..</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial size=2>more
initializations..</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>classX::finalize()</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>{</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>PetscFinalize();</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>...</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial size=2>...
</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>main()</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>{</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial size=2>
classX ob1, ob2 ; // 2 objects</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial size=2>
// Is the following acceptable ??</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>ob1.initialize();</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>ob2.initialize();</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial size=2>Do I need to call
PetscInitialize() /PetscFinalize() for each object ? </FONT></SPAN></DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=309391306-30042009><FONT face=Arial
size=2>-Dominic</FONT></SPAN></DIV></BODY></HTML>