Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
Disable equation aliasing for C++ runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Apr 13, 2018
1 parent 53af8ff commit 20e6c2d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
27 changes: 17 additions & 10 deletions Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -563,19 +563,26 @@ algorithm

(crefToClockIndexHT, _) := List.fold(listReverse(inBackendDAE.eqs), collectClockedVars, (HashTable.emptyHashTable(), 1));

execStat("simCode: some other stuff during SimCode phase");

reasonableSize := Util.nextPrime(10+2*listLength(allEquations));
eqCache := HashTableSimCodeEqCache.emptyHashTableSized(reasonableSize);

(allEquations, eqCache) := aliasSimEqs(allEquations, eqCache);
(odeEquations, eqCache) := aliasSimEqSystems(odeEquations, eqCache);
(algebraicEquations, eqCache) := aliasSimEqSystems(algebraicEquations, eqCache);
(initialEquations, eqCache) := aliasSimEqs(initialEquations, eqCache);
(initialEquations_lambda0, eqCache) := aliasSimEqs(initialEquations_lambda0, eqCache);
(removedEquations, eqCache) := aliasSimEqs(removedEquations, eqCache);
(removedInitialEquations, eqCache) := aliasSimEqs(removedInitialEquations, eqCache);
(algorithmAndEquationAsserts, eqCache) := aliasSimEqs(algorithmAndEquationAsserts, eqCache);
(jacobianEquations, eqCache) := aliasSimEqs(jacobianEquations, eqCache);
(parameterEquations, eqCache) := aliasSimEqs(parameterEquations, eqCache);
if Config.simCodeTarget() <> "Cpp" then
// Alias equations to other equations.
// The C++ codegen does things differently and will not handle this
(allEquations, eqCache) := aliasSimEqs(allEquations, eqCache);
(odeEquations, eqCache) := aliasSimEqSystems(odeEquations, eqCache);
(algebraicEquations, eqCache) := aliasSimEqSystems(algebraicEquations, eqCache);
(initialEquations, eqCache) := aliasSimEqs(initialEquations, eqCache);
(initialEquations_lambda0, eqCache) := aliasSimEqs(initialEquations_lambda0, eqCache);
(removedEquations, eqCache) := aliasSimEqs(removedEquations, eqCache);
(removedInitialEquations, eqCache) := aliasSimEqs(removedInitialEquations, eqCache);
(algorithmAndEquationAsserts, eqCache) := aliasSimEqs(algorithmAndEquationAsserts, eqCache);
(jacobianEquations, eqCache) := aliasSimEqs(jacobianEquations, eqCache);
(parameterEquations, eqCache) := aliasSimEqs(parameterEquations, eqCache);
execStat("simCode: alias equations");
end if;

simCode := SimCode.SIMCODE(modelInfo,
{}, // Set by the traversal below...
Expand Down
4 changes: 2 additions & 2 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -9823,7 +9823,7 @@ template equationString(SimEqSystem eq, Context context, Text &varDecls, SimCode
IF EQUATIONS ARE NOT IMPLEMENTED
>>
else
"NOT IMPLEMENTED EQUATION 2"
error(sourceInfo(),"NOT IMPLEMENTED EQUATION 2")
end equationString;

template equation_function_call(SimEqSystem eq, Context context, Text &varDecls, SimCode simCode ,Text& extraFuncs,Text& extraFuncsDecl,Text extraFuncsNamespace,Text method)
Expand Down Expand Up @@ -9879,7 +9879,7 @@ template equation_function_create_single_func(SimEqSystem eq, Context context, S
then
equationForLoop(e, context, &varDeclsLocal,simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
else
"NOT IMPLEMENTED EQUATION"
error(sourceInfo(),"NOT IMPLEMENTED EQUATION")
end match
let &measureTimeStartVar += if createMeasureTime then generateMeasureTimeStartCode("measuredProfileBlockStartValues", 'evaluate<%ix_str%>', "MEASURETIME_PROFILEBLOCKS") else ""
let &measureTimeEndVar += if createMeasureTime then generateMeasureTimeEndCode("measuredProfileBlockStartValues", "measuredProfileBlockEndValues", '(*measureTimeProfileBlocksArray)[<%ix_str_array%>]', 'evaluate<%ix_str%>', "MEASURETIME_PROFILEBLOCKS") else ""
Expand Down

0 comments on commit 20e6c2d

Please sign in to comment.