Skip to content

Commit

Permalink
- BackEnd refactoring: Grouped the common fields in the DAE into a si…
Browse files Browse the repository at this point in the history
…ngle uniontype to ease sending only these to functions without tuples, multiple inputs, etc

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9655 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Aug 18, 2011
1 parent f79a088 commit 4bbd594
Show file tree
Hide file tree
Showing 15 changed files with 231 additions and 212 deletions.
12 changes: 9 additions & 3 deletions Compiler/BackEnd/BackendDAE.mo
Expand Up @@ -227,6 +227,13 @@ uniontype BackendDAE "THE LOWERED DAE consist of variables and equations. The va
- BackendDAE"
record DAE
EqSystems eqs;
Shared shared;
end DAE;

end BackendDAE;

uniontype Shared "Data shared for all equation-systems"
record SHARED
Variables knownVars "knownVars ; Known variables, i.e. constants and parameters" ;
Variables externalObjects "External object variables";
AliasVariables aliasVars "mappings of alias-variables to real-variables"; // added asodja 2010-03-03
Expand All @@ -235,9 +242,8 @@ uniontype BackendDAE "THE LOWERED DAE consist of variables and equations. The va
array< .DAE.Algorithm> algorithms "algorithms ; Algorithms" ;
EventInfo eventInfo "eventInfo" ;
ExternalObjectClasses extObjClasses "classes of external objects, contains constructor & destructor";
end DAE;

end BackendDAE;
end SHARED;
end Shared;

type EqSystems = list<EqSystem> "NOTE: BackEnd does not yet support lists with different size than 1 everywhere (anywhere)";

Expand Down
12 changes: 6 additions & 6 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -135,7 +135,7 @@ algorithm
algarr := listArray(algs);
einfo := Inline.inlineEventInfo(BackendDAE.EVENT_INFO(whenclauses_1,{}),(SOME(functionTree),{DAE.NORM_INLINE()}));
aliasVars := BackendDAEUtil.emptyAliasVariables();
outBackendDAE := BackendDAE.DAE(BackendDAE.EQSYSTEM(vars_1,eqnarr,ieqnarr)::{},knvars,extVars,aliasVars,reqnarr,arr_md_eqns,algarr,einfo,extObjCls);
outBackendDAE := BackendDAE.DAE(BackendDAE.EQSYSTEM(vars_1,eqnarr,ieqnarr)::{},BackendDAE.SHARED(knvars,extVars,aliasVars,reqnarr,arr_md_eqns,algarr,einfo,extObjCls));
BackendDAEUtil.checkBackendDAEWithErrorMsg(outBackendDAE);
end lower;

Expand Down Expand Up @@ -2591,14 +2591,14 @@ algorithm
array<DAE.Algorithm> algorithms,algorithms1;
BackendDAE.EventInfo einfo;
BackendDAE.ExternalObjectClasses eoc;
case (BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns,inieqns)::{},knvars,exobj,av,remeqns,arreqns,algorithms,einfo,eoc),funcs,m,mT)
case (BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns,inieqns)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns,algorithms,einfo,eoc)),funcs,m,mT)
equation
(eqns1,(vars1,_)) = BackendEquation.traverseBackendDAEEqnsWithUpdate(eqns,traverserexpandDerEquation,(vars,funcs));
(inieqns1,(vars2,_)) = BackendEquation.traverseBackendDAEEqnsWithUpdate(inieqns,traverserexpandDerEquation,(vars1,funcs));
(arreqns1,(vars3,_)) = BackendDAEUtil.traverseBackendDAEArrayNoCopyWithUpdate(arreqns,traverserexpandDerExp,BackendEquation.traverseBackendDAEExpsArrayEqnWithUpdate,1,arrayLength(arreqns),(vars2,funcs));
(algorithms1,(vars4,_)) = BackendDAEUtil.traverseBackendDAEArrayNoCopyWithUpdate(algorithms,traverserexpandDerExp,BackendEquation.traverseBackendDAEExpsAlgortihmWithUpdate,1,arrayLength(algorithms),(vars3,funcs));
then
(BackendDAE.DAE(BackendDAE.EQSYSTEM(vars4,eqns1,inieqns1)::{},knvars,exobj,av,remeqns,arreqns1,algorithms1,einfo,eoc),m,mT);
(BackendDAE.DAE(BackendDAE.EQSYSTEM(vars4,eqns1,inieqns1)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns1,algorithms1,einfo,eoc)),m,mT);
end match;
end expandDerOperator;

Expand Down Expand Up @@ -2904,7 +2904,7 @@ algorithm
list<DAE.Algorithm> algs_lst,algs_lst1;
list<BackendDAE.ZeroCrossing> zero_crossings;
BackendDAE.EqSystems eqs;
case (BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns,inieqns)::{},knvars,exobj,av,remeqns,arreqns,algorithms,einfo as BackendDAE.EVENT_INFO(whenClauseLst=whenclauses),eoc))
case (BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns,inieqns)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns,algorithms,einfo as BackendDAE.EVENT_INFO(whenClauseLst=whenclauses),eoc)))
equation
eqs_lst = BackendDAEUtil.equationList(eqns);
arreqns_lst = arrayList(arreqns);
Expand All @@ -2915,7 +2915,7 @@ algorithm
algorithms1 = listArray(algs_lst1);
einfo1 = BackendDAE.EVENT_INFO(whenclauses1,zero_crossings);
then
(BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns1,inieqns)::{},knvars,exobj,av,remeqns,arreqns1,algorithms1,einfo1,eoc));
(BackendDAE.DAE(BackendDAE.EQSYSTEM(vars,eqns1,inieqns)::{},BackendDAE.SHARED(knvars,exobj,av,remeqns,arreqns1,algorithms1,einfo1,eoc)));
end match;
end findZeroCrossings;

Expand Down Expand Up @@ -3589,7 +3589,7 @@ algorithm
list<list<Integer>> zcEqns;
list<Integer> wcEqns;
BackendDAE.EquationArray eqnArr;
case (BackendDAE.DAE(eventInfo=BackendDAE.EVENT_INFO(zeroCrossingLst = zcLst),eqs=BackendDAE.EQSYSTEM(orderedEqs=eqnArr)::{}))
case (BackendDAE.DAE(shared=BackendDAE.SHARED(eventInfo=BackendDAE.EVENT_INFO(zeroCrossingLst = zcLst)),eqs=BackendDAE.EQSYSTEM(orderedEqs=eqnArr)::{}))
equation
zcEqns = Util.listMap(zcLst,zeroCrossingEquations);
wcEqns = whenEquationsIndices(eqnArr);
Expand Down

0 comments on commit 4bbd594

Please sign in to comment.