MicroModelicaCCompiler
4.5.3
|
#include <index.hpp>
Public Member Functions | |
Range () | |
Range (AST_Equation_For eqf, RANGE::Type type=RANGE::For) | |
Range (AST_Statement_For stf, RANGE::Type type=RANGE::For, bool from_event=false) | |
Range (Util::Variable var, RANGE::Type type=RANGE::For) | |
Range (AST_Expression exp) | |
Range (SB::Set set, int offset, std::vector< std::string > vars=std::vector< std::string >(), Option< Range > orig_range=Option< Range >()) | |
~Range ()=default | |
int | size () const |
bool | isEmpty () const |
RangeDefinitionTable | definition () const |
int | dim () const |
std::string | print (bool range=false, bool c_index=false, bool convert_params=false) const |
std::string | end () const |
std::string | indexes () const |
std::vector< std::string > | getIndexes () const |
std::vector< std::string > | getInitValues () const |
void | addLocalVariables () const |
void | addRangeLocalVariables () const |
int | rowSize (int dim) const |
std::string | block (int dim=-1) const |
int | pos (std::string var) |
std::string | iterator (int dim, bool range_idx=false) |
std::string | iterator (std::string var, int dim, bool range_idx=false) |
std::string | getPrintDimensionVarsString () const |
std::string | getDimensionVarsString (bool range=false) const |
std::vector< std::string > | getDimensionVars (bool range=false) const |
std::string | getDimensionVar (int i, bool range=false) const |
bool | intersect (Range other) |
void | applyUsage (Index usage) |
bool | checkUsage (Index usage, Index def) |
std::string | in (ExpressionList exps) |
std::string | in (std::vector< std::string > exps) |
map< std::string, AST_Expression > | initExps () |
void | replace (Index ife_usage, Index ifr_usage=Index()) |
void | generate (SB::Set set, int offset, std::vector< std::string > vars, std::vector< Expression > begin_exps=std::vector< Expression >(), std::vector< Expression > end_exps=std::vector< Expression >()) |
bool | fixed () const |
void | merge (Range other) |
bool | hasMergedDims () const |
bool | isDimensionVar (std::string var) |
void | update (int offset) |
void | update (Range other) |
Protected Member Functions | |
void | generate (Util::Variable var) |
void | generate (AST_Expression exp) |
void | generate (SB::Set set, int offset, std::vector< std::string > vars, Option< Range > orig_range) |
void | updateRangeDefinition (std::string index_def, RangeDefinition def, int pos) |
void | addRangeVariables (int i, string index) const |
bool | isVariable (std::string var) |
bool | testExpression (AST_Expression exp) |
Expression | getExp (std::vector< Expression > exps, size_t pos) |
bool | checkRangeVariable (string var, set< string > &added_vars, vector< string > &old_keys, int &pos) |
bool | checkRangeVariables (string ife_idx, string ifr_idx, set< string > &added_vars, vector< string > &old_keys, int &pos) |
Private Member Functions | |
void | setRangeDefinition (AST_ForIndexList fil, bool from_event=false) |
Private Attributes | |
RangeDefinitionTable | _ranges |
ModelTable< std::string, int > | _index_pos |
int | _size |
RANGE::Type | _type |
std::vector< int > | _row_size |
bool | _fixed |
bool | _merged_dims |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Range &r) |
MicroModelica::IR::Range::Range | ( | AST_Equation_For | eqf, |
RANGE::Type | type = RANGE::For |
||
) |
Definition at line 284 of file index.cpp.
References generate().
MicroModelica::IR::Range::Range | ( | AST_Statement_For | stf, |
RANGE::Type | type = RANGE::For , |
||
bool | from_event = false |
||
) |
Definition at line 290 of file index.cpp.
References generate().
MicroModelica::IR::Range::Range | ( | Util::Variable | var, |
RANGE::Type | type = RANGE::For |
||
) |
Definition at line 297 of file index.cpp.
References _index_pos, _ranges, ModelTable< Key, Value >::insert(), and pos().
MicroModelica::IR::Range::Range | ( | SB::Set | set, |
int | offset, | ||
std::vector< std::string > | vars = std::vector< std::string >() , |
||
Option< Range > | orig_range = Option< Range >() |
||
) |
|
default |
void MicroModelica::IR::Range::addLocalVariables | ( | ) | const |
Definition at line 634 of file index.cpp.
References MicroModelica::Util::ModelConfig::addLocalSymbol(), getDimensionVar(), and MicroModelica::Util::ModelConfig::instance().
void MicroModelica::IR::Range::addRangeLocalVariables | ( | ) | const |
|
protected |
Definition at line 657 of file index.cpp.
Referenced by getDimensionVars().
void MicroModelica::IR::Range::applyUsage | ( | Index | usage | ) |
Definition at line 694 of file index.cpp.
References _ranges, ModelTable< Key, Value >::begin(), ModelTable< Key, Value >::end(), ModelTable< Key, Value >::insert(), ModelTable< Key, Value >::key(), and ModelTable< Key, Value >::next().
Referenced by MicroModelica::IR::JacGenerator::init().
string MicroModelica::IR::Range::block | ( | int | dim = -1 | ) | const |
Definition at line 672 of file index.cpp.
Referenced by getDimensionVar().
|
protected |
Definition at line 810 of file index.cpp.
References isVariable(), and pos().
|
protected |
|
inline |
Definition at line 177 of file index.hpp.
Referenced by update(), and MicroModelica::IR::VariableUsage::VariableUsage().
int MicroModelica::IR::Range::dim | ( | ) | const |
Definition at line 906 of file index.cpp.
Referenced by addRangeLocalVariables(), and addRangeVariables().
string MicroModelica::IR::Range::end | ( | ) | const |
Definition at line 559 of file index.cpp.
Referenced by getExp(), and testExpression().
|
protected |
|
protected |
void MicroModelica::IR::Range::generate | ( | SB::Set | set, |
int | offset, | ||
std::vector< std::string > | vars, | ||
std::vector< Expression > | begin_exps = std::vector< Expression >() , |
||
std::vector< Expression > | end_exps = std::vector< Expression >() |
||
) |
Referenced by Range().
|
protected |
string MicroModelica::IR::Range::getDimensionVar | ( | int | i, |
bool | range = false |
||
) | const |
Definition at line 546 of file index.cpp.
References block().
Referenced by addLocalVariables(), getIndexes(), and in().
vector< string > MicroModelica::IR::Range::getDimensionVars | ( | bool | range = false | ) | const |
Definition at line 536 of file index.cpp.
References addRangeVariables().
Referenced by MicroModelica::IR::JacGenerator::guard(), and MicroModelica::IR::JacGenerator::init().
string MicroModelica::IR::Range::getDimensionVarsString | ( | bool | range = false | ) | const |
|
protected |
Definition at line 425 of file index.cpp.
References MicroModelica::Util::Error::add(), MicroModelica::IR::RangeDefinition::begin(), EM_IR, EM_UNKNOWN_ODE, end(), MicroModelica::Util::ER_Error, MicroModelica::Util::Utils::instance(), MicroModelica::Util::Error::instance(), isVariable(), MicroModelica::Util::Utils::iteratorVar(), pos(), MicroModelica::IR::RangeDefinition::step(), and updateRangeDefinition().
vector< string > MicroModelica::IR::Range::getIndexes | ( | ) | const |
Definition at line 622 of file index.cpp.
References MicroModelica::Util::ModelConfig::addLocalSymbol(), getDimensionVar(), MicroModelica::Util::ModelConfig::instance(), and ModelTable< Key, Value >::key().
Referenced by replace().
vector< string > MicroModelica::IR::Range::getInitValues | ( | ) | const |
Definition at line 609 of file index.cpp.
References indexes(), and ModelTable< Key, Value >::key().
string MicroModelica::IR::Range::getPrintDimensionVarsString | ( | ) | const |
string MicroModelica::IR::Range::in | ( | ExpressionList | exps | ) |
Definition at line 765 of file index.cpp.
References getDimensionVar(), and size().
Referenced by MicroModelica::IR::JacGenerator::dependencyPrologue(), and testExpression().
std::string MicroModelica::IR::Range::in | ( | std::vector< std::string > | exps | ) |
string MicroModelica::IR::Range::indexes | ( | ) | const |
Definition at line 598 of file index.cpp.
Referenced by getInitValues().
map< std::string, AST_Expression > MicroModelica::IR::Range::initExps | ( | ) |
bool MicroModelica::IR::Range::intersect | ( | Range | other | ) |
bool MicroModelica::IR::Range::isDimensionVar | ( | std::string | var | ) |
bool MicroModelica::IR::Range::isEmpty | ( | ) | const |
Definition at line 797 of file index.cpp.
References ModelTable< Key, Value >::insert().
|
protected |
Definition at line 414 of file index.cpp.
Referenced by checkRangeVariable(), and getExp().
string MicroModelica::IR::Range::iterator | ( | int | dim, |
bool | range_idx = false |
||
) |
std::string MicroModelica::IR::Range::iterator | ( | std::string | var, |
int | dim, | ||
bool | range_idx = false |
||
) |
int MicroModelica::IR::Range::pos | ( | std::string | var | ) |
Definition at line 685 of file index.cpp.
Referenced by checkRangeVariable(), getExp(), Range(), and testExpression().
string MicroModelica::IR::Range::print | ( | bool | range = false , |
bool | c_index = false , |
||
bool | convert_params = false |
||
) | const |
Definition at line 843 of file index.cpp.
References getIndexes().
|
private |
int MicroModelica::IR::Range::size | ( | ) | const |
Definition at line 795 of file index.cpp.
References _ranges.
Referenced by addRangeVariables(), in(), and testExpression().
|
protected |
Definition at line 325 of file index.cpp.
References AST_ListAt(), AST_ListFirst(), current_element, end(), in(), pos(), and size().
void MicroModelica::IR::Range::update | ( | int | offset | ) |
Definition at line 710 of file index.cpp.
References _ranges, ModelTable< Key, Value >::begin(), MicroModelica::IR::RangeDefinition::begin(), definition(), ModelTable< Key, Value >::end(), ModelTable< Key, Value >::insert(), ModelTable< Key, Value >::key(), ModelTable< Key, Value >::next(), and ModelTable< Key, Value >::size().
|
protected |
Definition at line 313 of file index.cpp.
References MicroModelica::Util::Error::add(), EM_IR, EM_VARIABLE_NOT_FOUND, MicroModelica::Util::ER_Error, and MicroModelica::Util::Error::instance().
Referenced by getExp().
|
friend |
|
private |
|
private |
Definition at line 230 of file index.hpp.
Referenced by applyUsage(), MicroModelica::IR::RangeDefinition::cBegin(), Range(), size(), and update().
|
private |
Definition at line 234 of file index.hpp.
Referenced by addRangeLocalVariables().
|
private |