Skip to content

Commit 17bf815

Browse files
committed
Small cleanup
1 parent 9027e88 commit 17bf815

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

Compiler/Template/CodegenCpp.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6256,6 +6256,8 @@ case SIMCODE(modelInfo = MODELINFO(__)) then
62566256
return jacobian_system->getJacobian(<%index%>);
62576257
// cout << "A Matrix for system " << <%index%> << A_matrix << std::endl;
62586258
}
6259+
else
6260+
throw ModelicaSimulationError(MATH_FUNCTION, "System matrix not available");
62596261
>>
62606262
case ("sparse") then
62616263
'throw ModelicaSimulationError(MATH_FUNCTION,"Dense matrix is not activated");'

Compiler/Template/CodegenCppCommon.tpl

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,6 @@ template crefToCStr(ComponentRef cr, Boolean useFlatArrayNotation)
319319
else "CREF_NOT_IDENT_OR_QUAL"
320320
end crefToCStr;
321321

322-
template representationCrefDerVar(ComponentRef inCref, SimCode simCode ,Text& extraFuncs,Text& extraFuncsDecl,Text extraFuncsNamespace, Context context, Text stateDerVectorName /*=__zDot */) ::=
323-
cref2simvar(inCref, simCode ) |> SIMVAR(__) =>'<%stateDerVectorName%>[<%index%>]'
324-
end representationCrefDerVar;
325-
326322
template daeExpCrefRhs(Exp exp, Context context, Text &preExp, Text &varDecls, SimCode simCode, Text& extraFuncs,
327323
Text& extraFuncsDecl, Text extraFuncsNamespace, Text stateDerVectorName /*=__zDot*/, Boolean useFlatArrayNotation)
328324
"Generates code for a component reference on the right hand side of an
@@ -1759,16 +1755,9 @@ template daeExpCall(Exp call, Context context, Text &preExp /*BUFP*/, Text &varD
17591755
//let &preExp += 'division_alloc_<%type%>_scalar(&<%var1%>, <%var2%>, &<%var%>, "<%var3%>");<%\n%>'
17601756
'<%var%>'
17611757

1762-
17631758
case CALL(path=IDENT(name="der"), expLst={arg as CREF(__)}) then
1764-
representationCrefDerVar(arg.componentRef, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, context, stateDerVectorName)
1765-
case CALL(path=IDENT(name="pre"), expLst={arg as CREF(__)}) then
1766-
let retType = '<%expTypeArrayIf(arg.ty)%>'
1767-
let retVar = tempDecl(retType, &varDecls /*BUFD*/)
1768-
let cast = match arg.ty case T_INTEGER(__) then "(int)"
1769-
case T_ENUMERATION(__) then "(int)" //else ""
1770-
let &preExp += '<%retVar%> = <%cast%>pre(<%cref(arg.componentRef, useFlatArrayNotation)%>);<%\n%>'
1771-
'<%retVar%>'
1759+
let var = cref2simvar(arg.componentRef, simCode) |> SIMVAR(index=i) => '__zDot[<%i%>]'
1760+
'<%var%>'
17721761

17731762
case CALL(path=IDENT(name="print"), expLst={e1}) then
17741763
let var1 = daeExp(e1, context, &preExp, &varDecls, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)

0 commit comments

Comments
 (0)