@@ -2249,55 +2249,60 @@ public function dumpMarkedEqns
22492249 input BackendDAE . EqSystem syst;
22502250 input list< Integer > inIntegerLst;
22512251 output String outString;
2252+ protected
2253+ BackendDAE . EquationArray eqns;
2254+ list< Integer > sortedeqns;
22522255algorithm
2253- outString := match (syst,inIntegerLst)
2254- local
2255- String s1,s2,s3,res;
2256- Integer e_1,e;
2257- BackendDAE . Equation eqn;
2258- BackendDAE . EquationArray eqns;
2259- list< Integer > es;
2260- case (_,{}) then "" ;
2261- case (BackendDAE . EQSYSTEM (orderedEqs = eqns),(e :: es))
2262- equation
2263- s1 = dumpMarkedEqns(syst, es);
2264- e_1 = e - 1 ;
2265- eqn = BackendDAEUtil . equationNth(eqns, e_1);
2266- s2 = equationStr(eqn);
2267- s3 = intString(e);
2268- res = stringAppendList({s3,": " ,s2,"; \n " ,s1});
2269- then
2270- res;
2271- end match;
2256+ BackendDAE . EQSYSTEM (orderedEqs = eqns) := syst;
2257+ outString := List . fold1(inIntegerLst,dumpMarkedEqns1,eqns,"" );
22722258end dumpMarkedEqns;
22732259
2260+ protected function dumpMarkedEqns1
2261+ input Integer e;
2262+ input BackendDAE . EquationArray eqns;
2263+ input String inS;
2264+ output String outS;
2265+ protected
2266+ String s1,s2,s3;
2267+ Integer e_1;
2268+ BackendDAE . Equation eqn;
2269+ algorithm
2270+ e_1 := e - 1 ;
2271+ eqn := BackendDAEUtil . equationNth(eqns, e_1);
2272+ s2 := equationStr(eqn);
2273+ s3 := intString(e);
2274+ outS := stringAppendList({inS,s3,": " ,s2,"; \n " });
2275+ end dumpMarkedEqns1;
2276+
22742277public function dumpMarkedVars
22752278"Dumps only the variable names given as list of indexes to a string."
22762279 input BackendDAE . EqSystem syst;
22772280 input list< Integer > inIntegerLst;
22782281 output String outString;
2282+ protected
2283+ BackendDAE . Variables vars;
2284+ list< String > slst;
22792285algorithm
2280- outString:=
2281- match (syst,inIntegerLst)
2282- local
2283- String s1,s2,res,s3;
2284- Integer v;
2285- DAE . ComponentRef cr;
2286- BackendDAE . Variables vars;
2287- list< Integer > vs;
2288- case (_,{}) then "" ;
2289- case (BackendDAE . EQSYSTEM (orderedVars = vars),(v :: vs))
2290- equation
2291- s1 = dumpMarkedVars(syst, vs);
2292- BackendDAE . VAR (varName = cr) = BackendVariable . getVarAt(vars, v);
2293- s2 = ComponentReference . printComponentRefStr(cr);
2294- s3 = intString(v);
2295- res = stringAppendList({s2,"(" ,s3,"), " ,s1});
2296- then
2297- res;
2298- end match;
2286+ BackendDAE . EQSYSTEM (orderedVars = vars) := syst;
2287+ slst := List . map1(inIntegerLst,dumpMarkedVars1,vars);
2288+ outString := stringDelimitList(slst,", " );
22992289end dumpMarkedVars;
23002290
2291+ protected function dumpMarkedVars1
2292+ "Dumps only the variable names given as list of indexes to a string."
2293+ input Integer v;
2294+ input BackendDAE . Variables vars;
2295+ output String outS;
2296+ protected
2297+ String s1,s2,s3;
2298+ DAE . ComponentRef cr;
2299+ algorithm
2300+ BackendDAE . VAR (varName = cr) := BackendVariable . getVarAt(vars, v);
2301+ s2 := ComponentReference . printComponentRefStr(cr);
2302+ s3 := intString(v);
2303+ outS := stringAppendList({s2,"(" ,s3,")" });
2304+ end dumpMarkedVars1;
2305+
23012306public function dumpComponentsGraphStr
23022307"Dumps the assignment graph used to determine strong
23032308 components to format suitable for Mathematica"
0 commit comments