Skip to content

Commit

Permalink
- renamed DAEEXT.mo daeext.cpp to BackendDAEEXT.mo BackendDAEEXT.cpp.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7088 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 18, 2010
1 parent 0e44d32 commit f351665
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 80 deletions.
18 changes: 10 additions & 8 deletions Compiler/DAEEXT.mo → Compiler/BackendDAEEXT.mo
Expand Up @@ -29,13 +29,15 @@
*
*/

package DAEEXT
" file: DAEEXT.mo
package: DAEEXT
description: The DAEEXT module is an externally implemented module (in file runtime/daeext.cpp)
used for the BLT and index reduction algorithms in \'BackendDAE\'. The implementation
mainly consists of several bitvectors implemented using std::vector<bool> since
such functionality is not available in MetaModelica Compiler (MMC).
package BackendDAEEXT
" file: BackendDAEEXT.mo
package: BackendDAEEXT
description: The BackendDAEEXT module is an externally implemented module (in file
Compiler/runtime/BackendDAEEXT.cpp) used for the BLT and index reduction
algorithms in BackendDAE.
The implementation mainly consists of several bitvectors implemented
using std::vector<bool> since such functionality is not available in
MetaModelica Compiler (MMC).
RCS: $Id$
"
Expand Down Expand Up @@ -193,5 +195,5 @@ public function getF

external "C" ;
end getF;
end DAEEXT;
end BackendDAEEXT;

70 changes: 35 additions & 35 deletions Compiler/BackendDAETransform.mo
Expand Up @@ -54,7 +54,7 @@ protected import BackendDAEUtil;
protected import BackendEquation;
protected import BackendVariable;
protected import ComponentReference;
protected import DAEEXT;
protected import BackendDAEEXT;
protected import DAEUtil;
protected import Debug;
protected import Expression;
Expand Down Expand Up @@ -140,7 +140,7 @@ algorithm
(vec1,vec2,dae,m,mt);
case ((dae as BackendDAE.DAE(orderedVars = vars,orderedEqs = eqns)),m,mt,(match_opts as (_,_,BackendDAE.REMOVE_SIMPLE_EQN())),inFunctions)
equation
DAEEXT.clearDifferentiated();
BackendDAEEXT.clearDifferentiated();
checkMatching(dae, match_opts);
nvars = arrayLength(m);
neqns = arrayLength(mt);
Expand Down Expand Up @@ -469,15 +469,15 @@ algorithm
case (dae,m,mt,nv,nf,i,ass1,ass2,_,_,derivedAlgs,derivedMultiEqn)
equation
(nv == i) = true;
DAEEXT.initMarks(nv, nf);
BackendDAEEXT.initMarks(nv, nf);
(ass1_1,ass2_1) = pathFound(m, mt, i, ass1, ass2) "eMark(i)=vMark(i)=false; eMark(i)=vMark(i)=false exit loop";
then
(ass1_1,ass2_1,dae,m,mt,derivedAlgs,derivedMultiEqn);

case (dae,m,mt,nv,nf,i,ass1,ass2,match_opts,inFunctions,derivedAlgs,derivedMultiEqn)
equation
i_1 = i + 1;
DAEEXT.initMarks(nv, nf);
BackendDAEEXT.initMarks(nv, nf);
(ass1_1,ass2_1) = pathFound(m, mt, i, ass1, ass2) "eMark(i)=vMark(i)=false" ;
(ass1_2,ass2_2,dae,m,mt,derivedAlgs1,derivedMultiEqn1) = matchingAlgorithm2(dae, m, mt, nv, nf, i_1, ass1_1, ass2_1, match_opts, inFunctions,derivedAlgs,derivedMultiEqn);
then
Expand Down Expand Up @@ -514,8 +514,8 @@ algorithm

