19. Initialize and Finalize

The first TAO routine in any application should be TaoInitialize(). Most TAO programs begin with a call to
   info = TaoInitialize(int *argc,char ***argv,char *file_name,  
                        char *help_message); 
This command initializes TAO, as well as MPI, PETSc, and other packages to which TAO applications may link (if these have not yet been initialized elsewhere). In particular, the arguments argc and argv are the command line arguments delivered in all C and C++ programs; these arguments initialize the options database. The argument file_name optionally indicates an alternative name for an options file, which by default is called .petscrc and resides in the user's home directory.

One of the last routines that all TAO programs should call is

   info = TaoFinalize(); 
This routine finalizes TAO and any other libraries that may have been initialized during the TaoInitialize() phase. For example, TaoFinalize() calls MPI_Finalize()if TaoInitialize() began MPI. If MPI was initiated externally from TAO (by either the user or another software package), then the user is responsible for calling MPI_Finalize().