MicroModelicaCCompiler  4.5.3
MicroModelica::IR::FunctionPrinter Class Reference

#include <helpers.hpp>

Public Member Functions

 ~FunctionPrinter ()=default
 
std::string loop (int end)
 
std::string endLoop ()
 
std::string beginSwitch ()
 
std::string endSwitch ()
 
std::string beginExpression (std::string token, Option< Range > range) const
 
std::string endExpression (Option< Range > range, FUNCTION_PRINTER::ReturnStatementType ret=FUNCTION_PRINTER::ReturnStatementType::Return) const
 
std::string jacobianTerms (list< Equation > eqs)
 
std::string getIndexes (string var, Option< Range > range, int offset, bool modelica_index) const
 
std::map< std::string, std::string > parseIndexes (string var, Option< Range > range, int offset, bool modelica_index=true) const
 
std::map< int, std::string > parseConstants (Expression ref) const
 
std::string beginDimGuards (std::string token, string args, Option< Range > range, std::multimap< std::string, int > used_variables) const
 
std::string endDimGuards (Option< Range > range) const
 
std::string printAlgebraicGuards (Equation alg, Index usage)
 
std::string accessMacros (std::string token, int offset, Option< Range > range, bool modelica_index=true) const
 TODO: Review modelica_index parameter usage. More...
 
std::string equationVariableMacros (Option< Range > range, Expression lhs, std::string id) const
 
std::string jacMacrosAccess (Equation eq, std::string index="row", std::string tab=TAB) const
 
std::string outputVariableName (Expression exp, Option< Range > range)
 
std::string algebraic (Equation alg, bool reduction)
 

Protected Attributes

map< std::string, std::string > _alg_dict
 

Private Member Functions

std::string mod (std::string var, int dim, Option< Range > range) const
 
std::string div (std::string var, int dim, Option< Range > range) const
 

Detailed Description

Definition at line 147 of file helpers.hpp.

Constructor & Destructor Documentation

◆ ~FunctionPrinter()

MicroModelica::IR::FunctionPrinter::~FunctionPrinter ( )
default

Member Function Documentation

◆ accessMacros()

string MicroModelica::IR::FunctionPrinter::accessMacros ( std::string  token,
int  offset,
Option< Range range,
bool  modelica_index = true 
) const

TODO: Review modelica_index parameter usage.

Definition at line 371 of file helpers.cpp.

Referenced by MicroModelica::Generator::Macros::initialize().

◆ algebraic()

string MicroModelica::IR::FunctionPrinter::algebraic ( Equation  alg,
bool  reduction 
)

Definition at line 288 of file helpers.cpp.

References parseIndexes(), and TAB.

Here is the call graph for this function:

◆ beginDimGuards()

string MicroModelica::IR::FunctionPrinter::beginDimGuards ( std::string  token,
string  args,
Option< Range range,
std::multimap< std::string, int >  used_variables 
) const

Definition at line 266 of file helpers.cpp.

◆ beginExpression()

string MicroModelica::IR::FunctionPrinter::beginExpression ( std::string  token,
Option< Range range 
) const

Definition at line 219 of file helpers.cpp.

◆ beginSwitch()

string MicroModelica::IR::FunctionPrinter::beginSwitch ( )

Definition at line 210 of file helpers.cpp.

◆ div()

string MicroModelica::IR::FunctionPrinter::div ( std::string  var,
int  dim,
Option< Range range 
) const
private

Definition at line 394 of file helpers.cpp.

References MicroModelica::IR::Expression::usage().

Here is the call graph for this function:

◆ endDimGuards()

string MicroModelica::IR::FunctionPrinter::endDimGuards ( Option< Range range) const

Definition at line 256 of file helpers.cpp.

◆ endExpression()

string MicroModelica::IR::FunctionPrinter::endExpression ( Option< Range range,
FUNCTION_PRINTER::ReturnStatementType  ret = FUNCTION_PRINTER::ReturnStatementType::Return 
) const

Definition at line 232 of file helpers.cpp.

References TAB.

◆ endLoop()

string MicroModelica::IR::FunctionPrinter::endLoop ( )

Definition at line 203 of file helpers.cpp.

References TAB.

◆ endSwitch()

string MicroModelica::IR::FunctionPrinter::endSwitch ( )

Definition at line 217 of file helpers.cpp.

◆ equationVariableMacros()

string MicroModelica::IR::FunctionPrinter::equationVariableMacros ( Option< Range range,
Expression  lhs,
std::string  id 
) const

Definition at line 421 of file helpers.cpp.

◆ getIndexes()

string MicroModelica::IR::FunctionPrinter::getIndexes ( string  var,
Option< Range range,
int  offset,
bool  modelica_index 
) const

Definition at line 303 of file helpers.cpp.

Referenced by printAlgebraicGuards().

◆ jacMacrosAccess()

string MicroModelica::IR::FunctionPrinter::jacMacrosAccess ( Equation  eq,
std::string  index = "row",
std::string  tab = TAB 
) const

◆ jacobianTerms()

std::string MicroModelica::IR::FunctionPrinter::jacobianTerms ( list< Equation eqs)

◆ loop()

string MicroModelica::IR::FunctionPrinter::loop ( int  end)

Definition at line 196 of file helpers.cpp.

◆ mod()

string MicroModelica::IR::FunctionPrinter::mod ( std::string  var,
int  dim,
Option< Range range 
) const
private

Definition at line 384 of file helpers.cpp.

References MicroModelica::IR::Expression::isReference(), and MicroModelica::IR::Expression::reference().

Here is the call graph for this function:

◆ outputVariableName()

string MicroModelica::IR::FunctionPrinter::outputVariableName ( Expression  exp,
Option< Range range 
)

Definition at line 401 of file helpers.cpp.

◆ parseConstants()

map< int, string > MicroModelica::IR::FunctionPrinter::parseConstants ( Expression  ref) const

Definition at line 315 of file helpers.cpp.

References ModelTable< Key, Value >::begin(), ModelTable< Key, Value >::end(), ModelTable< Key, Value >::next(), and ModelTable< Key, Value >::size().

Here is the call graph for this function:

◆ parseIndexes()

map< string, string > MicroModelica::IR::FunctionPrinter::parseIndexes ( string  var,
Option< Range range,
int  offset,
bool  modelica_index = true 
) const

Definition at line 330 of file helpers.cpp.

Referenced by algebraic().

◆ printAlgebraicGuards()

string MicroModelica::IR::FunctionPrinter::printAlgebraicGuards ( Equation  alg,
Index  usage 
)

Definition at line 357 of file helpers.cpp.

References getIndexes(), and TAB.

Here is the call graph for this function:

Member Data Documentation

◆ _alg_dict

map<std::string, std::string> MicroModelica::IR::FunctionPrinter::_alg_dict
protected

Definition at line 172 of file helpers.hpp.


The documentation for this class was generated from the following files: