Flow123d  master-a7f2151e0
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ApplicationBase Class Referenceabstract

#include <application_base.hh>

Inheritance diagram for ApplicationBase:
Inheritance graph
[legend]
Collaboration diagram for ApplicationBase:
Collaboration graph
[legend]

Public Member Functions

void init (int argc, char **argv)
 
virtual void run ()=0
 

Static Public Attributes

static const int exit_success = 0
 Return codes of application. More...
 
static const int exit_failure = 1
 
static const int exit_output = 0
 
static bool petsc_initialized = false
 

Protected Member Functions

 ApplicationBase ()
 
virtual ~ApplicationBase ()
 Destructor. More...
 
void system_init (MPI_Comm comm, const string &log_filename)
 
virtual void parse_cmd_line (const int argc, char **argv)=0
 
void petsc_initialize (int argc, char **argv)
 
int petcs_finalize ()
 

Protected Attributes

string log_filename_
 
string petsc_redirect_file_ =""
 
bool signal_handler_off_
 Turn off signal handling useful to debug with valgrind. More...
 

Static Protected Attributes

static FILE * petsc_output_ =NULL
 File handler for redirecting PETSc output. More...
 

Detailed Description

Base virtual class of Flow123D application.

Contains base methods of application for initialization, run and finalization which is used in derived class.

Usage:

class Application : public ApplicationBase {
public:
Application(int argc, char ** argv); // constructor
protected:
virtual void run(); // implementation of pure virtual method
virtual void after_run(); // overriding of parent method
}

Definition at line 65 of file application_base.hh.

Constructor & Destructor Documentation

◆ ApplicationBase()

ApplicationBase::ApplicationBase ( )
protected

Constructor

Construction is done in init method. We need to call virtual methods during construction.

Definition at line 71 of file application_base.cc.

◆ ~ApplicationBase()

ApplicationBase::~ApplicationBase ( )
protectedvirtual

Destructor.

Definition at line 199 of file application_base.cc.

Member Function Documentation

◆ init()

void ApplicationBase::init ( int  argc,
char **  argv 
)

Contains basic structure of application (initialization, run and finalization). Method is call after constructor and allows to call virtual methods.

Definition at line 185 of file application_base.cc.

Here is the caller graph for this function:

◆ parse_cmd_line()

virtual void ApplicationBase::parse_cmd_line ( const int  argc,
char **  argv 
)
protectedpure virtual

Parse command line parameters before Flow123D initialization.

Method must be implemented in derived class.

Implemented in Application.

Here is the caller graph for this function:

◆ petcs_finalize()

int ApplicationBase::petcs_finalize ( )
protected

Finalize PETSC. If finalization failed return nonzero value.

Definition at line 165 of file application_base.cc.

Here is the caller graph for this function:

◆ petsc_initialize()

void ApplicationBase::petsc_initialize ( int  argc,
char **  argv 
)
protected

Implement printf function for PETSc with support for redirecting. Initialize PETSC.

Definition at line 140 of file application_base.cc.

Here is the caller graph for this function:

◆ run()

virtual void ApplicationBase::run ( )
pure virtual

Run application.

Method must be implemented in derived class.

Implemented in Application.

◆ system_init()

void ApplicationBase::system_init ( MPI_Comm  comm,
const string &  log_filename 
)
protected

Read system parameters, open log.

Definition at line 79 of file application_base.cc.

Here is the caller graph for this function:

Member Data Documentation

◆ exit_failure

const int ApplicationBase::exit_failure = 1
static

Definition at line 83 of file application_base.hh.

◆ exit_output

const int ApplicationBase::exit_output = 0
static

Definition at line 84 of file application_base.hh.

◆ exit_success

const int ApplicationBase::exit_success = 0
static

Return codes of application.

Definition at line 82 of file application_base.hh.

◆ log_filename_

string ApplicationBase::log_filename_
protected

Log file name argument - passed to system_init; "" means default, "\n" means no logging TODO: move whole system_init into Application, use singleton for some runtime global options for the Flow123d library.

Definition at line 134 of file application_base.hh.

◆ petsc_initialized

bool ApplicationBase::petsc_initialized = false
static

Definition at line 86 of file application_base.hh.

◆ petsc_output_

FILE * ApplicationBase::petsc_output_ =NULL
staticprotected

File handler for redirecting PETSc output.

Definition at line 141 of file application_base.hh.

◆ petsc_redirect_file_

string ApplicationBase::petsc_redirect_file_ =""
protected

Optional file name for output of PETSc parameters. Has to be set in parse_cmd_line()

Definition at line 138 of file application_base.hh.

◆ signal_handler_off_

bool ApplicationBase::signal_handler_off_
protected

Turn off signal handling useful to debug with valgrind.

Definition at line 144 of file application_base.hh.


The documentation for this class was generated from the following files:
Application
Definition: main.h:35
ApplicationBase::run
virtual void run()=0
ApplicationBase
Definition: application_base.hh:65