Flow123d
release_3.0.0-968-gc87a28e79
|
Go to the documentation of this file.
26 #ifdef FLOW123D_HAVE_PETSC
29 #include <petsc/private/petscimpl.h>
37 #include "petscerror.h"
49 if (signal == SIGINT) {
52 if (signal == SIGFPE ||
58 THROW( ExcSignal() << EI_Signal(signal) << EI_SignalName(strsignal(signal)) );
60 return PetscSignalHandlerDefault(signal,(
void*)0);
72 signal_handler_off_(false)
95 stringstream log_name;
97 if ( log_filename ==
"//" ) {
118 #ifdef FLOW123D_HAVE_PETSC
119 PetscErrorCode ApplicationBase::petscvfprintf(FILE *fd,
const char format[], va_list Argp) {
123 if (fd != stdout && fd != stderr) {
124 ierr = PetscVFPrintfDefault(fd,
format,Argp); CHKERRQ(ierr);
126 const int buf_size = 65000;
129 ierr = PetscVSNPrintf(buff,buf_size,
format,&length,Argp);CHKERRQ(ierr);
134 PetscFunctionReturn(0);
140 #ifdef FLOW123D_HAVE_PETSC
145 PetscVFPrintf = this->petscvfprintf;
149 PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL);
158 MessageOut() <<
"MPI size: " << mpi_size << std::endl;
165 #ifdef FLOW123D_HAVE_PETSC
168 PetscErrorCode ierr=0;
170 ierr = PetscFinalize(); CHKERRQ(ierr);
virtual void parse_cmd_line(const int argc, char **argv)
void init(int argc, char **argv)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
PetscErrorCode petsc_signal_handler(int signal, void *context)
std::string format(CStringRef format_str, ArgList args)
static LoggerOptions & get_instance()
Getter of singleton instance object.
string petsc_redirect_file_
void system_signal_handler(int signal)
void set_log_file(std::string log_file_base)
Initialize instance object in format 'log_file_base.process.log'.
static bool petsc_initialized
Global macros to enhance readability and debugging, general constants.
void system_init(MPI_Comm comm, const string &log_filename)
bool signal_handler_off_
Turn off signal handling useful to debug with valgrind.
int setup_mpi(MPI_Comm comm)
Set rank of actual process by MPI communicator.
void petsc_initialize(int argc, char **argv)
ApplicationBase(int argc, char **argv)
static FILE * petsc_output_
File handler for redirecting PETSc output.
virtual ~ApplicationBase()
Destructor.
#define MessageOut()
Macro defining 'message' record of log.