Flow123d  3.9.0-127d9ed9b
main.h
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file main.h
15  * @brief
16  */
17 
18 #include <string>
20 #include "input/accessors.hh"
21 #include "input/type_output.hh"
22 #include "input/input_exception.hh"
24 #include "system/exceptions.hh"
26 
27 
28 using namespace std;
29 
30 #ifndef MAIN_H
31 #define MAIN_H
32 
33 
34 
35 class Application : public ApplicationBase {
36 public:
37  TYPEDEF_ERR_INFO( EI_InputVersionStr, string);
38  DECLARE_EXCEPTION( ExcVersionFormat,
39  << "Wrong format of the version specification: "
40  << EI_InputVersionStr::qval);
41  DECLARE_INPUT_EXCEPTION( ExcUnknownProblem, << "Problem type not implemented.\n" );
42 
43 
44  /// Root of the Input::Type tree. Description of whole input structure.
45  static Input::Type::Record & get_input_type();
46 
47  /// Application constructor.
48  Application(const std::string &python_path);
49 
50  /**
51  * Displays program version and build info.
52  * Pass version information to Profiler.
53  *
54  * TODO: Split these two functionalities.
55  */
56  void display_version();
57 
58  /**
59  * Read main input file
60  *
61  * Returns accessor to the root Record.
62  */
63  Input::Record read_input();
64 
65  /**
66  * Run application.
67  *
68  * Read input and solve problem.
69  */
70  void run() override;
71 
72  /**
73  * Terminate all MPI processes if exception is thrown.
74  */
75  void terminate();
76 
77  /// Destructor
78  virtual ~Application();
79 
80 protected:
81 
82  /**
83  * Check pause_after_run flag defined in input file.
84  */
85  void after_run();
86 
87 
88  /**
89  * Parse command line parameters.
90  * @param[in] argc command line argument count
91  * @param[in] argv command line arguments
92  */
93  virtual void parse_cmd_line(const int argc, char ** argv);
94 
95 private:
96 
97  /// Get version of program and other base data from rev_num.h and store them to map
98  Input::Type::RevNumData get_rev_num_data();
99 
100  /// Main Flow123d problem
102 
103  /// filename of main input file
105 
106  //int passed_argc_;
107  //char ** passed_argv_;
108 
109  /// Description of possible command line arguments.
111 
112  /// If true, we do output of profiling information.
114 
115  /// location of the profiler report file
117 
118  /// If true, preserves output of balance in YAML format.
120 
121  /// root input record
123 };
124 
125 
126 
127 
128 #endif
129 
130 //-----------------------------------------------------------------------------
131 // vim: set cindent:
132 
Application::profiler_path
string profiler_path
location of the profiler report file
Definition: main.h:116
Application::main_input_filename_
string main_input_filename_
filename of main input file
Definition: main.h:104
Application::problem_
HC_ExplicitSequential * problem_
Main Flow123d problem.
Definition: main.h:101
Application
Definition: main.h:35
input_type_forward.hh
exceptions.hh
Application::use_profiler
bool use_profiler
If true, we do output of profiling information.
Definition: main.h:113
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
ApplicationBase
Definition: application_base.hh:65
accessors.hh
Input::Type::RevNumData
Stores version of program and other base data of application.
Definition: type_output.hh:44
input_exception.hh
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
TYPEDEF_ERR_INFO
#define TYPEDEF_ERR_INFO(EI_Type, Type)
Macro to simplify declaration of error_info types.
Definition: exceptions.hh:194
type_output.hh
Application::program_arguments_desc_
string program_arguments_desc_
Description of possible command line arguments.
Definition: main.h:110
Application::yaml_balance_output_
bool yaml_balance_output_
If true, preserves output of balance in YAML format.
Definition: main.h:119
std
Definition: doxy_dummy_defs.hh:5
DECLARE_INPUT_EXCEPTION
#define DECLARE_INPUT_EXCEPTION(ExcName, Format)
Macro for simple definition of input exceptions.
Definition: input_exception.hh:69
HC_ExplicitSequential
Class for solution of steady or unsteady flow with sequentially coupled explicit transport.
Definition: hc_explicit_sequential.hh:49
application_base.hh
Application::root_record
Input::Record root_record
root input record
Definition: main.h:122
DECLARE_EXCEPTION
#define DECLARE_EXCEPTION(ExcName, Format)
Macro for simple definition of exceptions.
Definition: exceptions.hh:158