MicroModelicaCCompiler  4.5.3
user_def_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 <ir/model_matrix_gen.hpp>
25 
26 namespace MicroModelica {
27 namespace IR {
28 
29 template <typename Config, typename N>
30 class UserDefMatrix {
31  public:
32  UserDefMatrix(Config matrix_config);
33  ~UserDefMatrix() = default;
34 
35  void compute();
36 
37  ModelMatrixDef def();
38  std::vector<std::string> accessVector();
39 
40  protected:
41  string component(MATRIX::Method method, MATRIX::Mode mode) const;
42  void printMatrix(MATRIX::Method method, MATRIX::Mode mode);
43  AST_Expression transformExp(AST_Expression exp);
44 
45  ModelMatrixDef _model_matrix_def;
46  std::vector<std::string> _access_vector;
47  Config _matrix_config;
48 };
49 
50 } // namespace IR
51 } // namespace MicroModelica
MicroModelica::IR::UserDefMatrix::_matrix_config
Config _matrix_config
Definition: user_def_matrix.hpp:98
MicroModelica::IR::UserDefMatrix::~UserDefMatrix
~UserDefMatrix()=default
MicroModelica::IR::UserDefMatrix::UserDefMatrix
UserDefMatrix(Config matrix_config)
Definition: user_def_matrix.cpp:50
MicroModelica::IR::UserDefMatrix::printMatrix
void printMatrix(MATRIX::Method method, MATRIX::Mode mode)
Definition: user_def_matrix.cpp:116
MicroModelica::IR::UserDefMatrix::def
ModelMatrixDef def()
Definition: user_def_matrix.cpp:198
MicroModelica::IR::MATRIX::Method
Method
Definition: model_matrix_gen.hpp:88
MicroModelica::IR::UserDefMatrix::_model_matrix_def
ModelMatrixDef _model_matrix_def
Definition: user_def_matrix.hpp:96
MicroModelica::IR::UserDefMatrix::transformExp
AST_Expression transformExp(AST_Expression exp)
Definition: user_def_matrix.cpp:79
MicroModelica::IR::UserDefMatrix::component
string component(MATRIX::Method method, MATRIX::Mode mode) const
Definition: user_def_matrix.cpp:64
MicroModelica::IR::UserDefMatrix::accessVector
std::vector< std::string > accessVector()
Definition: user_def_matrix.cpp:204
model_matrix_gen.hpp
MicroModelica::IR::MATRIX::Mode
Mode
Definition: model_matrix_gen.hpp:86
MicroModelica
Definition: files.cpp:45
MicroModelica::IR::UserDefMatrix::_access_vector
std::vector< std::string > _access_vector
Definition: user_def_matrix.hpp:97
MicroModelica::IR::UserDefMatrix::compute
void compute()
Definition: user_def_matrix.cpp:55