25 #ifdef FLOW123D_HAVE_PETSC 36 if (signal == SIGINT) {
39 if (signal == SIGFPE ||
45 THROW( ExcSignal() << EI_Signal(signal) << EI_SignalName(strsignal(signal)) );
47 return PetscSignalHandlerDefault(signal,(
void*)0);
59 signal_handler_off_(false)
82 stringstream log_name;
84 if ( log_filename ==
"//" ) {
105 #ifdef FLOW123D_HAVE_PETSC 106 PetscErrorCode ApplicationBase::petscvfprintf(FILE *fd,
const char format[], va_list Argp) {
110 if (fd != stdout && fd != stderr) {
111 ierr = PetscVFPrintfDefault(fd,
format,Argp); CHKERRQ(ierr);
113 const int buf_size = 65000;
116 ierr = PetscVSNPrintf(buff,buf_size,
format,&length,Argp);CHKERRQ(ierr);
121 PetscFunctionReturn(0);
127 #ifdef FLOW123D_HAVE_PETSC 132 PetscVFPrintf = this->petscvfprintf;
136 PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL);
145 MessageOut() <<
"MPI size: " << mpi_size << std::endl;
152 #ifdef FLOW123D_HAVE_PETSC 155 PetscErrorCode ierr=0;
157 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.
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.