MicroModelicaCCompiler  4.5.3
model_matrix.hpp
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  This file is part of QSS Solver.
4 
5  QSS Solver is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  QSS Solver is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QSS Solver. If not, see <http://www.gnu.org/licenses/>.
17 
18  ******************************************************************************/
19 
20 #pragma once
21 
22 #include <string>
23 
24 #include <deps/builders/eq_graph_builder.hpp>
25 #include <deps/builders/ev_graph_builder.hpp>
26 #include <deps/builders/merge_graph.hpp>
27 #include <deps/sb_dependencies.hpp>
28 #include <ir/model_matrix_gen.hpp>
29 
30 namespace MicroModelica {
31 namespace IR {
32 
33 template<typename GraphBuilder, typename MatrixBuilder, typename Config, typename T, typename N>
34 class ModelMatrix {
35  public:
36  ModelMatrix();
37  ~ModelMatrix() = default;
38 
39  void build(Config config);
40 
41  void setMode(MATRIX::Mode mode);
42  std::string alloc();
43  std::string init();
44  std::string accessVector() const;
45  bool empty();
46  void append(ModelMatrixDef def);
47  ModelMatrixDef def();
48 
49  protected:
50  ModelMatrixDef _model_matrix_def;
52  std::string _access[2];
53 };
54 
55 typedef ModelMatrix<Deps::SDSBGraphBuilder, Deps::EQModelMatrixBuilder, MATRIX::EQMatrixConfig, IR::EquationTable, IR::Equation> SDMatrix;
56 
57 typedef ModelMatrix<Deps::SZSBGraphBuilder, Deps::EQModelMatrixBuilder, MATRIX::EQMatrixConfig, IR::EquationTable, IR::Equation> SZMatrix;
58 
59 typedef ModelMatrix<Deps::SOSBGraphBuilder, Deps::EQModelMatrixBuilder, MATRIX::EQMatrixConfig, IR::EquationTable, IR::Equation> SOMatrix;
60 
61 typedef ModelMatrix<Deps::DOSBGraphBuilder, Deps::EQModelMatrixBuilder, MATRIX::EQMatrixConfig, IR::EquationTable, IR::Equation> DOMatrix;
62 
63 typedef ModelMatrix<Deps::DSCGraphBuilder, Deps::EVModelMatrixBuilder, MATRIX::EVMatrixConfig, IR::EventTable, IR::Event> LHSDSCMatrix;
64 
65 typedef ModelMatrix<Deps::LHSStGraphBuilder, Deps::EVModelMatrixBuilder, MATRIX::EVMatrixConfig, IR::EventTable, IR::Event> LHSSTMatrix;
66 
67 typedef ModelMatrix<Deps::RHSStGraphBuilder, Deps::EVModelMatrixBuilder, MATRIX::EVMatrixConfig, IR::EventTable, IR::Event> RHSSTMatrix;
68 
70 
72 
74 
76 
77 } // namespace IR
78 } // namespace MicroModelica
MicroModelica::IR::ModelMatrix::build
void build(Config config)
Definition: model_matrix.cpp:57
MicroModelica::IR::ModelMatrix
Definition: model_matrix.hpp:68
MicroModelica::IR::ModelMatrix::_mode
MATRIX::Mode _mode
Definition: model_matrix.hpp:102
MicroModelica::IR::ModelMatrix::_model_matrix_def
ModelMatrixDef _model_matrix_def
Definition: model_matrix.hpp:101
MicroModelica::IR::ModelMatrix::setMode
void setMode(MATRIX::Mode mode)
Definition: model_matrix.cpp:101
MicroModelica::IR::ModelMatrix::alloc
std::string alloc()
Definition: model_matrix.cpp:77
MicroModelica::IR::DOMatrix
ModelMatrix< Deps::DOSBGraphBuilder, Deps::EQModelMatrixBuilder, MATRIX::EQMatrixConfig, IR::EquationTable, IR::Equation > DOMatrix
Definition: model_matrix.hpp:95
MicroModelica::IR::RHSSTMatrix
ModelMatrix< Deps::RHSStGraphBuilder, Deps::EVModelMatrixBuilder, MATRIX::EVMatrixConfig, IR::EventTable, IR::Event > RHSSTMatrix
Definition: model_matrix.hpp:101
MicroModelica::IR::ModelMatrix::ModelMatrix
ModelMatrix()
Definition: model_matrix.cpp:52
MicroModelica::IR::ModelMatrix::empty
bool empty()
Definition: model_matrix.cpp:95
MicroModelica::IR::SOMatrix
ModelMatrix< Deps::SOSBGraphBuilder, Deps::EQModelMatrixBuilder, MATRIX::EQMatrixConfig, IR::EquationTable, IR::Equation > SOMatrix
Definition: model_matrix.hpp:93
MicroModelica::IR::ModelMatrix::accessVector
std::string accessVector() const
Definition: model_matrix.cpp:89
MicroModelica::IR::ModelMatrix::append
void append(ModelMatrixDef def)
Definition: model_matrix.cpp:113
MicroModelica::IR::ModelMatrix::init
std::string init()
Definition: model_matrix.cpp:83
MicroModelica::IR::ModelMatrix::~ModelMatrix
~ModelMatrix()=default
MicroModelica::IR::SZMatrix
ModelMatrix< Deps::SZSBGraphBuilder, Deps::EQModelMatrixBuilder, MATRIX::EQMatrixConfig, IR::EquationTable, IR::Equation > SZMatrix
Definition: model_matrix.hpp:91
model_matrix_gen.hpp
MicroModelica::IR::HDMatrix
ModelMatrix< Deps::HDGraphBuilder, Deps::EVModelMatrixBuilder, MATRIX::EVMatrixConfig, IR::EventTable, IR::Event > HDMatrix
Definition: model_matrix.hpp:103
MicroModelica::IR::ModelMatrix::_access
std::string _access[2]
Definition: model_matrix.hpp:103
MicroModelica::IR::MATRIX::Mode
Mode
Definition: model_matrix_gen.hpp:86
MicroModelica::IR::ModelMatrix::def
ModelMatrixDef def()
Definition: model_matrix.cpp:107
MicroModelica::IR::LHSSTMatrix
ModelMatrix< Deps::LHSStGraphBuilder, Deps::EVModelMatrixBuilder, MATRIX::EVMatrixConfig, IR::EventTable, IR::Event > LHSSTMatrix
Definition: model_matrix.hpp:99
MicroModelica::IR::HZSTMatrix
ModelMatrix< Deps::HZSTGraphBuilder, Deps::EVModelMatrixBuilder, MATRIX::EVMatrixConfig, IR::EventTable, IR::Event > HZSTMatrix
Definition: model_matrix.hpp:107
MicroModelica
Definition: files.cpp:45
MicroModelica::IR::HZMatrix
ModelMatrix< Deps::HZGraphBuilder, Deps::EVModelMatrixBuilder, MATRIX::EVMatrixConfig, IR::EventTable, IR::Event > HZMatrix
Definition: model_matrix.hpp:105
MicroModelica::IR::SDMatrix
ModelMatrix< Deps::SDSBGraphBuilder, Deps::EQModelMatrixBuilder, MATRIX::EQMatrixConfig, IR::EquationTable, IR::Equation > SDMatrix
Definition: model_matrix.hpp:89
MicroModelica::IR::LHSDSCMatrix
ModelMatrix< Deps::DSCGraphBuilder, Deps::EVModelMatrixBuilder, MATRIX::EVMatrixConfig, IR::EventTable, IR::Event > LHSDSCMatrix
Definition: model_matrix.hpp:97
MicroModelica::IR::HHMatrix
ModelMatrix< Deps::HHGraphBuilder, Deps::EVModelMatrixBuilder, MATRIX::EVMatrixConfig, IR::EventTable, IR::Event > HHMatrix
Definition: model_matrix.hpp:109