From 8b160f9d2a68561e1c5534669838a28e55b97dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Franke?= Date: Wed, 26 Sep 2018 21:28:45 +0200 Subject: [PATCH] Let simple array equations pass the backend, ticket:5110 if -d=-nfScalarize - adapt equation count - turn error from strongComponentsScalar to warning Belonging to [master]: - OpenModelica/OMCompiler#2679 --- Compiler/BackEnd/BackendDAETransform.mo | 9 +++++++-- Compiler/BackEnd/BackendEquation.mo | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Compiler/BackEnd/BackendDAETransform.mo b/Compiler/BackEnd/BackendDAETransform.mo index 65f9f828de..c941605362 100644 --- a/Compiler/BackEnd/BackendDAETransform.mo +++ b/Compiler/BackEnd/BackendDAETransform.mo @@ -104,8 +104,13 @@ algorithm then (syst, comps); else algorithm - Error.addInternalError("function strongComponentsScalar failed (sorting strong components)", sourceInfo()); - then fail(); + if Flags.isSet(Flags.NF_SCALARIZE) then + Error.addInternalError("function strongComponentsScalar failed (sorting strong components)", sourceInfo()); + fail(); + else + Error.addCompilerWarning("BackendDAETransform.strongComponentsScalar failed (sorting strong components)"); + end if; + then (inSystem, {}); end matchcontinue; end strongComponentsScalar; diff --git a/Compiler/BackEnd/BackendEquation.mo b/Compiler/BackEnd/BackendEquation.mo index 371b15f1e0..8d99525c97 100644 --- a/Compiler/BackEnd/BackendEquation.mo +++ b/Compiler/BackEnd/BackendEquation.mo @@ -188,11 +188,17 @@ public function equationArraySize "author: lochel should correspond to the number of variables." input BackendDAE.EquationArray equationArray; output Integer outSize; +protected + Boolean nfScalarize = Flags.isSet(Flags.NF_SCALARIZE); algorithm outSize := 0; for i in 1:ExpandableArray.getLastUsedIndex(equationArray) loop if ExpandableArray.occupied(i, equationArray) then - outSize := outSize + equationSize(ExpandableArray.get(i, equationArray)); + if nfScalarize then + outSize := outSize + equationSize(ExpandableArray.get(i, equationArray)); + else + outSize := outSize + 1; + end if; end if; end for; end equationArraySize;