Skip to content

Commit

Permalink
- remove unused code
Browse files Browse the repository at this point in the history
- improve warnings (+d=initialization)


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16454 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Jun 23, 2013
1 parent 17f1f14 commit cf9a88a
Show file tree
Hide file tree
Showing 5 changed files with 322 additions and 251 deletions.
11 changes: 4 additions & 7 deletions Compiler/BackEnd/BackendDAEEXT.mo
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,8 @@ end getF;
see: http://bmi.osu.edu/~kamer/index.html
*****************************************/

public function setIncidenceMatrix
"function: setIncidenceMatrix
author: Frenkel TUD 2012-04
"
public function setIncidenceMatrix "function setIncidenceMatrix
author: Frenkel TUD 2012-04"
input Integer nv;
input Integer ne;
input Integer nz;
Expand Down Expand Up @@ -273,12 +271,11 @@ public function matching
external "C" BackendDAEEXT_matching(nv,ne,matchingID,cheapID,relabel_period,clear_match) annotation(Library = "omcruntime");
end matching;

public function getAssignment
"function: getAssignment
public function getAssignment "function getAssignment
author: Frenkel TUD 2012-04"
input array<Integer> ass1;
input array<Integer> ass2;
external "C" BackendDAEEXT_getAssignment(ass1,ass2) annotation(Library = "omcruntime");
external "C" BackendDAEEXT_getAssignment(ass1, ass2) annotation(Library = "omcruntime");
end getAssignment;

public function setAssignment
Expand Down
20 changes: 10 additions & 10 deletions Compiler/BackEnd/BackendDump.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2363,18 +2363,18 @@ protected
String path_str;
algorithm
BackendDAE.VAR(varName = cr,
varKind = kind,
varDirection = dir,
varType = var_type,
arryDim = arrayDim,
bindExp = bindExp,
source = source,
values = dae_var_attr,
comment = comment,
connectorType = ct) := inVar;
varKind = kind,
varDirection = dir,
varType = var_type,
arryDim = arrayDim,
bindExp = bindExp,
source = source,
values = dae_var_attr,
comment = comment,
connectorType = ct) := inVar;
paths := DAEUtil.getElementSourceTypes(source);
paths_lst := List.map(paths, Absyn.pathString);
outStr := DAEDump.dumpDirectionStr(dir) +& " " +& ComponentReference.printComponentRefStr(cr) +& ":"
outStr := DAEDump.dumpDirectionStr(dir) +& ComponentReference.printComponentRefStr(cr) +& ":"
+& kindString(kind) +& "(" +& connectorTypeString(ct) +& attributesString(dae_var_attr)
+& ") " +& optExpressionString(bindExp,"") +& DAEDump.dumpCommentAnnotationStr(comment)
+& stringDelimitList(paths_lst, ", ") +& " type: " +& dumpTypeStr(var_type) +& ComponentReference.printComponentRef2Str("", arrayDim);
Expand Down
230 changes: 134 additions & 96 deletions Compiler/BackEnd/BackendVariable.mo
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ algorithm
end matchcontinue;
end varFixed;

public function setVarStartValue
"function: setVarStartValue
public function setVarStartValue "function setVarStartValue
author: Frenkel TUD
Sets the start value attribute of a variable."
input BackendDAE.Var inVar;
Expand Down Expand Up @@ -314,8 +313,7 @@ algorithm
end match;
end setVarStartValueOption;

public function setVarStartOrigin
"function: setVarStartOrigin
public function setVarStartOrigin "function setVarStartOrigin
author: Frenkel TUD
Sets the startOrigin attribute of a variable."
input BackendDAE.Var inVar;
Expand Down Expand Up @@ -374,10 +372,9 @@ algorithm
end match;
end setVarStartOrigin;

public function setVarAttributes
"sets the variable attributes of a variable.
author: Peter Aronsson (paronsson@wolfram.com)
"
public function setVarAttributes "function setVarAttributes
sets the variable attributes of a variable.
author: Peter Aronsson (paronsson@wolfram.com)"
input BackendDAE.Var v;
input Option<DAE.VariableAttributes> attr;
output BackendDAE.Var outV;
Expand Down Expand Up @@ -542,8 +539,7 @@ algorithm
end matchcontinue;
end varStateSelect;

public function setVarStateSelect
"function setVarStateSelect
public function setVarStateSelect "function setVarStateSelect
author: Frenkel TUD
sets the state select attribute of a variable."
input BackendDAE.Var inVar;
Expand Down Expand Up @@ -627,8 +623,7 @@ algorithm
end match;
end varHasStateDerivative;

