26 #ifdef FLOW123D_HAVE_PETSC 29 #include <petsc/private/petscimpl.h> 33 #include <boost/exception/detail/error_info_impl.hpp> 37 #include "petscerror.h" 50 if (signal == SIGINT) {
53 if (signal == SIGFPE ||
59 THROW( ExcSignal() << EI_Signal(signal) << EI_SignalName(strsignal(signal)) );
61 return PetscSignalHandlerDefault(signal,(
void*)0);
73 signal_handler_off_(false)
96 stringstream log_name;
98 if ( log_filename ==
"//" ) {
119 #ifdef FLOW123D_HAVE_PETSC 120 PetscErrorCode ApplicationBase::petscvfprintf(FILE *fd,
const char format[], va_list Argp) {
124 if (fd != stdout && fd != stderr) {
125 ierr = PetscVFPrintfDefault(fd,
format,Argp); CHKERRQ(ierr);
127 const int buf_size = 65000;
130 ierr = PetscVSNPrintf(buff,buf_size,
format,&length,Argp);CHKERRQ(ierr);
135 PetscFunctionReturn(0);
141 #ifdef FLOW123D_HAVE_PETSC 146 PetscVFPrintf = this->petscvfprintf;
150 PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL);
159 MessageOut() <<
"MPI size: " << mpi_size << std::endl;
166 #ifdef FLOW123D_HAVE_PETSC 169 PetscErrorCode ierr=0;
171 ierr = PetscFinalize(); CHKERRQ(ierr);
void system_init(MPI_Comm comm, const string &log_filename)
virtual void parse_cmd_line(const int argc, char **argv)=0
void system_signal_handler(int signal)
virtual ~ApplicationBase()
Destructor.
#define MessageOut()
Macro defining 'message' record of log.
static bool petsc_initialized
std::string format(CStringRef format_str, ArgList args)
static FILE * petsc_output_
File handler for redirecting PETSc output.
PetscErrorCode petsc_signal_handler(int signal, FMT_UNUSED void *context)
string petsc_redirect_file_
int setup_mpi(MPI_Comm comm)
Set rank of actual process by MPI communicator.
Global macros to enhance readability and debugging, general constants.
bool signal_handler_off_
Turn off signal handling useful to debug with valgrind.
void init(int argc, char **argv)
void set_log_file(std::string log_file_base)
Initialize instance object in format 'log_file_base.process.log'.
static LoggerOptions & get_instance()
Getter of singleton instance object.
static Profiler * instance()
void petsc_initialize(int argc, char **argv)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.