case (dae,m,mt,nv,nf,i,ass1,ass2,_,_,_,_)
equation
eqn_lst = DAEEXT.getMarkedEqns() "When index reduction also fails, the model is structurally singular." ;
var_lst = DAEEXT.getMarkedVariables();
eqn_lst = BackendDAEEXT.getMarkedEqns() "When index reduction also fails, the model is structurally singular." ;
var_lst = BackendDAEEXT.getMarkedVariables();
eqn_str = BackendDump.dumpMarkedEqns(dae, eqn_lst);
var_str = BackendDump.dumpMarkedVars(dae, var_lst);
Error.addMessage(Error.STRUCT_SINGULAR_SYSTEM, {eqn_str,var_str});
Expand Down Expand Up @@ -556,7 +556,7 @@ algorithm
BackendDAE.Value i;
case (m,mt,i,ass1,ass2)
equation
DAEEXT.eMark(i) "Side effect" ;
BackendDAEEXT.eMark(i) "Side effect" ;
(ass1_1,ass2_1) = assignOneInEqn(m, mt, i, ass1, ass2);
then
(ass1_1,ass2_1);
Expand Down Expand Up @@ -732,7 +732,7 @@ protected function isNotVMarked
This function succeds for variables that are not marked."
input Integer i;
algorithm
false := DAEEXT.getVMark(i);
false := BackendDAEEXT.getVMark(i);
end isNotVMarked;

