Hello everyone, I would like to write a c++ class which solve a linear system with petsc (code as following). Petsc is used only in this class. So I call MPI_Init in main.cpp, but PetscInitialize and PetscFinalise are in constructor/destructor of class. I am wondering if this way is safe?
class solvepetsc{
solvepetsc(int argc, char** argv){
PetscInitialize(&argc, &argv, NULL, NULL);
};
~solvepetsc(){
PetscFinalize();
};
// ...
}
Thanks a lot and best regards,
Feng Xing
Postdoc INRIA France
