📄 mld_representation.h
字号:
/* HYSDEL Copyright (C) 1999-2002 Fabio D. Torrisi This file is part of HYSDEL. HYSDEL is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. HYSDEL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA CONTACT INFORMATION =================== Fabio D. Torrisi ETH Zentrum Physikstrasse. 3 ETL, CH-8032 Zurich Switzerland mailto:torrisi@aut.ee.ethz.ch (preferred)*/#ifndef D_MLD_REPRESENTATION#define D_MLD_REPRESENTATION#ifndef STD_NS#define STD_NSusing namespace std;#endif#include <map>#include "OO_consts.h"#include "string"class Symbol_table;class Matrix;class Expr;class Var_symbol;class Globals;class Row_information;/** would like to make these private static const in MLD_representation * but this causes an internal compiler error (gcc 2.95.3-5 (cygwin * special version))!!!! */#define NOF_EQ_MAT 14#define NOF_INEQ_MAT 7struct rowinfo_order { bool operator() (const int s1, const int s2) const { return s1 < s2; }};class MLD_representation {public: MLD_representation(const Globals * glob); ~MLD_representation(); /** set a coefficient in 14a or 14b: lhs += coeff * var */ void set_coeff_eq(const Var_symbol * lhs, const Var_symbol * var, Expr * coeff); /** set description s for the equality defining lhs */ void set_info_eq(const Var_symbol * lhs, Row_information * info); /** generate a new inequality and return its handle */ int new_ineq(); /** set a coefficient in 14c set the coefficint coeff for the variable * var in inequality ineq. if var==NULL, coeff goes into E_5 (the * constant part) ineq must be generated using new_ineq() */ void set_coeff_ineq(int ineq, const Var_symbol * var, Expr * coeff); /** same as set_coeff_ineq, but if var belongs to the right side * of '<=', coeff is negated */ void set_coeff_ineq_less(int ineq, const Var_symbol * var, Expr * coeff); /** same as set_coeff_ineq_less, but if the Matrix-entry for (ineq, * var)already exitst, add coeff to the old value instead * of overwriting in. */ void add_coeff_ineq_less(int ineq, const Var_symbol * var, Expr * coeff); /** set description s for inequality ineq */ void set_info_ineq(int ineq, Row_information * info); /** add eqs and ineqs specified in from */ void merge(MLD_representation * from); /** print all matrices in matlab-format * if sparse, use sparse-format for matrices */ string to_matlab(bool sparse = false) const; /** pretty print a single row */ string row_to_string(const Var_symbol *lhs) const; string row_to_string(int ineq) const;private: void check_ineqs() const; void check_dims() const; string info() const; /** find the coefficient belonging to (ineq, var). If it does not * exist, return NULL. */ Expr * get_coeff_ineq(int ineq, const Var_symbol * var); /** when first writing to a matrix, MLD_representation checks * sym_tab and initializes that matrix to be of proper size. As a * consequence, after writing a matrix, no new Symbols * can be declared. */ const Globals * globals; /** find correct matrix based on kind and type of the Variables */ Matrix * find_eq_mat(Symb_kind lhs_kind, Symb_type lhs_type, Symb_kind var_kind, Symb_type var_type) const; /** find correct matrix based on kind and type of the Variables */ Matrix * find_ineq_mat(Symb_kind kind, Symb_type type) const; string preamble() const; /** notation for Matrices: first index identifies variable-type * second index identifies lhs-type */ /** order of Matrices: A_rr, A_br, A_rb, A_bb, B1_rr, B1_br, * B1_rb, B1_bb, B3_rr, B3_br, B2_rb, B2_bb */ //Matrix* state_upd_mat[NOF_EQ_MAT]; /** maybe make these local defines in MLD_representation.cc */ Matrix * A_rr, * A_br, * A_rb, * A_bb; Matrix * B1_rr, * B1_br, * B1_rb, * B1_bb, * B3_rr, * B3_br, * B2_rb, * B2_bb; Matrix * B5_r, * B5_b; /** order of Matrices: C_rr, C_br, C_rb, C_bb, D1_rr, D1_br, * D1_rb, D1_bb, D3_rr, D3_br, D2_rb, D2_bb */ //Matrix* output_mat[NOF_EQ_MAT]; Matrix * C_rr, * C_br, * C_rb, * C_bb, * D1_rr, * D1_br, * D1_rb, * D1_bb; Matrix * D3_rr, * D3_br, * D2_rb, * D2_bb; Matrix * D5_r, * D5_b; /** order of Matrices: E1_c E1_d E3 E2 E4_c E4_d E5 */ //Matrix* ineq_mat[NOF_INEQ_MAT]; Matrix * E1_c, * E1_d, * E3, * E2, * E4_c, * E4_d, * E5; /** keep track of the number of inequalities */ int nof_ineq; map < int, Row_information *, rowinfo_order > state_upd_info, output_info, ineq_info; typedef map < int, Row_information *, rowinfo_order >::iterator info_iter; typedef map < int, Row_information *, rowinfo_order >::const_iterator const_info_iter;};#endif //D_MLD_REPRESENTATION
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -