Flow123d  master-f44eb46
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Application Class Reference

#include <application.hh>

Collaboration diagram for Application:
Collaboration graph
[legend]

Public Member Functions

 TYPEDEF_ERR_INFO (EI_InputVersionStr, string)
 
 DECLARE_EXCEPTION (ExcVersionFormat,<< "Wrong format of the version specification: "<< EI_InputVersionStr::qval)
 
 DECLARE_INPUT_EXCEPTION (ExcUnknownProblem,<< "Problem type not implemented.\n")
 
 DECLARE_INPUT_EXCEPTION (ExcNoRunOption,<< "No run option should be catched. Seeng this message is an error.\n")
 
 Application ()
 
Input::Record read_input ()
 
void init (int argc, char **argv)
 
void run ()
 
void display_version ()
 
 ~Application ()
 Destructor. More...
 

Static Public Member Functions

static Input::Type::Recordget_input_type ()
 Root of the Input::Type tree. Description of whole input structure. More...
 

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
 
static bool permon_initialized = false
 

Protected Member Functions

void after_run ()
 
void parse_cmd_line (const int argc, char **argv)
 
void system_init (MPI_Comm comm, const string &log_filename)
 
void petsc_initialize (int argc, char **argv)
 
int petcs_finalize ()
 
void permon_initialize (int argc, char **argv)
 
int permon_finalize ()
 

Protected Attributes

string log_filename_
 
string petsc_redirect_file_ =""
 
bool signal_handler_off_
 Turn off signal handling useful to debug with valgrind. More...
 
HC_ExplicitSequentialproblem_
 Get version of program and other base data from rev_num.h and store them to map. More...
 
string main_input_filename_
 filename of main input file More...
 
string program_arguments_desc_
 Description of possible command line arguments. More...
 
bool use_profiler
 If true, we do output of profiling information. More...
 
string profiler_path
 location of the profiler report file More...
 
bool yaml_balance_output_
 If true, preserves output of balance in YAML format. More...
 
Input::Record root_record
 root input record 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
}
void after_run()
Definition: application.cc:583

Definition at line 80 of file application.hh.

Constructor & Destructor Documentation

◆ Application()

Application::Application ( )

Constructor

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

Definition at line 76 of file application.cc.

◆ ~Application()

Application::~Application ( )

Destructor.

Definition at line 611 of file application.cc.

Member Function Documentation

◆ after_run()

void Application::after_run ( )
protected

Check pause_after_run flag defined in input file.

Definition at line 583 of file application.cc.

Here is the caller graph for this function:

◆ DECLARE_EXCEPTION()

Application::DECLARE_EXCEPTION ( ExcVersionFormat  ,
<< "Wrong format of the version specification: "<< EI_InputVersionStr::qval   
)

◆ DECLARE_INPUT_EXCEPTION() [1/2]

Application::DECLARE_INPUT_EXCEPTION ( ExcNoRunOption  ,
<< "No run option should be catched. Seeng this message is an error.\n"   
)

◆ DECLARE_INPUT_EXCEPTION() [2/2]

Application::DECLARE_INPUT_EXCEPTION ( ExcUnknownProblem  ,
<< "Problem type not implemented.\n"   
)

◆ display_version()

void Application::display_version ( )

Displays program version and build info. Pass version information to Profiler.

TODO: Split these two functionalities.

Definition at line 286 of file application.cc.

Here is the caller graph for this function:

◆ get_input_type()

it::Record & Application::get_input_type ( )
static

Root of the Input::Type tree. Description of whole input structure.

Definition at line 264 of file application.cc.

Here is the caller graph for this function:

◆ init()

void Application::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 492 of file application.cc.

Here is the caller graph for this function:

◆ parse_cmd_line()

void Application::parse_cmd_line ( const int  argc,
char **  argv 
)
protected

Parse command line parameters.

Parameters
[in]argccommand line argument count
[in]argvcommand line arguments

Definition at line 323 of file application.cc.

Here is the caller graph for this function:

◆ permon_finalize()

int Application::permon_finalize ( )
protected

Finalize PERMON. If finalization failed return nonzero value.

Definition at line 213 of file application.cc.

Here is the caller graph for this function:

◆ permon_initialize()

void Application::permon_initialize ( int  argc,
char **  argv 
)
protected

Initialize PERMON.

Definition at line 207 of file application.cc.

Here is the caller graph for this function:

◆ petcs_finalize()

int Application::petcs_finalize ( )
protected

Finalize PETSC. If finalization failed return nonzero value.

Definition at line 187 of file application.cc.

Here is the caller graph for this function:

◆ petsc_initialize()

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

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

Definition at line 162 of file application.cc.

Here is the caller graph for this function:

◆ read_input()

Input::Record Application::read_input ( )

Read main input file

Returns accessor to the root Record.

Definition at line 305 of file application.cc.

Here is the caller graph for this function:

◆ run()

void Application::run ( )

Run application.

Read input and solve problem.

Definition at line 521 of file application.cc.

Here is the caller graph for this function:

◆ system_init()

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

Read system parameters, open log.

Definition at line 101 of file application.cc.

Here is the caller graph for this function:

◆ TYPEDEF_ERR_INFO()

Application::TYPEDEF_ERR_INFO ( EI_InputVersionStr  ,
string   
)

Member Data Documentation

◆ exit_failure

const int Application::exit_failure = 1
static

Definition at line 91 of file application.hh.

◆ exit_output

const int Application::exit_output = 0
static

Definition at line 92 of file application.hh.

◆ exit_success

const int Application::exit_success = 0
static

Return codes of application.

Definition at line 90 of file application.hh.

◆ log_filename_

string Application::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 201 of file application.hh.

◆ main_input_filename_

string Application::main_input_filename_
protected

filename of main input file

Definition at line 221 of file application.hh.

◆ permon_initialized

bool Application::permon_initialized = false
static

Definition at line 95 of file application.hh.

◆ petsc_initialized

bool Application::petsc_initialized = false
static

Definition at line 94 of file application.hh.

◆ petsc_output_

FILE * Application::petsc_output_ =NULL
staticprotected

File handler for redirecting PETSc output.

Definition at line 208 of file application.hh.

◆ petsc_redirect_file_

string Application::petsc_redirect_file_ =""
protected

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

Definition at line 205 of file application.hh.

◆ problem_

HC_ExplicitSequential* Application::problem_
protected

Get version of program and other base data from rev_num.h and store them to map.

Main Flow123d problem

Definition at line 218 of file application.hh.

◆ profiler_path

string Application::profiler_path
protected

location of the profiler report file

Definition at line 233 of file application.hh.

◆ program_arguments_desc_

string Application::program_arguments_desc_
protected

Description of possible command line arguments.

Definition at line 227 of file application.hh.

◆ root_record

Input::Record Application::root_record
protected

root input record

Definition at line 239 of file application.hh.

◆ signal_handler_off_

bool Application::signal_handler_off_
protected

Turn off signal handling useful to debug with valgrind.

Definition at line 211 of file application.hh.

◆ use_profiler

bool Application::use_profiler
protected

If true, we do output of profiling information.

Definition at line 230 of file application.hh.

◆ yaml_balance_output_

bool Application::yaml_balance_output_
protected

If true, preserves output of balance in YAML format.

Definition at line 236 of file application.hh.


The documentation for this class was generated from the following files: