@@ -377,7 +377,7 @@ algorithm
377377 name := Expression . reductionIterName(iter);
378378 cr := ComponentReference . makeCrefIdent(name,DAE . T_INTEGER_DEFAULT ,{});
379379 backendVar := BackendDAE . VAR (cr,BackendDAE . VARIABLE (),DAE . BIDIR (),DAE . NON_PARALLEL (),DAE . T_INTEGER_DEFAULT ,NONE (),NONE (),{},
380- DAE . emptyElementSource,NONE (),NONE (),DAE . NON_CONNECTOR ());
380+ DAE . emptyElementSource,NONE (),NONE (),NONE (), DAE . NON_CONNECTOR ());
381381end makeIterVariable;
382382
383383protected function checkEquationSize"author: Frenkel TUD 2010-12
@@ -924,6 +924,7 @@ algorithm
924924 DAE . InstDims dims;
925925 DAE . ElementSource src;
926926 Option < DAE . VariableAttributes > va;
927+ Option < BackendDAE . TearingSelect > ts;
927928 Option < SCode . Comment > c;
928929 DAE . ConnectorType ct;
929930 Values . Value v;
@@ -936,7 +937,7 @@ algorithm
936937 inVar;
937938 case BackendDAE . VAR (varName = cr, varKind = vk, varDirection = vd, varParallelism = prl,
938939 varType = ty, bindExp = SOME (e), arryDim = dims, source = src,
939- values = va, comment = c, connectorType = ct)
940+ values = va, tearingSelectOption = ts, comment = c, connectorType = ct)
940941 equation
941942 // wbraun: Evaluate parameter expressions only if they are
942943 // constant at compile time otherwise we solve them
@@ -945,7 +946,7 @@ algorithm
945946 true = Expression . isConst(e);
946947 (_, v, _) = Ceval . ceval(cache, graph, e, false , NONE (), Absyn . NO_MSG (),0 );
947948 then
948- BackendDAE . VAR (cr, vk, vd, prl, ty, SOME (e), SOME (v), dims, src, va, c, ct);
949+ BackendDAE . VAR (cr, vk, vd, prl, ty, SOME (e), SOME (v), dims, src, va, ts, c, ct);
949950 else inVar;
950951 end matchcontinue;
951952end calculateValue;
@@ -1633,6 +1634,32 @@ algorithm
16331634end simplifySubscript;
16341635
16351636
1637+ public function setTearingSelectAttribute
1638+ input Option < SCode . Comment > comment;
1639+ output Option < BackendDAE . TearingSelect > ts;
1640+ protected
1641+ SCode . Annotation ann;
1642+ Absyn . Exp val;
1643+ String ts_str;
1644+ algorithm
1645+ try
1646+ SOME (SCode . COMMENT (annotation_ = SOME (ann))) := comment;
1647+ val := SCode . getNamedAnnotation(ann, "tearingSelect" );
1648+ ts_str := Absyn . crefIdent(Absyn . expCref(val));
1649+ ts := match(ts_str)
1650+ case "always" then SOME (BackendDAE . ALWAYS ());
1651+ case "prefer" then SOME (BackendDAE . PREFER ());
1652+ case "avoid" then SOME (BackendDAE . AVOID ());
1653+ case "never" then SOME (BackendDAE . NEVER ());
1654+ case "default" then SOME (BackendDAE . DEFAULT ());
1655+ else NONE ();
1656+ end match;
1657+ else
1658+ ts := NONE ();
1659+ end try ;
1660+ end setTearingSelectAttribute;
1661+
1662+
16361663/** *****************************************
16371664 Functions that deals with BackendDAE as input
16381665********************************************/
@@ -6371,6 +6398,7 @@ algorithm
63716398 DAE . ComponentRef cref;
63726399 list< DAE . Dimension > instdims;
63736400 Option < DAE . VariableAttributes > attr;
6401+ Option < BackendDAE . TearingSelect > ts;
63746402 Type_a ext_arg_1,ext_arg_2;
63756403 VarKind varKind;
63766404 DAE . VarDirection varDirection;
@@ -6383,18 +6411,18 @@ algorithm
63836411
63846412 case (NONE (),_,_) then (NONE (),inTypeA);
63856413
6386- case (SOME (BackendDAE . VAR (cref,varKind,varDirection,varParallelism,varType,SOME (e1),bindValue,instdims,source,attr,comment,ct)),_,_)
6414+ case (SOME (BackendDAE . VAR (cref,varKind,varDirection,varParallelism,varType,SOME (e1),bindValue,instdims,source,attr,ts, comment,ct)),_,_)
63876415 equation
63886416 (e1,ext_arg_1) = func (e1,inTypeA);
63896417 (attr,ext_arg_2) = traverseBackendDAEVarAttr(attr,func ,ext_arg_1);
63906418 then
6391- (SOME (BackendDAE . VAR (cref,varKind,varDirection,varParallelism,varType,SOME (e1),bindValue,instdims,source,attr,comment,ct)),ext_arg_2);
6419+ (SOME (BackendDAE . VAR (cref,varKind,varDirection,varParallelism,varType,SOME (e1),bindValue,instdims,source,attr,ts, comment,ct)),ext_arg_2);
63926420
6393- case (SOME (BackendDAE . VAR (cref,varKind,varDirection,varParallelism,varType,NONE (),bindValue,instdims,source,attr,comment,ct)),_,_)
6421+ case (SOME (BackendDAE . VAR (cref,varKind,varDirection,varParallelism,varType,NONE (),bindValue,instdims,source,attr,ts, comment,ct)),_,_)
63946422 equation
63956423 (attr,ext_arg_2) = traverseBackendDAEVarAttr(attr,func ,inTypeA);
63966424 then
6397- (SOME (BackendDAE . VAR (cref,varKind,varDirection,varParallelism,varType,NONE (),bindValue,instdims,source,attr,comment,ct)),ext_arg_2);
6425+ (SOME (BackendDAE . VAR (cref,varKind,varDirection,varParallelism,varType,NONE (),bindValue,instdims,source,attr,ts, comment,ct)),ext_arg_2);
63986426
63996427 else
64006428 equation
0 commit comments