protected function forallUnmarkedVarsInEqnBody
Expand Down Expand Up @@ -764,15 +764,15 @@ algorithm
list<BackendDAE.Value> vars,vs;
case (m,mt,i,(vars as (v :: vs)),ass1,ass2)
equation
DAEEXT.vMark(v);
BackendDAEEXT.vMark(v);
assarg = getAssigned(v, ass1, ass2);
(ass1_1,ass2_1) = pathFound(m, mt, assarg, ass1, ass2);
(ass1_2,ass2_2) = assign(v, i, ass1_1, ass2_1);
then
(ass1_2,ass2_2);
case (m,mt,i,(vars as (v :: vs)),ass1,ass2)
equation
DAEEXT.vMark(v);
BackendDAEEXT.vMark(v);
(ass1_1,ass2_1) = forallUnmarkedVarsInEqnBody(m, mt, i, vs, ass1, ass2);
then
(ass1_1,ass2_1);
Expand Down Expand Up @@ -810,8 +810,8 @@ algorithm
case (m,mt,ass1,ass2)
equation
n = arrayLength(m);
DAEEXT.initLowLink(n);
DAEEXT.initNumber(n);
BackendDAEEXT.initLowLink(n);
BackendDAEEXT.initNumber(n);
(i,stack,comps) = strongConnectMain(m, mt, ass1, ass2, n, 0, 1, {}, {});
then
comps;
Expand Down Expand Up @@ -870,15 +870,15 @@ algorithm
(i,stack,comp);
case (m,mt,a1,a2,n,i,w,stack,comps)
equation
0 = DAEEXT.getNumber(w);
0 = BackendDAEEXT.getNumber(w);
(i,stack_1,comps) = strongConnect(m, mt, a1, a2, i, w, stack, comps);
w_1 = w + 1;
(i,stack_2,comps) = strongConnectMain(m, mt, a1, a2, n, i, w_1, stack_1, comps);
then
(i,stack_2,comps);
case (m,mt,a1,a2,n,i,w,stack,comps)
equation
num = DAEEXT.getNumber(w);
num = BackendDAEEXT.getNumber(w);
(num == 0) = false;
w_1 = w + 1;
(i,stack_1,comps) = strongConnectMain(m, mt, a1, a2, n, i, w_1, stack, comps);
Expand Down Expand Up @@ -919,8 +919,8 @@ algorithm
case (m,mt,a1,a2,i,v,stack,comps)
equation
i_1 = i + 1;
DAEEXT.setNumber(v, i_1) ;
DAEEXT.setLowLink(v, i_1);
BackendDAEEXT.setNumber(v, i_1) ;
BackendDAEEXT.setLowLink(v, i_1);
stack_1 = (v :: stack);
eqns = reachableNodes(v, m, mt, a1, a2);
(i_1,stack_2,comps_1) = iterateReachableNodes(eqns, m, mt, a1, a2, i_1, v, stack_1, comps);
Expand Down Expand Up @@ -1037,24 +1037,24 @@ algorithm
array<BackendDAE.Value> a1,a2;
case ((w :: ws),m,mt,a1,a2,i,v,stack,comps)
equation
0 = DAEEXT.getNumber(w);
0 = BackendDAEEXT.getNumber(w);
(i,stack,comps_1) = strongConnect(m, mt, a1, a2, i, w, stack, comps);
lv = DAEEXT.getLowLink(v);
lw = DAEEXT.getLowLink(w);
lv = BackendDAEEXT.getLowLink(v);
lw = BackendDAEEXT.getLowLink(w);
minv = intMin(lv, lw);
DAEEXT.setLowLink(v, minv);
BackendDAEEXT.setLowLink(v, minv);
(i,stack,comps_2) = iterateReachableNodes(ws, m, mt, a1, a2, i, v, stack, comps_1);
then
(i,stack,comps_2);
case ((w :: ws),m,mt,a1,a2,i,v,stack,comps)
equation
nw = DAEEXT.getNumber(w);
nv = DAEEXT.getNumber(v);
nw = BackendDAEEXT.getNumber(w);
nv = BackendDAEEXT.getNumber(v);
(nw < nv) = true;
true = listMember(w, stack);
lowlinkv = DAEEXT.getLowLink(v);
lowlinkv = BackendDAEEXT.getLowLink(v);
minv = intMin(nw, lowlinkv);
DAEEXT.setLowLink(v, minv);
BackendDAEEXT.setLowLink(v, minv);
(i,stack,comps_1) = iterateReachableNodes(ws, m, mt, a1, a2, i, v, stack, comps);
then
(i,stack,comps_1);
Expand Down Expand Up @@ -1097,8 +1097,8 @@ algorithm
array<BackendDAE.Value> a1,a2;
case (m,mt,a1,a2,i,v,stack)
equation
lv = DAEEXT.getLowLink(v);
nv = DAEEXT.getNumber(v);
lv = BackendDAEEXT.getLowLink(v);
nv = BackendDAEEXT.getNumber(v);
(lv == nv) = true;
(i,stack_1,comps) = checkStack(m, mt, a1, a2, i, v, stack, {});
then
Expand Down Expand Up @@ -1137,8 +1137,8 @@ algorithm
array<BackendDAE.Value> a1,a2;
case (m,mt,a1,a2,i,v,(top :: rest),comp)
equation
topn = DAEEXT.getNumber(top);
vn = DAEEXT.getNumber(v);
topn = BackendDAEEXT.getNumber(top);
vn = BackendDAEEXT.getNumber(v);
(topn >= vn) = true;
(i,stack_1,comp_1) = checkStack(m, mt, a1, a2, i, v, rest, comp);
then
Expand Down Expand Up @@ -1198,10 +1198,10 @@ algorithm

case (dae,m,mt,nv,nf,i,inFunctions,derivedAlgs,derivedMultiEqn)
equation
eqns = DAEEXT.getMarkedEqns();
eqns = BackendDAEEXT.getMarkedEqns();
// print("marked equations:");print(Util.stringDelimitList(Util.listMap(eqns,intString),","));
// print("\n");
diff_eqns = DAEEXT.getDifferentiatedEqns();
diff_eqns = BackendDAEEXT.getDifferentiatedEqns();
eqns_1 = Util.listSetDifferenceOnTrue(eqns, diff_eqns, intEq);
// print("differentiating equations:");print(Util.stringDelimitList(Util.listMap(eqns_1,intString),","));
// print("\n");
Expand Down Expand Up @@ -1231,8 +1231,8 @@ algorithm

