Flow123d  JS_before_hm-887-g601087d
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"
23 #include "system/exceptions.hh"
25 
26 
27 using namespace std;
28 
29 #ifndef MAIN_H
30 #define MAIN_H
31 
32 
33 
34 class Application : public ApplicationBase {
35 public:
36  TYPEDEF_ERR_INFO( EI_InputVersionStr, string);
37  DECLARE_EXCEPTION( ExcVersionFormat,
38  << "Wrong format of the version specification: "
39  << EI_InputVersionStr::qval);
40 
41 
42  /// Root of the Input::Type tree. Description of whole input structure.
43  static Input::Type::Record & get_input_type();
44 
45  /// Application constructor.
46  Application(const std::string &python_path);
47 
48  /**
49  * Displays program version and build info.
50  * Pass version information to Profiler.
51  *
52  * TODO: Split these two functionalities.
53  */
54  void display_version();
55 
56  /**
57  * Read main input file
58  *
59  * Returns accessor to the root Record.
60  */
61  Input::Record read_input();
62 
63  /**
64  * Run application.
65  *
66  * Read input and solve problem.
67  */
68  void run() override;
69 
70  /**
71  * Terminate all MPI processes if exception is thrown.
72  */
73  void terminate();
74 
75  /// Destructor
76  virtual ~Application();
77 
78 protected:
79 
80  /**
81  * Check pause_after_run flag defined in input file.
82  */
83  void after_run();
84 
85 
86  /**
87  * Parse command line parameters.
88  * @param[in] argc command line argument count
89  * @param[in] argv command line arguments
90  */
91  virtual void parse_cmd_line(const int argc, char ** argv);
92 
93 private:
94 
95  /// Get version of program and other base data from rev_num.h and store them to map
96  Input::Type::RevNumData get_rev_num_data();
97 
98  /// Main Flow123d problem
100 
101  /// filename of main input file
103 
104  //int passed_argc_;
105  //char ** passed_argv_;
106 
107  /// Description of possible command line arguments.
109 
110  /// If true, we do output of profiling information.
112 
113  /// location of the profiler report file
115 
116  /// If true, preserves output of balance in YAML format.
118 
119  /// root input record
121 };
122 
123 
124 
125 
126 #endif
127 
128 //-----------------------------------------------------------------------------
129 // vim: set cindent:
130 
string main_input_filename_
filename of main input file
Definition: main.h:102
#define DECLARE_EXCEPTION(ExcName, Format)
Macro for simple definition of exceptions.
Definition: exceptions.hh:158
string profiler_path
location of the profiler report file
Definition: main.h:114
bool use_profiler
If true, we do output of profiling information.
Definition: main.h:111
HC_ExplicitSequential * problem_
Main Flow123d problem.
Definition: main.h:99
Stores version of program and other base data of application.
Definition: type_output.hh:44
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
bool yaml_balance_output_
If true, preserves output of balance in YAML format.
Definition: main.h:117
#define TYPEDEF_ERR_INFO(EI_Type, Type)
Macro to simplify declaration of error_info types.
Definition: exceptions.hh:194
string program_arguments_desc_
Description of possible command line arguments.
Definition: main.h:108
Record type proxy class.
Definition: type_record.hh:182
Class for solution of steady or unsteady flow with sequentially coupled explicit transport.
Input::Record root_record
root input record
Definition: main.h:120