Using petsc in user code
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
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# < [email protected]> 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
participants (2)
-
#DOMINIC DENVER JOHN CHANDAR# -
Matthew Knepley