public function setStateDerivative
"function setStateDerivative
public function setStateDerivative "function setStateDerivative
author: Frenkel TUD
sets the state derivative."
input BackendDAE.Var inVar;
Expand Down Expand Up @@ -686,8 +681,7 @@ algorithm
end match;
end getVariableAttributefromType;

public function setVarFinal
"function: setVarFinal
public function setVarFinal "function setVarFinal
author: Frenkel TUD
Sets the final attribute of a variable."
input BackendDAE.Var inVar;
Expand Down Expand Up @@ -745,8 +739,7 @@ algorithm
end match;
end setVarFinal;

public function setVarMinMax
"function: setVarMinMax
public function setVarMinMax "function setVarMinMax
author: Frenkel TUD
Sets the minmax attribute of a variable."
input BackendDAE.Var inVar;
Expand Down Expand Up @@ -817,8 +810,7 @@ algorithm
end match;
end varNominalValue;

public function setVarNominalValue
"function: setVarNominalValue
public function setVarNominalValue "function setVarNominalValue
author: Frenkel TUD
Sets the nominal value attribute of a variable."
input BackendDAE.Var inVar;
Expand Down Expand Up @@ -891,11 +883,9 @@ algorithm
end match;
end varType;

public function varKind "function: varKind
public function varKind "function varKind
author: PA

extracts the kind of a variable.
"
extracts the kind of a variable."
input BackendDAE.Var inVar;
output BackendDAE.VarKind outVarKind;
algorithm
Expand Down Expand Up @@ -1693,42 +1683,37 @@ algorithm
NONE(),DAE.NON_CONNECTOR());
end createDummyVar;

public function copyVarNewName
"function copyVarNewName
public function copyVarNewName "function copyVarNewName
author: Frenkel TUD 2012-5
Create variable with new name as cref from other var."
input DAE.ComponentRef cr;
input BackendDAE.Var inVar;
output BackendDAE.Var outVar;
algorithm
outVar := match (cr,inVar)
local
BackendDAE.VarKind kind;
DAE.VarDirection dir;
DAE.VarParallelism prl;
BackendDAE.Type tp;
Option<DAE.Exp> bind;
Option<Values.Value> v;
list<DAE.Subscript> dim;
DAE.ElementSource source;
Option<DAE.VariableAttributes> attr;
Option<SCode.Comment> comment;
DAE.ConnectorType ct;

case (_,BackendDAE.VAR(varKind = kind,
varDirection = dir,
varParallelism = prl,
varType = tp,
bindExp = bind,
bindValue = v,
arryDim = dim,
source = source,
values = attr,
comment = comment,
connectorType = ct))
then
BackendDAE.VAR(cr,kind,dir,prl,tp,bind,v,dim,source,attr,comment,ct);
end match;
protected
BackendDAE.VarKind kind;
DAE.VarDirection dir;
DAE.VarParallelism prl;
BackendDAE.Type tp;
Option<DAE.Exp> bind;
Option<Values.Value> v;
list<DAE.Subscript> dim;
DAE.ElementSource source;
Option<DAE.VariableAttributes> attr;
Option<SCode.Comment> comment;
DAE.ConnectorType ct;
algorithm
BackendDAE.VAR(varKind = kind,
varDirection = dir,
varParallelism = prl,
varType = tp,
bindExp = bind,
bindValue = v,
arryDim = dim,
source = source,
values = attr,
comment = comment,
connectorType = ct) := inVar;
outVar := BackendDAE.VAR(cr, kind, dir, prl, tp, bind, v, dim, source, attr, comment, ct);
end copyVarNewName;

public function setVarsKind "function: setVarsKind
Expand All @@ -1747,44 +1732,100 @@ public function setVarKind "function setVarKind
input BackendDAE.Var inVar;
input BackendDAE.VarKind inVarKind;
output BackendDAE.Var outVar;
algorithm
outVar := match (inVar,inVarKind)
local
DAE.ComponentRef cr;
BackendDAE.VarKind kind,new_kind;
DAE.VarDirection dir;
DAE.VarParallelism prl;
BackendDAE.Type tp;
Option<DAE.Exp> bind;
Option<Values.Value> v;
list<DAE.Subscript> dim;
DAE.ElementSource source;
Option<DAE.VariableAttributes> attr;
Option<SCode.Comment> comment;
DAE.ConnectorType ct;
BackendDAE.Var oVar;

