[petsc-users] recommended error-checking for PetscInitialize() and PetscFinalize()

Ed Bueler elbueler at alaska.edu
Fri Sep 11 14:55:43 CDT 2020


Dear PETSc --

I notice in the users manual that the C examples show

ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr;

at the start of main() and

ierr = PetscFinalize();
return ierr;

at the end of main().  Is this the deliberate, recommended style?  My
understanding of these choices is that if PetscInitialize() fails then
CHKERRQ(ierr) may not do the right thing, while if PetscFinalize() fails
then that should be the result of main() (without any fiddling by CHKERRQ
etc.).  Is this the correct understanding?

Thanks,

Ed

-- 
Ed Bueler
Dept of Mathematics and Statistics
University of Alaska Fairbanks
Fairbanks, AK 99775-6660
306C Chapman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200911/a4d3dfbc/attachment.html>


More information about the petsc-users mailing list