Skip to content

Commit

Permalink
Janitor (#724)
Browse files Browse the repository at this point in the history
* remove unneeded spaces in dump
* clarify function parameter
  • Loading branch information
phannebohm committed Feb 8, 2020
1 parent eb5b013 commit adfa4e2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 35 deletions.
48 changes: 24 additions & 24 deletions OMCompiler/Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -4496,7 +4496,7 @@ algorithm
BackendDAE.SparseColoring sparseColoring;
list<list<Integer>> coloring;
BackendDAE.SparsePatternCrefs sparsepatternComRefs, sparsepatternComRefsT;
list<tuple<Integer, list<Integer>>> sparseInts, sparseIntsT;
SimCode.SparsityPattern sparseInts, sparseIntsT;

list<BackendDAE.EqSystem> systs;
BackendDAE.EqSystem syst;
Expand Down Expand Up @@ -4772,7 +4772,7 @@ algorithm

BackendDAE.SymbolicJacobians rest;
list<SimCode.JacobianMatrix> linearModelMatrices;
list<tuple<Integer, list<Integer>>> sparseInts, sparseIntsT;
SimCode.SparsityPattern sparseInts, sparseIntsT;
list<list<Integer>> coloring;
Option<BackendDAE.SymbolicJacobian> optionBDAE;

Expand Down Expand Up @@ -5177,7 +5177,7 @@ protected function sortSparsePattern
input list<SimCodeVar.SimVar> inSimVars;
input BackendDAE.SparsePatternCrefs inSparsePattern;
input Boolean useFMIIndex;
output list<tuple<Integer, list<Integer>>> outSparse = {};
output SimCode.SparsityPattern outSparse = {};
protected
HashTable.HashTable ht;
DAE.ComponentRef cref;
Expand Down Expand Up @@ -5252,7 +5252,7 @@ algorithm
end sortColoring;

protected function dumpSparsePatternInt
input list<tuple<Integer, list<Integer>>> sparsePattern;
input SimCode.SparsityPattern sparsePattern;
protected
Integer i;
list<Integer> lst;
Expand Down Expand Up @@ -5300,7 +5300,7 @@ algorithm
BackendDAE.SparseColoring sparseColoring;
list<list<Integer>> coloring;
BackendDAE.SparsePatternCrefs sparsepatternComRefs, sparsepatternComRefsT;
list<tuple<Integer, list<Integer>>> sparseInts, sparseIntsT;
SimCode.SparsityPattern sparseInts, sparseIntsT;

BackendDAE.EqSystem syst;
BackendDAE.Shared shared;
Expand Down Expand Up @@ -8781,13 +8781,13 @@ protected
list<Option<SimCode.JacobianMatrix>> jacObs;
algorithm
print("\n\n*********************\n* SimCode Equations *\n*********************\n\n");
print("\nallEquations: \n" + UNDERLINE + "\n\n");
print("\nallEquations:\n" + UNDERLINE + "\n\n");
dumpSimEqSystemLst(simCode.allEquations,"\n");
print(UNDERLINE + "\n\n\n");
print("\nodeEquations ("+intString(listLength(simCode.odeEquations))+" systems): \n" + UNDERLINE + "\n");
print("\nodeEquations ("+intString(listLength(simCode.odeEquations))+" systems):\n" + UNDERLINE + "\n");
List.map1_0(simCode.odeEquations,dumpSimEqSystemLst,"\n");
print(UNDERLINE + "\n\n\n");
print("\nalgebraicEquations ("+intString(listLength(simCode.algebraicEquations))+" systems): \n" + UNDERLINE + "\n");
print("\nalgebraicEquations ("+intString(listLength(simCode.algebraicEquations))+" systems):\n" + UNDERLINE + "\n");
List.map1_0(simCode.algebraicEquations,dumpSimEqSystemLst,"\n");
print(UNDERLINE + "\n\n\n");
print("clockPartitions ("+intString(listLength(simCode.clockedPartitions))+" systems):\n\n");
Expand All @@ -8802,31 +8802,31 @@ algorithm
print("\ninlineEquations: ("+intString(listLength(simCode.inlineEquations))+" systems)\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.inlineEquations,"\n");
end if;
print("\nremovedInitialEquations: \n" + UNDERLINE + "\n");
print("\nremovedInitialEquations:\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.removedInitialEquations,"\n");
print("\nstartValueEquations: \n" + UNDERLINE + "\n");
print("\nstartValueEquations:\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.startValueEquations,"\n");
print("\nnominalValueEquations: \n" + UNDERLINE + "\n");
print("\nnominalValueEquations:\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.nominalValueEquations,"\n");
print("\nminValueEquations: \n" + UNDERLINE + "\n");
print("\nminValueEquations:\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.minValueEquations,"\n");
print("\nmaxValueEquations: \n" + UNDERLINE + "\n");
print("\nmaxValueEquations:\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.maxValueEquations,"\n");
print("\nparameterEquations: \n" + UNDERLINE + "\n");
print("\nparameterEquations:\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.parameterEquations,"\n");
print("\nremovedEquations: \n" + UNDERLINE + "\n");
print("\nremovedEquations:\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.removedEquations,"\n");
print("\nalgorithmAndEquationAsserts: \n" + UNDERLINE + "\n");
print("\nalgorithmAndEquationAsserts:\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.algorithmAndEquationAsserts,"\n");
print("\nequationsForZeroCrossings: \n" + UNDERLINE + "\n");
print("\nequationsForZeroCrossings:\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.equationsForZeroCrossings,"\n");
print("\njacobianEquations: \n" + UNDERLINE + "\n");
print("\njacobianEquations:\n" + UNDERLINE + "\n");
dumpSimEqSystemLst(simCode.jacobianEquations,"\n");
extObjInfoString(simCode.extObjInfo);
print("\njacobianMatrices: \n" + UNDERLINE + "\n");
print("\njacobianMatrices:\n" + UNDERLINE + "\n");
jacObs := List.map(simCode.jacobianMatrixes,Util.makeOption);
List.map_0(jacObs,dumpJacobianMatrix);
print("\nmodelInfo: \n" + UNDERLINE + "\n");
print("\nmodelInfo:\n" + UNDERLINE + "\n");
dumpModelInfo(simCode.modelInfo);
dumpSimCodeDAEmodeDataString(simCode.daeModeData);
end dumpSimCodeDebug;
Expand Down Expand Up @@ -13092,7 +13092,7 @@ public function createFMIModelStructure
output Integer uniqueEqIndex = inUniqueEqIndex;
protected
BackendDAE.SparsePatternCrefs spTA, spTB;
list<tuple<Integer, list<Integer>>> sparseInts;
SimCode.SparsityPattern sparseInts;
list<SimCode.FmiUnknown> allUnknowns, derivatives, outputs, discreteStates, allInitialUnknowns;
list<SimCodeVar.SimVar> varsA, varsB, varsC, varsD, clockedStates, allOutputVars, allParamVars, initialUnknownsOutputVars, initialUnknownsCalculatedParameters, tmpInitialUnknowns, initialUnknownsStateVars, initialUnknownsDerivativeVars;
list<DAE.ComponentRef> diffCrefsA, diffedCrefsA, derdiffCrefsA;
Expand Down Expand Up @@ -13313,7 +13313,7 @@ protected
list<BackendDAE.Var> orderedVars, indepVars, depVars;
BackendDAE.SparsePattern sparsePattern;
BackendDAE.SparsePatternCrefs rowspt;
list<tuple<Integer, list<Integer>>> sparseInts;
SimCode.SparsityPattern sparseInts;
list<SimCodeVar.SimVar> vars1, vars2;
BackendDAE.Shared shared;
BackendDAE.EqSystem currentSystem;
Expand Down Expand Up @@ -13536,13 +13536,13 @@ end isFmiUnknown;

protected function translateSparsePatterInts2FMIUnknown
"function translates simVar integers to fmi unknowns."
input list<tuple<Integer, list<Integer>>> inSparsePattern;
input SimCode.SparsityPattern inSparsePattern;
input list<SimCode.FmiUnknown> inAccum;
output list<SimCode.FmiUnknown> outFmiUnknown;
algorithm
outFmiUnknown := match(inSparsePattern, inAccum)
local
list<tuple<Integer, list<Integer>>> rest;
SimCode.SparsityPattern rest;
Integer unknown;
list<Integer> dependencies;
list<String> dependenciesKind;
Expand Down
5 changes: 2 additions & 3 deletions OMCompiler/Compiler/Template/CodegenAdevs.tpl
Expand Up @@ -1573,7 +1573,7 @@ template jacobianColumnEqn(list<SimEqSystem> eqnSys, list<SimVar> eqnVars, Strin
>>
end jacobianColumnEqn;

template makeJacobianFunc(String matrixName, list<JacobianColumn> cols, list<SimVar> seedVars, list<tuple<Integer, list<Integer>>> sparsePattern, String modelName)
template makeJacobianFunc(String matrixName, list<JacobianColumn> cols, list<SimVar> seedVars, SparsityPattern sparsePattern, String modelName)
::=
if seedVars then
let varDecls = (seedVars |> var as SIMVAR(__) hasindex i0 =>
Expand Down Expand Up @@ -2025,7 +2025,7 @@ template functionHeaderImpl(String fname, list<Variable> fargs, list<Variable> o
::=
let &preExp = buffer "" /*BUFD*/
let &varDecls = buffer "" /*BUFD*/

let fargsStr = if boxed then
(fargs |> var => funArgBoxedDefinition(var) ;separator=", ")
else
Expand Down Expand Up @@ -5584,4 +5584,3 @@ end error;

annotation(__OpenModelica_Interface="backend");
end CodegenAdevs;

8 changes: 4 additions & 4 deletions OMCompiler/Compiler/Template/CodegenC.tpl
Expand Up @@ -2841,7 +2841,7 @@ template generateStaticEmptySparseData(String indexName, String systemType)
>>
end generateStaticEmptySparseData;
template generateStaticSparseData(String indexName, String systemType, list<tuple<Integer,list<Integer>>> sparsepattern, list<list<Integer>> colorList, Integer maxColor)
template generateStaticSparseData(String indexName, String systemType, SparsityPattern sparsepattern, list<list<Integer>> colorList, Integer maxColor)
"template generateStaticSparseData
This template generates source code for functions that initialize the sparse-pattern."
::=
Expand Down Expand Up @@ -4177,7 +4177,7 @@ template genVarIndexes(list<SimVar> vars, String arrayName)
end genVarIndexes;
template initializeDAEmodeData(Integer nResVars, list<SimVar> algVars, Integer nAuxVars, list<tuple<Integer,list<Integer>>> sparsepattern, list<list<Integer>> colorList, Integer maxColor, String modelNamePrefix)
template initializeDAEmodeData(Integer nResVars, list<SimVar> algVars, Integer nAuxVars, SparsityPattern sparsepattern, list<list<Integer>> colorList, Integer maxColor, String modelNamePrefix)
"Generates initialization function for daeMode."
::=
let nAlgVars = listLength(algVars)
Expand Down Expand Up @@ -5089,7 +5089,7 @@ template functionJac(list<SimEqSystem> jacEquations, list<SimEqSystem> constantE
end functionJac;

// function for sparsity pattern generation
template genSPCRSPtr(Integer sizeColPtr, list<tuple<Integer,list<Integer>>> sparsepattern, String constArrayName)
template genSPCRSPtr(Integer sizeColPtr, SparsityPattern sparsepattern, String constArrayName)
"This template generates colPtr of the CRS format"
::=
let colPtrindex = (sparsepattern |> (i, indexes) =>
Expand All @@ -5102,7 +5102,7 @@ template genSPCRSPtr(Integer sizeColPtr, list<tuple<Integer,list<Integer>>> spar
>>
end genSPCRSPtr;

template genSPCRSRows(Integer nonZeroElems, list<tuple<Integer,list<Integer>>> sparsepattern, String constArrayName)
template genSPCRSRows(Integer nonZeroElems, SparsityPattern sparsepattern, String constArrayName)
"This template generates row of the CRS format"
::=
let rowsIndex = ( sparsepattern |> (i, indexes) hasindex index0 =>
Expand Down
6 changes: 3 additions & 3 deletions OMCompiler/Compiler/Template/CodegenCpp.tpl
Expand Up @@ -12825,7 +12825,7 @@ template functionAnalyticJacobians2(list<JacobianMatrix> JacobianMatrixes,String
end functionAnalyticJacobians2;


template initialAnalyticJacobians2(list<JacobianColumn> jacobianColumn, list<SimVar> seedVars, String matrixname, list<tuple<Integer,list<Integer>>> sparsepattern, list<list<Integer>> colorList, Integer maxColor, String modelNamePrefix)
template initialAnalyticJacobians2(list<JacobianColumn> jacobianColumn, list<SimVar> seedVars, String matrixname, SparsityPattern sparsepattern, list<list<Integer>> colorList, Integer maxColor, String modelNamePrefix)
"template initialAnalyticJacobians
This template generates source code for functions that initialize the sparse-pattern for a single jacobian.
This is a helper of template functionAnalyticJacobians"
Expand Down Expand Up @@ -12883,7 +12883,7 @@ template functionAnalyticJacobiansHeader(list<JacobianMatrix> JacobianMatrixes,S

end functionAnalyticJacobiansHeader;

template initialAnalyticJacobiansHeader(list<JacobianColumn> jacobianColumn, list<SimVar> seedVars, String matrixname, list<tuple<Integer,list<Integer>>> sparsepattern, list<list<Integer>> colorList, Integer maxColor, String modelNamePrefix)
template initialAnalyticJacobiansHeader(list<JacobianColumn> jacobianColumn, list<SimVar> seedVars, String matrixname, SparsityPattern sparsepattern, list<list<Integer>> colorList, Integer maxColor, String modelNamePrefix)
"template initialAnalyticJacobians
This template generates source code for functions that initialize the sparse-pattern for a single jacobian.
This is a helper of template functionAnalyticJacobians"
Expand Down Expand Up @@ -12924,7 +12924,7 @@ match matrixname
end match
end mkSparseFunctionHeader;

template initialAnalyticJacobians(Integer indexJacobian, list<JacobianColumn> jacobianColumn, list<SimVar> seedVars, String matrixName, list<tuple<Integer,list<Integer>>> sparsepattern, list<list<Integer>> colorList, SimCode simCode, Text& extraFuncs, Text& extraFuncsDecl, Text extraFuncsNamespace)
template initialAnalyticJacobians(Integer indexJacobian, list<JacobianColumn> jacobianColumn, list<SimVar> seedVars, String matrixName, SparsityPattern sparsepattern, list<list<Integer>> colorList, SimCode simCode, Text& extraFuncs, Text& extraFuncsDecl, Text extraFuncsNamespace)
"Generates function that initialize the sparse-pattern for a jacobian matrix"
::=
match simCode
Expand Down
2 changes: 1 addition & 1 deletion OMCompiler/Compiler/Template/CodegenCppInit.tpl
Expand Up @@ -242,7 +242,7 @@ template jacobianMatrixesXML(list<JacobianMatrix> JacobianMatrixes)
>>
end jacobianMatrixesXML;

template jacobianMatrixXML(Integer indexJacobian, list<JacobianColumn> jacobianColumn, list<SimVar> seedVars, String matrixName, list<tuple<Integer,list<Integer>>> sparsepattern, list<list<Integer>> colorList, Integer maxColor)
template jacobianMatrixXML(Integer indexJacobian, list<JacobianColumn> jacobianColumn, list<SimVar> seedVars, String matrixName, SparsityPattern sparsepattern, list<list<Integer>> colorList, Integer maxColor)
::=
let indexColumn = (jacobianColumn |> JAC_COLUMN(numberOfResultVars=nRows) => '<%nRows%>'; separator="\n")
let jacvals = (sparsepattern |> (index,indexes) hasindex index0 =>
Expand Down

0 comments on commit adfa4e2

Please sign in to comment.