case (dae,m,mt,nv,nf,i,_,_,_)
equation
eqns = DAEEXT.getMarkedEqns();
diff_eqns = DAEEXT.getDifferentiatedEqns();
eqns = BackendDAEEXT.getMarkedEqns();
diff_eqns = BackendDAEEXT.getDifferentiatedEqns();
eqns_1 = Util.listSetDifferenceOnTrue(eqns, diff_eqns, intEq);
es = Util.listMap(eqns_1, intString);
es_1 = Util.stringDelimitList(es, ", ");
Expand All @@ -1243,7 +1243,7 @@ algorithm
print("differentiated equations:");
BackendDump.printEquations(diff_eqns,dae);
print("Variables :");
print(Util.stringDelimitList(Util.listMap(DAEEXT.getMarkedVariables(),intString),", "));
print(Util.stringDelimitList(Util.listMap(BackendDAEEXT.getMarkedVariables(),intString),", "));
print("\n");
then
fail();
Expand Down Expand Up @@ -2491,7 +2491,7 @@ algorithm
Debug.fprint("bltdump", "\n");
eqns_1 = BackendEquation.equationAdd(eqns, eqn_1);
leneqns = BackendDAEUtil.equationSize(eqns_1);
DAEEXT.markDifferentiated(e) "length gives index of new equation Mark equation as differentiated so it won\'t be differentiated again" ;
BackendDAEEXT.markDifferentiated(e) "length gives index of new equation Mark equation as differentiated so it won\'t be differentiated again" ;
(dae,m,mt,nv,nf,reqns,derivedAlgs1,derivedMultiEqn1) = differentiateEqns(BackendDAE.DAE(v,kv,ev,av,eqns_1,seqns,ie,ae1,al1,wc,eoc), m, mt, nv, nf, es, inFunctions,derivedAlgs,derivedMultiEqn);
then
(dae,m,mt,nv,nf,(leneqns :: (e :: reqns)),derivedAlgs1,derivedMultiEqn1);
Expand All @@ -2514,7 +2514,7 @@ algorithm
Debug.fprint("bltdump", str) " print \" to \" & print str & print \"\\n\" &" ;
Debug.fprint("bltdump", "\n");
leneqns = BackendDAEUtil.equationSize(eqns);
DAEEXT.markDifferentiated(e) "length gives index of new equation Mark equation as differentiated so it won\'t be differentiated again" ;
BackendDAEEXT.markDifferentiated(e) "length gives index of new equation Mark equation as differentiated so it won\'t be differentiated again" ;
(dae,m,mt,nv,nf,reqns,derivedAlgs1,derivedMultiEqn1) = differentiateEqns(BackendDAE.DAE(v,kv,ev,av,eqns,seqns,ie,ae1,al1,wc,eoc), m, mt, nv, nf, es, inFunctions,derivedAlgs,derivedMultiEqn);
then
(dae,m,mt,nv,nf,(e :: reqns),derivedAlgs1,derivedMultiEqn1);
Expand Down
4 changes: 2 additions & 2 deletions Compiler/BackendDump.mo
Expand Up @@ -47,7 +47,7 @@ protected import BackendDAEUtil;
protected import BackendVariable;
protected import BackendEquation;
protected import ComponentReference;
protected import DAEEXT;
protected import BackendDAEEXT;
protected import DAEDump;
protected import DAEUtil;
protected import Debug;
Expand Down Expand Up @@ -1329,7 +1329,7 @@ algorithm
case ({},_) then ();
case ((l :: lst),i)
equation
ni = DAEEXT.getLowLink(i);
ni = BackendDAEEXT.getLowLink(i);
print("{");
ls = Util.listMap(l, intString);
s = Util.stringDelimitList(ls, ", ");
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Makefile.common
Expand Up @@ -116,7 +116,7 @@ Dependency.mo \
IOStream.mo

