PetscInitialize() and PetscFinalize() are reentrant. These means that one
can call them several times in the same program (one must call MPI_Int() and
MPI_Finalize() explicitly outside of these calls.
This means that PetscFinalize() should leave the data in the code in an
equivalent state as before the first PetscInitialize() is called.
I just spent a couple hours banging my head against the wall due to two
static variables in a function placed there on the assumption that PETSc was
not reentrant.
Please use static inside PETSc functions very carefully (if ever) and make
sure they don't destroy the reentrancy.
Thanks
Barry