Skip to content

Commit

Permalink
- handle also array crefs in reinit
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13231 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Oct 7, 2012
1 parent c0eedd2 commit 34227bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Compiler/Template/CodegenC.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -983,12 +983,17 @@ template functionWhenReinitStatementThen(list<WhenOperator> reinits, Text &varDe
case REINIT(__) then
let &preExp = buffer "" /*BUFD*/
let val = daeExp(value, contextSimulationDiscrete, &preExp /*BUFC*/, &varDecls /*BUFD*/)
let lhs = match crefLastType(stateVar)
case DAE.T_ARRAY(__) then
'copy_real_array_data_mem(&<%val%>, &<%cref(stateVar)%>);'
else
'<%cref(stateVar)%> = <%val%>;'
<<
if (DEBUG_FLAG(LOG_EVENTS)) {
INFO1("reinit <%cref(stateVar)%> = %f", <%val%>);
}
<%preExp%>
<%cref(stateVar)%> = <%val%>;
<%lhs%>
data->simulationInfo.needToIterate = 1;
>>
case TERMINATE(__) then
Expand Down

0 comments on commit 34227bd

Please sign in to comment.