#define BSMAINLOG
#include "BSprivate.h"
int BSinit_called = 0;
int BSbegan_MPI = 0;
/*@ BSinit - Initializes BlockSolve and MPI. BSinit() calls
MPI_Init() if it has not already been called.
Input Parameters:
. argc - count of number of command line arguments
. args - the command line arguments
Notes:
If you want to call MPI_Init() separately, call it before
BSinit().
.keywords: initialize, startup
.seealso: BSfinalize()
@*/
int BSinit(int *argc,char ***args)
{
int ierr, flag;
/* check to see if BSinit has already been called */
if (BSinit_called) return 0;
/* Init MPI if not already done */
MPI_Initialized(&flag);
if (!flag) {
ierr = MPI_Init(argc,args); CHKERRN(ierr);
BSbegan_MPI = 1;
}
/* Start up logging if MLOG is defined */
MLOG_INIT();
BSinit_called = 1;
return(0);
}
/*@ BSfinalize - Finalizes BlockSolve and MPI.
Prints the log stuff if MLOG was defined.
.keywords: finalize
.seealso: BSinit()
@*/
int BSfinalize()
{
/* do memory check if HAVE_PETSC defined */
CHECK_MEMORY();
/* finalize MPI */
if(BSbegan_MPI) {
MPI_Finalize();
}
return(0);
}
/*@ BSprint_log - Print log stuff if MLOG is defined.
Input Parameters:
. procinfo - The usual procinfo
Note: BSprint_log() will not print out anything
unless BSctx_set_print_log has been set to TRUE.
.seealso: BSctx_set_print_log()
@*/
int BSprint_log(BSprocinfo *procinfo)
{
/* print out the log info and return */
if(procinfo->print_log) {
MLOG_PRINT(procinfo);
}
return(0);
}
syntax highlighted by Code2HTML, v. 0.9.1