case (BackendDAE.VAR(varName = cr,
varKind = kind,
varDirection = dir,
varParallelism = prl,
varType = tp,
bindExp = bind,
bindValue = v,
arryDim = dim,
source = source,
values = attr,
comment = comment,
connectorType = ct),new_kind)
equation
oVar = BackendDAE.VAR(cr,new_kind,dir,prl,tp,bind,v,dim,source,attr,comment,ct); // referenceUpdate(inVar, 2, new_kind);
then
oVar;
end match;
protected
DAE.ComponentRef cr;
DAE.VarDirection dir;
DAE.VarParallelism prl;
BackendDAE.Type tp;
Option<DAE.Exp> bind;
Option<Values.Value> v;
list<DAE.Subscript> dim;
DAE.ElementSource source;
Option<DAE.VariableAttributes> attr;
Option<SCode.Comment> comment;
DAE.ConnectorType ct;
BackendDAE.Var oVar;
algorithm
BackendDAE.VAR(varName = cr,
varDirection = dir,
varParallelism = prl,
varType = tp,
bindExp = bind,
bindValue = v,
arryDim = dim,
source = source,
values = attr,
comment = comment,
connectorType = ct) := inVar;
outVar := BackendDAE.VAR(cr, inVarKind, dir, prl, tp, bind, v, dim, source, attr, comment, ct);
// referenceUpdate(inVar, 2, new_kind);
end setVarKind;

public function setBindExp
"function setBindExp
public function removeBindExp "function removeBindExp
author: lochel"
input BackendDAE.Var inVar;
output BackendDAE.Var outVar;
protected
DAE.ComponentRef cr;
BackendDAE.VarKind varKind;
DAE.VarDirection dir;
DAE.VarParallelism prl;
BackendDAE.Type tp;
Option<Values.Value> v;
list<DAE.Subscript> dim;
DAE.ElementSource source;
Option<DAE.VariableAttributes> attr;
Option<SCode.Comment> comment;
DAE.ConnectorType ct;
BackendDAE.Var oVar;
algorithm
BackendDAE.VAR(varName = cr,
varKind = varKind,
varDirection = dir,
varParallelism = prl,
varType = tp,
bindValue = v,
arryDim = dim,
source = source,
values = attr,
comment = comment,
connectorType = ct) := inVar;
outVar := BackendDAE.VAR(cr, varKind, dir, prl, tp, NONE(), v, dim, source, attr, comment, ct);
end removeBindExp;

public function removeBindValue "function removeBindValue
author: lochel"
input BackendDAE.Var inVar;
output BackendDAE.Var outVar;
protected
DAE.ComponentRef cr;
BackendDAE.VarKind varKind;
DAE.VarDirection dir;
DAE.VarParallelism prl;
BackendDAE.Type tp;
Option<DAE.Exp> bindExp;
list<DAE.Subscript> dim;
DAE.ElementSource source;
Option<DAE.VariableAttributes> attr;
Option<SCode.Comment> comment;
DAE.ConnectorType ct;
BackendDAE.Var oVar;
algorithm
BackendDAE.VAR(varName = cr,
varKind = varKind,
varDirection = dir,
varParallelism = prl,
varType = tp,
bindExp = bindExp,
arryDim = dim,
source = source,
values = attr,
comment = comment,
connectorType = ct) := inVar;
outVar := BackendDAE.VAR(cr, varKind, dir, prl, tp, bindExp, NONE(), dim, source, attr, comment, ct);
end removeBindValue;

public function setBindExp "function setBindExp
author: Frenkel TUD 2010-12
Sets the BackendDAE.Var.bindExp of a variable"
input BackendDAE.Var inVar;
Expand Down Expand Up @@ -2710,9 +2751,7 @@ algorithm
end matchcontinue;
end isVariable;

public function isVarKindVariable
"function: isVarKindVariable

public function isVarKindVariable "function isVarKindVariable
This function takes a DAE.ComponentRef and two Variables. It searches
the two sets of variables and succeed if the variable is STATE or
VARIABLE. Otherwise it fails.
Expand All @@ -2734,8 +2773,7 @@ algorithm
end match;
end isVarKindVariable;

public function isTopLevelInputOrOutput
"function isTopLevelInputOrOutput
public function isTopLevelInputOrOutput "function isTopLevelInputOrOutput
author: LP

This function checks if the provided cr is from a var that is on top model
Expand Down Expand Up @@ -4345,8 +4383,8 @@ algorithm
end matchcontinue;
end mergeStartFixed;

protected function startValueType
"author: Frenkel TUD 2012-10
protected function startValueType "function startValueType
author: Frenkel TUD 2012-10
return the start value or the default value in case of NONE()"
input Option<DAE.Exp> iExp;
input DAE.Type iTy;
Expand Down

0 comments on commit cf9a88a

Please sign in to comment.