Skip to content

Commit

Permalink
Fix array storage order in FMI export, ticket:4072
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranke committed Oct 15, 2016
1 parent d314f5c commit 4f6ee12
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -12569,26 +12569,26 @@ end getVariableIndex;
public function getValueReference
"returns the value reference of a variable for direct memory access
considering aliases and array storage order
author: rfranke"
author: rfranke and mwalther and vwaurich and sjoelund"
input SimCodeVar.SimVar inSimVar;
input SimCode.SimCode inSimCode;
input Boolean inElimNegAliases;
output String valueReference;
protected
DAE.ComponentRef cref;
algorithm
if Config.simCodeTarget()=="Cpp" then
valueReference := getVarIndexByMapping(inSimCode.varToArrayIndexMapping, inSimVar.name, false, "-1");
if Config.simCodeTarget() == "Cpp" then
valueReference := getVarIndexByMapping(inSimCode.varToArrayIndexMapping, inSimVar.name, true, "-1");
if stringEqual(valueReference, "-1") then
Error.addInternalError("invalid return value from getVarIndexByMapping for "+simVarString(inSimVar), sourceInfo());
end if;
return;
else
valueReference := match inSimVar
case SimCodeVar.SIMVAR(aliasvar = SimCodeVar.ALIAS(varName = cref))
then getDefaultValueReference(SimCodeFunctionUtil.cref2simvar(cref, inSimCode), inSimCode.modelInfo.varInfo);
else getDefaultValueReference(inSimVar, inSimCode.modelInfo.varInfo);
end match;
end if;
valueReference := match inSimVar
case SimCodeVar.SIMVAR(aliasvar = SimCodeVar.ALIAS(varName = cref))
then getDefaultValueReference(SimCodeFunctionUtil.cref2simvar(cref, inSimCode), inSimCode.modelInfo.varInfo);
else getDefaultValueReference(inSimVar, inSimCode.modelInfo.varInfo);
end match;
end getValueReference;

protected function getDefaultValueReference
Expand Down

0 comments on commit 4f6ee12

Please sign in to comment.