Skip to content

Commit 5856a42

Browse files
author
Jens Frenkel
committed
- missing function from last commit
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14182 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 60bef9f commit 5856a42

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

Compiler/BackEnd/BackendEquation.mo

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,73 @@ algorithm
15511551
end matchcontinue;
15521552
end equationRemove;
15531553

1554+
public function compressEquations
1555+
" function: compressEquations
1556+
autor: Frenkel TUD 2012-11
1557+
Closes the gabs "
1558+
input BackendDAE.EquationArray inEquationArray;
1559+
output BackendDAE.EquationArray outEquationArray;
1560+
algorithm
1561+
outEquationArray := matchcontinue(inEquationArray)
1562+
local
1563+
Integer size,numberOfElement,arrSize;
1564+
array<Option<BackendDAE.Equation>> equOptArr;
1565+
case BackendDAE.EQUATION_ARRAY(size=size,numberOfElement=numberOfElement,arrSize=arrSize,equOptArr=equOptArr)
1566+
equation
1567+
numberOfElement = compressEquations1(1,1,numberOfElement,equOptArr);
1568+
then
1569+
BackendDAE.EQUATION_ARRAY(size,numberOfElement,arrSize,equOptArr);
1570+
else
1571+
equation
1572+
print("BackendEquation.compressEquations failed\n");
1573+
then
1574+
fail();
1575+
end matchcontinue;
1576+
end compressEquations;
1577+
1578+
protected function compressEquations1
1579+
" function: compressEquations1
1580+
autor: Frenkel TUD 2012-11"
1581+
input Integer index;
1582+
input Integer insertindex;
1583+
input Integer numberOfElement;
1584+
input array<Option<BackendDAE.Equation>> equOptArr;
1585+
output Integer newnumberOfElement;
1586+
algorithm
1587+
newnumberOfElement := matchcontinue(index,insertindex,numberOfElement,equOptArr)
1588+
local
1589+
BackendDAE.Equation eqn;
1590+
// found element
1591+
case(_,_,_,_)
1592+
equation
1593+
true = intLe(index,numberOfElement);
1594+
SOME(eqn) = equOptArr[index];
1595+
// insert on new pos
1596+
_ = arrayUpdate(equOptArr,insertindex,SOME(eqn));
1597+
then
1598+
compressEquations1(index+1,insertindex+1,numberOfElement,equOptArr);
1599+
// found non element
1600+
case(_,_,_,_)
1601+
equation
1602+
true = intLe(index,numberOfElement);
1603+
NONE() = equOptArr[index];
1604+
then
1605+
compressEquations1(index+1,insertindex,numberOfElement,equOptArr);
1606+
// at the end
1607+
case(_,_,_,_)
1608+
equation
1609+
false = intLe(index,numberOfElement);
1610+
then
1611+
insertindex-1;
1612+
else
1613+
equation
1614+
print("BackendEquation.compressEquations1 failed\n");
1615+
then
1616+
fail();
1617+
end matchcontinue;
1618+
end compressEquations1;
1619+
1620+
15541621
public function equationToScalarResidualForm "function: equationToScalarResidualForm
15551622
author: Frenkel TUD 2012-06
15561623
This function transforms an equation to its scalar residual form.
@@ -1893,6 +1960,13 @@ algorithm
18931960
BackendDAE.EQSYSTEM(orderedEqs = eqnarr) := syst;
18941961
end daeEqns;
18951962

1963+
public function daeInitialEqns
1964+
input BackendDAE.Shared shared;
1965+
output BackendDAE.EquationArray eqnarr;
1966+
algorithm
1967+
BackendDAE.SHARED(initialEqs = eqnarr) := shared;
1968+
end daeInitialEqns;
1969+
18961970
public function aliasEquation
18971971
"function aliasEquation
18981972
autor Frenkel TUD 2011-04

0 commit comments

Comments
 (0)