Skip to content

Commit 33422b4

Browse files
committed
- remove makro ZEROCROSSING
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20522 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent abb1ad9 commit 33422b4

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

Compiler/Template/CodegenC.tpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,21 +2950,21 @@ template zeroCrossingTpl(Integer index1, Exp relation, Text &varDecls /*BUFP*/)
29502950
let e1 = daeExp(exp, contextZeroCross, &preExp /*BUFC*/, &varDecls /*BUFD*/)
29512951
<<
29522952
<%preExp%>
2953-
ZEROCROSSING(<%index1%>, (<%e1%>)?1:-1);
2953+
gout[<%index1%>] = (<%e1%>) ? 1 : -1;
29542954
>>
29552955
case (exp1 as LBINARY(__)) then
29562956
let &preExp = buffer "" /*BUFD*/
29572957
let e1 = daeExp(exp1, contextZeroCross, &preExp /*BUFC*/, &varDecls /*BUFD*/)
29582958
<<
29592959
<%preExp%>
2960-
ZEROCROSSING(<%index1%>, (<%e1%>)?1:-1);
2960+
gout[<%index1%>] = (<%e1%>) ? 1 : -1;
29612961
>>
29622962
case (exp1 as LUNARY(__)) then
29632963
let &preExp = buffer "" /*BUFD*/
29642964
let e1 = daeExp(exp1, contextZeroCross, &preExp /*BUFC*/, &varDecls /*BUFD*/)
29652965
<<
29662966
<%preExp%>
2967-
ZEROCROSSING(<%index1%>, <%e1%>?1:-1);
2967+
gout[<%index1%>] = (<%e1%>) ? 1 : -1;
29682968
>>
29692969
case CALL(path=IDENT(name="sample"), expLst={_, start, interval}) then
29702970
<< >>
@@ -2974,23 +2974,23 @@ template zeroCrossingTpl(Integer index1, Exp relation, Text &varDecls /*BUFP*/)
29742974
let indx = daeExp(idx, contextZeroCross, &preExp /*BUFC*/, &varDecls /*BUFD*/)
29752975
<<
29762976
<%preExp%>
2977-
ZEROCROSSING(<%index1%>, (floor(<%e1%>) != floor(data->simulationInfo.mathEventsValuePre[<%indx%>]))?1:-1);
2977+
gout[<%index1%>] = (floor(<%e1%>) != floor(data->simulationInfo.mathEventsValuePre[<%indx%>])) ? 1 : -1;
29782978
>>
29792979
case CALL(path=IDENT(name="floor"), expLst={exp1, idx}) then
29802980
let &preExp = buffer "" /*BUFD*/
29812981
let e1 = daeExp(exp1, contextZeroCross, &preExp /*BUFC*/, &varDecls /*BUFD*/)
29822982
let indx = daeExp(idx, contextZeroCross, &preExp /*BUFC*/, &varDecls /*BUFD*/)
29832983
<<
29842984
<%preExp%>
2985-
ZEROCROSSING(<%index1%>, (floor(<%e1%>) != floor(data->simulationInfo.mathEventsValuePre[<%indx%>]))?1:-1);
2985+
gout[<%index1%>] = (floor(<%e1%>) != floor(data->simulationInfo.mathEventsValuePre[<%indx%>])) ? 1 : -1;
29862986
>>
29872987
case CALL(path=IDENT(name="ceil"), expLst={exp1, idx}) then
29882988
let &preExp = buffer "" /*BUFD*/
29892989
let e1 = daeExp(exp1, contextZeroCross, &preExp /*BUFC*/, &varDecls /*BUFD*/)
29902990
let indx = daeExp(idx, contextZeroCross, &preExp /*BUFC*/, &varDecls /*BUFD*/)
29912991
<<
29922992
<%preExp%>
2993-
ZEROCROSSING(<%index1%>, (ceil(<%e1%>) != ceil(data->simulationInfo.mathEventsValuePre[<%indx%>]))?1:-1);
2993+
gout[<%index1%>] = (ceil(<%e1%>) != ceil(data->simulationInfo.mathEventsValuePre[<%indx%>])) ? 1 : -1;
29942994
>>
29952995
case CALL(path=IDENT(name="div"), expLst={exp1, exp2, idx}) then
29962996
let &preExp = buffer "" /*BUFD*/
@@ -2999,7 +2999,7 @@ template zeroCrossingTpl(Integer index1, Exp relation, Text &varDecls /*BUFP*/)
29992999
let indx = daeExp(idx, contextZeroCross, &preExp /*BUFC*/, &varDecls /*BUFD*/)
30003000
<<
30013001
<%preExp%>
3002-
ZEROCROSSING(<%index1%>, (trunc(<%e1%>/<%e2%>) != trunc(data->simulationInfo.mathEventsValuePre[<%indx%>]/data->simulationInfo.mathEventsValuePre[<%indx%>+1]))?1:-1);
3002+
gout[<%index1%>] = (trunc(<%e1%>/<%e2%>) != trunc(data->simulationInfo.mathEventsValuePre[<%indx%>]/data->simulationInfo.mathEventsValuePre[<%indx%>+1])) ? 1 : -1;
30033003
>>
30043004
else
30053005
error(sourceInfo(), ' UNKNOWN ZERO CROSSING for <%index1%>')

SimulationRuntime/c/simulation/solver/model_help.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ extern "C" {
3636

3737
#include "simulation_data.h"
3838

39-
#define ZEROCROSSING(ind,exp) { \
40-
gout[ind] = exp; \
41-
}
42-
4339
#define RELATION(res,exp1,exp2,index,op_w) { \
4440
if(data->simulationInfo.discreteCall == 0){ \
4541
res = data->simulationInfo.relationsPre[index]; \

0 commit comments

Comments
 (0)