# These are externally defined MO modules
ALLMO = $(SRCMO) DAEEXT.mo DynLoad.mo Print.mo RTOpts.mo System.mo Parser.mo \
ALLMO = $(SRCMO) BackendDAEEXT.mo DynLoad.mo Print.mo RTOpts.mo System.mo Parser.mo \
TaskGraphExt.mo Corba.mo Socket.mo ErrorExt.mo Settings.mo \
OptManager.mo UnitParserExt.mo SimulationResults.mo IOStreamExt.mo Database.mo

Expand Down
2 changes: 1 addition & 1 deletion Compiler/Makefile.common.w32
Expand Up @@ -78,7 +78,7 @@ SRCMO= Absyn.mo \
IOStream.mo

ALLMO = $(SRCMO) \
DAEEXT.mo \
BackendDAEEXT.mo \
Print.mo \
RTOpts.mo \
System.mo \
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Makefile.debug.w32
Expand Up @@ -45,7 +45,7 @@ ClassLoader.obj: ClassLoader.mo Absyn.sig Util.sig Print.sig System.sig Interact
Connect.obj: Connect.mo Static.sig Prefix.sig Exp.sig Env.sig DAE.sig Util.sig Types.sig Print.sig Absyn.sig Lookup.sig
Convert.obj: Convert.mo Values.sig Types.sig Util.sig Exp.sig DAE.sig Algorithm.sig Absyn.sig ClassInf.sig SCode.sig
DAE.obj: DAE.mo Values.sig Types.sig Exp.sig ClassInf.sig Algorithm.sig Absyn.sig Util.sig RTOpts.sig Print.sig Graphviz.sig ModUtil.sig SCode.sig Env.sig Dump.sig Debug.sig Ceval.sig Error.sig
DAELow.obj: DAELow.mo Values.sig Exp.sig DAE.sig Absyn.sig Algorithm.sig VarTransform.sig Util.sig System.sig Types.sig SCode.sig Print.sig RTOpts.sig Env.sig Error.sig Derive.sig DAEEXT.sig Debug.sig Builtin.sig Ceval.sig Dump.sig
DAELow.obj: DAELow.mo Values.sig Exp.sig DAE.sig Absyn.sig Algorithm.sig VarTransform.sig Util.sig System.sig Types.sig SCode.sig Print.sig RTOpts.sig Env.sig Error.sig Derive.sig BackendDAEEXT.sig Debug.sig Builtin.sig Ceval.sig Dump.sig
Derive.obj: Derive.mo Exp.sig Absyn.sig DAELow.sig Util.sig Debug.sig Error.sig
Debug.obj: Debug.mo Util.sig Print.sig RTOpts.sig
Dump.obj: Dump.mo Interactive.sig Absyn.sig Util.sig Print.sig Debug.sig
Expand Down
4 changes: 2 additions & 2 deletions Compiler/Makefile.w32
Expand Up @@ -54,7 +54,7 @@ ExpandableConnectors.obj: ExpandableConnectors.mo SCode.sig InstanceHierarchy.si
ConnectionGraph.obj: ConnectionGraph.mo Util.sig HashTableCG.sig DAEUtil.sig Connect.sig Absyn.sig DAE.sig System.sig Exp.sig Print.sig Debug.sig
Convert.obj: Convert.mo DAE.sig Absyn.sig
DAE.obj: DAE.mo Values.sig ClassInf.sig Absyn.sig SCode.sig
DAELow.obj: DAELow.mo VarTransform.sig Values.sig SCode.sig DAE.sig Absyn.sig Util.sig System.sig Print.sig Exp.sig OptManager.sig RTOpts.sig Env.sig Debug.sig Derive.sig DAEEXT.sig Ceval.sig ClassInf.sig DAEUtil.sig BackendVarTransform.sig Algorithm.sig Builtin.sig Error.sig
DAELow.obj: DAELow.mo VarTransform.sig Values.sig SCode.sig DAE.sig Absyn.sig Util.sig System.sig Print.sig Exp.sig OptManager.sig RTOpts.sig Env.sig Debug.sig Derive.sig BackendDAEEXT.sig Ceval.sig ClassInf.sig DAEUtil.sig BackendVarTransform.sig Algorithm.sig Builtin.sig Error.sig
DAEUtil.obj: DAEUtil.mo Values.sig SCode.sig Env.sig DAE.sig ClassInf.sig Absyn.sig ValuesUtil.sig Types.sig Util.sig RTOpts.sig ModUtil.sig Print.sig System.sig Exp.sig Dump.sig Error.sig Algorithm.sig Ceval.sig Debug.sig Graphviz.sig
Derive.obj: Derive.mo RTOpts.sig DAELow.sig DAEUtil.sig Absyn.sig DAE.sig Util.sig Exp.sig Debug.sig Error.sig
Debug.obj: Debug.mo Util.sig Print.sig RTOpts.sig
Expand Down Expand Up @@ -111,7 +111,7 @@ VarTransform.obj: VarTransform.mo SCode.sig HashTable2.sig DAE.sig HashTable3.si
BackendVarTransform.obj: BackendVarTransform.mo VarTransform.sig DAE.sig DAELow.sig Exp.sig Util.sig
Refactor.obj: Refactor.mo Absyn.sig Util.sig Interactive.sig Env.sig Inst.sig
DAEQuery.obj: DAEQuery.mo SCode.sig DAELow.sig Util.sig RTOpts.sig System.sig DAEUtil.sig Algorithm.sig Absyn.sig DAE.sig Exp.sig
XMLDump.obj: XMLDump.mo Values.sig Static.sig RTOpts.sig SCode.sig DAELow.sig DAE.sig Absyn.sig DAEEXT.sig Util.sig ModUtil.sig Print.sig Dump.sig DAEUtil.sig Algorithm.sig Exp.sig
XMLDump.obj: XMLDump.mo Values.sig Static.sig RTOpts.sig SCode.sig DAELow.sig DAE.sig Absyn.sig BackendDAEEXT.sig Util.sig ModUtil.sig Print.sig Dump.sig DAEUtil.sig Algorithm.sig Exp.sig
InstanceHierarchy.obj: InstanceHierarchy.mo SCode.sig Types.sig Absyn.sig Util.sig Dump.sig Debug.sig RTOpts.sig
InnerOuter.obj: InnerOuter.mo UnitAbsyn.sig SCode.sig Prefix.sig Env.sig DAE.sig ConnectionGraph.sig Connect.sig Absyn.sig VarTransform.sig System.sig Util.sig RTOpts.sig OptManager.sig Lookup.sig Mod.sig Exp.sig Inst.sig PrefixUtil.sig Error.sig Debug.sig Dump.sig ConnectUtil.sig DAEUtil.sig ErrorExt.sig
ConnectUtil.obj: ConnectUtil.mo Prefix.sig InnerOuter.sig Env.sig DAE.sig Connect.sig ConnectionGraph.sig Absyn.sig ClassInf.sig Util.sig Static.sig Print.sig Types.sig Exp.sig Lookup.sig Dump.sig Error.sig PrefixUtil.sig DAEUtil.sig Debug.sig
Expand Down
4 changes: 2 additions & 2 deletions Compiler/XMLDump.mo
Expand Up @@ -81,7 +81,7 @@ package XMLDump
public import Absyn;
public import BackendDAE;
public import DAE;
public import DAEEXT;
public import BackendDAEEXT;
public import Values;
public import SCode;
public import RTOpts;
Expand Down Expand Up @@ -804,7 +804,7 @@ algorithm
case ({},_) then ();
case ((l :: lst),i)
equation
ni = DAEEXT.getLowLink(i);
ni = BackendDAEEXT.getLowLink(i);
dumpStrOpenTagAttr(BLT_BLOCK, ID, intString(i));
dumpBltInvolvedEquations(l);
dumpStrCloseTag(BLT_BLOCK);
Expand Down

0 comments on commit f351665

Please sign in to comment.