26 #ifdef FLOW123D_HAVE_PETSC 32 #include <boost/exception/detail/error_info_impl.hpp> 36 #include "petscerror.h" 48 if (signal == SIGINT) {
51 if (signal == SIGFPE ||
57 THROW( ExcSignal() << EI_Signal(signal) << EI_SignalName(strsignal(signal)) );
59 return PetscSignalHandlerDefault(signal,(
void*)0);
71 signal_handler_off_(false)
94 stringstream log_name;
96 if ( log_filename ==
"//" ) {
117 #ifdef FLOW123D_HAVE_PETSC 118 PetscErrorCode ApplicationBase::petscvfprintf(FILE *fd,
const char format[], va_list Argp) {
122 if (fd != stdout && fd != stderr) {
123 ierr = PetscVFPrintfDefault(fd,
format,Argp); CHKERRQ(ierr);
125 const int buf_size = 65000;
128 ierr = PetscVSNPrintf(buff,buf_size,
format,&length,Argp);CHKERRQ(ierr);
133 PetscFunctionReturn(0);
139 #ifdef FLOW123D_HAVE_PETSC 144 PetscVFPrintf = this->petscvfprintf;
148 PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL);
157 MessageOut() <<
"MPI size: " << mpi_size << std::endl;
164 #ifdef FLOW123D_HAVE_PETSC 167 PetscErrorCode ierr=0;
169 ierr = PetscFinalize(); CHKERRQ(ierr);
void system_init(MPI_Comm comm, const string &log_filename)
void system_signal_handler(int signal)
virtual ~ApplicationBase()
Destructor.
virtual void parse_cmd_line(const int argc, char **argv)
#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.
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.
PetscErrorCode petsc_signal_handler(int signal, void *context)
void petsc_initialize(int argc, char **argv)
ApplicationBase(int argc, char **argv)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.