Flow123d
master-eb60559f2
|
Go to the documentation of this file.
26 #ifdef FLOW123D_HAVE_PETSC
29 #include <petsc/private/petscimpl.h>
32 #ifdef FLOW123D_HAVE_PERMON
33 #include <permonsys.h>
41 #include "petscerror.h"
54 if (signal == SIGINT) {
57 if (signal == SIGFPE ||
63 THROW( ExcSignal() << EI_Signal(signal) << EI_SignalName(strsignal(signal)) );
65 return PetscSignalHandlerDefault(signal,(
void*)0);
77 signal_handler_off_(false)
101 stringstream log_name;
103 if ( log_filename ==
"//" ) {
124 #ifdef FLOW123D_HAVE_PETSC
125 PetscErrorCode ApplicationBase::petscvfprintf(FILE *fd,
const char format[], va_list Argp) {
129 if (fd != stdout && fd != stderr) {
130 ierr = PetscVFPrintfDefault(fd,
format,Argp); CHKERRQ(ierr);
132 const int buf_size = 65000;
135 ierr = PetscVSNPrintf(buff,buf_size,
format,&length,Argp);CHKERRQ(ierr);
140 PetscFunctionReturn(0);
146 #ifdef FLOW123D_HAVE_PETSC
151 PetscVFPrintf = this->petscvfprintf;
155 PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL);
164 MessageOut() <<
"MPI size: " << mpi_size << std::endl;
171 #ifdef FLOW123D_HAVE_PETSC
174 PetscErrorCode ierr=0;
176 ierr = PetscFinalize(); CHKERRQ(ierr);
191 #ifdef FLOW123D_HAVE_PERMON
192 PermonInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL);
197 #ifdef FLOW123D_HAVE_PERMON
200 PetscErrorCode ierr=0;
202 ierr = PermonFinalize(); CHKERRQ(ierr);
manipulators::Array< T, Delim > format(T const &deduce, Delim delim=", ")
static Profiler * instance(bool clear=false)
void permon_initialize(int argc, char **argv)
void init(int argc, char **argv)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
static LoggerOptions & get_instance()
Getter of singleton instance object.
string petsc_redirect_file_
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
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
void system_init(MPI_Comm comm, const string &log_filename)
bool signal_handler_off_
Turn off signal handling useful to debug with valgrind.
virtual void parse_cmd_line(const int argc, char **argv)=0
int setup_mpi(MPI_Comm comm)
Set rank of actual process by MPI communicator.
static bool permon_initialized
void petsc_initialize(int argc, char **argv)
PetscErrorCode petsc_signal_handler(int signal, FMT_UNUSED void *context)
static FILE * petsc_output_
File handler for redirecting PETSc output.
virtual ~ApplicationBase()
Destructor.
#define MessageOut()
Macro defining 'message' record of log.