@@ -6538,7 +6538,7 @@ algorithm
65386538 BackendDAE . DAE (systs,shared ) := dae;
65396539 (systs,shared ) := List . map1Fold(systs,func ,a,shared );
65406540 // Filter out empty systems
6541- // systs := List.select (systs,nonEmptySystem );
6541+ systs := filterEmptySystems (systs);
65426542 odae := BackendDAE . DAE (systs,shared );
65436543end mapEqSystem1;
65446544
@@ -6566,7 +6566,7 @@ algorithm
65666566 BackendDAE . DAE (systs,shared ) := dae;
65676567 (systs,(shared ,extra)) := List . map1Fold(systs,func ,a,(shared ,initialExtra));
65686568 // Filter out empty systems
6569- // systs := List.select (systs,nonEmptySystem );
6569+ systs := filterEmptySystems (systs);
65706570 odae := BackendDAE . DAE (systs,shared );
65716571end mapEqSystemAndFold1;
65726572
@@ -6591,7 +6591,7 @@ algorithm
65916591 BackendDAE . DAE (systs,shared ) := dae;
65926592 (systs,(shared ,extra)) := List . mapFold(systs,func ,(shared ,initialExtra));
65936593 // Filter out empty systems
6594- // systs := List.select (systs,nonEmptySystem );
6594+ systs := filterEmptySystems (systs);
65956595 odae := BackendDAE . DAE (systs,shared );
65966596end mapEqSystemAndFold;
65976597
@@ -6615,7 +6615,7 @@ algorithm
66156615 BackendDAE . DAE (systs,shared ) := dae;
66166616 extra := List . fold1(systs,func ,shared ,initialExtra);
66176617 // Filter out empty systems
6618- // systs := List.select (systs,nonEmptySystem );
6618+ systs := filterEmptySystems (systs);
66196619end foldEqSystem;
66206620
66216621public function mapEqSystem
@@ -6636,7 +6636,7 @@ algorithm
66366636 BackendDAE . DAE (systs,shared ) := dae;
66376637 (systs,shared ) := List . mapFold(systs,func ,shared );
66386638 // Filter out empty systems
6639- // systs := List.select (systs,nonEmptySystem );
6639+ systs := filterEmptySystems (systs);
66406640 odae := BackendDAE . DAE (systs,shared );
66416641end mapEqSystem;
66426642
@@ -6664,4 +6664,26 @@ algorithm
66646664 end match;
66656665end setEqSystemMatching;
66666666
6667+ public function filterEmptySystems
6668+ "Filter out equation systems leaving at least one behind"
6669+ input BackendDAE . EqSystems systs;
6670+ output BackendDAE . EqSystems osysts;
6671+ algorithm
6672+ osysts := filterEmptySystems2(List . select(systs,nonEmptySystem),systs);
6673+ end filterEmptySystems;
6674+
6675+ protected function filterEmptySystems2
6676+ "Filter out equation systems leaving at least one behind"
6677+ input BackendDAE . EqSystems systs;
6678+ input BackendDAE . EqSystems full;
6679+ output BackendDAE . EqSystems olst;
6680+ algorithm
6681+ olst := match (systs,full)
6682+ local
6683+ BackendDAE . EqSystem syst;
6684+ case ({},syst::_) then {syst};
6685+ else systs;
6686+ end match;
6687+ end filterEmptySystems2;
6688+
66676689end BackendDAEUtil ;
0 commit comments