Skip to content

Commit

Permalink
Update scripts and code for separate code generation. It actually wor…
Browse files Browse the repository at this point in the history
…ks (Makefiles updated for Linux)

- Some external were commented out because no one wrote bootstrapped implementations for them or called them in any existing function.
- Moved some stuff from Interactive.mo to GlobalScript.mo (type definitions)


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16823 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Aug 17, 2013
1 parent 48f74da commit cab3a84
Show file tree
Hide file tree
Showing 38 changed files with 1,915 additions and 1,622 deletions.
32 changes: 18 additions & 14 deletions Compiler/BackEnd/BackendDAEEXT.mo
Expand Up @@ -55,12 +55,13 @@ public function eMark
external "C" BackendDAEEXT_eMark(inInteger) annotation(Library = "omcruntime");
end eMark;

/* TODO: Implement an external C function for bootstrapped omc or remove me. DO NOT SIMPLY REMOVE THIS COMMENT
public function getEMark
input Integer inInteger;
output Boolean outBoolean;
external "C" outBoolean=BackendDAEEXT_getEMark(inInteger) annotation(Library = "omcruntime");
end getEMark;
end getEMark;*/

public function vMark
input Integer inInteger;
Expand Down Expand Up @@ -104,18 +105,6 @@ public function getMarkedVariables
external "C" outIntegerLst=BackendDAEEXT_getMarkedVariables() annotation(Library = "omcruntime");
end getMarkedVariables;

public function dumpMarkedEquations
input Integer inInteger;

external "C" BackendDAEEXT_dumpMarkedEquations(inInteger) annotation(Library = "omcruntime");
end dumpMarkedEquations;

public function dumpMarkedVariables
input Integer inInteger;

external "C" BackendDAEEXT_dumpMarkedVariables(inInteger) annotation(Library = "omcruntime");
end dumpMarkedVariables;

public function initLowLink
input Integer inInteger;

Expand Down Expand Up @@ -156,6 +145,19 @@ public function getNumber
external "C" outInteger=BackendDAEEXT_getNumber(inInteger) annotation(Library = "omcruntime");
end getNumber;

/* TODO: Implement an external C function for bootstrapped omc or remove me. DO NOT SIMPLY REMOVE THIS COMMENT
public function dumpMarkedEquations
input Integer inInteger;
external "C" BackendDAEEXT_dumpMarkedEquations(inInteger) annotation(Library = "omcruntime");
end dumpMarkedEquations;
public function dumpMarkedVariables
input Integer inInteger;
external "C" BackendDAEEXT_dumpMarkedVariables(inInteger) annotation(Library = "omcruntime");
end dumpMarkedVariables;
public function initV
input Integer inInteger;
Expand Down Expand Up @@ -195,6 +197,7 @@ public function getF
external "C" outInteger=BackendDAEEXT_getF(inInteger) annotation(Library = "omcruntime");
end getF;
*/

/******************************************
C-Implementation Stuff from
Expand All @@ -211,6 +214,7 @@ public function setIncidenceMatrix "author: Frenkel TUD 2012-04"
external "C" BackendDAEEXT_setIncidenceMatrix(nv,ne,nz,m) annotation(Library = "omcruntime");
end setIncidenceMatrix;

/* TODO: Implement an external C function for bootstrapped omc or remove me. DO NOT SIMPLY REMOVE THIS COMMENT
public function cheapmatching
"author: Frenkel TUD 2012-04
calls cheapmatching algorithms
Expand All @@ -227,7 +231,7 @@ public function cheapmatching
input Integer cheapID;
input Integer clear_match;
external "C" BackendDAEEXT_cheapmatching(nv,ne,cheapID,clear_match) annotation(Library = "omcruntime");
end cheapmatching;
end cheapmatching;*/

public function matching
"author: Frenkel TUD 2012-04
Expand Down
3 changes: 1 addition & 2 deletions Compiler/BackEnd/HpcOmSimCode.mo
Expand Up @@ -46,7 +46,6 @@ public import SimCode;
// protected imports
protected import BackendDAEOptimize;
protected import BackendDAEUtil;
protected import BackendDump;
protected import Error;
//protected import HpcOmScheduler;
protected import HpcOmTaskGraph;
Expand Down Expand Up @@ -774,4 +773,4 @@ algorithm
end matchcontinue;
end removeDummyStateFromMapping1;

end HpcOmSimCode;
end HpcOmSimCode;
3 changes: 2 additions & 1 deletion Compiler/BackEnd/OpenTURNS.mo
Expand Up @@ -53,6 +53,7 @@ import CevalScript;
import ComponentReference;
import Expression;
import ExpressionDump;
import GlobalScript;
import Interactive;
import List;
import Settings;
Expand Down Expand Up @@ -92,7 +93,7 @@ algorithm

simSettings := CevalScript.convertSimulationOptionsToSimCode(
CevalScript.buildSimulationOptionsFromModelExperimentAnnotation(
Interactive.setSymbolTableAST(Interactive.emptySymboltable,inProgram),inPath,fileNamePrefix)
Interactive.setSymbolTableAST(GlobalScript.emptySymboltable,inProgram),inPath,fileNamePrefix)
);
// correlation matrix form (vector of records) currently not supported by OpenModelica backend, remove it .
//print("enter dae:");
Expand Down
27 changes: 13 additions & 14 deletions Compiler/BackEnd/SimCodeMain.mo
Expand Up @@ -46,9 +46,9 @@ public import BackendDAEUtil;
public import Ceval;
public import DAE;
public import Env;
public import GlobalScript;
public import HashTableExpToIndex;
public import HashTableStringToPath;
public import Interactive;
public import Tpl;
public import Values;
public import SimCode;
Expand All @@ -72,7 +72,6 @@ protected import DAEUtil;
protected import Debug;
protected import Error;
protected import Flags;
protected import GlobalScript;
protected import HpcOmSimCode;
protected import Settings;
protected import SimCodeDump;
Expand Down Expand Up @@ -198,13 +197,13 @@ public function translateModelFMU
input Env.Cache inCache;
input Env.Env inEnv;
input Absyn.Path className "path for the model";
input Interactive.SymbolTable inInteractiveSymbolTable;
input GlobalScript.SymbolTable inInteractiveSymbolTable;
input String inFileNamePrefix;
input Boolean addDummy "if true, add a dummy state";
input Option<SimCode.SimulationSettings> inSimSettingsOpt;
output Env.Cache outCache;
output Values.Value outValue;
output Interactive.SymbolTable outInteractiveSymbolTable;
output GlobalScript.SymbolTable outInteractiveSymbolTable;
output BackendDAE.BackendDAE outBackendDAE;
output list<String> outStringLst;
output String outFileDir;
Expand All @@ -218,13 +217,13 @@ algorithm
list<Env.Frame> env;
BackendDAE.BackendDAE dlow,dlow_1,indexed_dlow_1;
list<String> libs;
Interactive.SymbolTable st;
GlobalScript.SymbolTable st;
Absyn.Program p;
//DAE.Exp fileprefix;
Env.Cache cache;
DAE.FunctionTree funcs;
Real timeSimCode, timeTemplates, timeBackend, timeFrontend;
case (cache,env,_,st as Interactive.SYMBOLTABLE(ast=p),filenameprefix,_, _)
case (cache,env,_,st as GlobalScript.SYMBOLTABLE(ast=p),filenameprefix,_, _)
equation
/* calculate stuff that we need to create SimCode data structure */
System.realtimeTick(GlobalScript.RT_CLOCK_FRONTEND);
Expand Down Expand Up @@ -267,13 +266,13 @@ public function translateModelXML
input Env.Cache inCache;
input Env.Env inEnv;
input Absyn.Path className "path for the model";
input Interactive.SymbolTable inInteractiveSymbolTable;
input GlobalScript.SymbolTable inInteractiveSymbolTable;
input String inFileNamePrefix;
input Boolean addDummy "if true, add a dummy state";
input Option<SimCode.SimulationSettings> inSimSettingsOpt;
output Env.Cache outCache;
output Values.Value outValue;
output Interactive.SymbolTable outInteractiveSymbolTable;
output GlobalScript.SymbolTable outInteractiveSymbolTable;
output BackendDAE.BackendDAE outBackendDAE;
output list<String> outStringLst;
output String outFileDir;
Expand All @@ -287,13 +286,13 @@ algorithm
list<Env.Frame> env;
BackendDAE.BackendDAE dlow,dlow_1,indexed_dlow_1;
list<String> libs;
Interactive.SymbolTable st;
GlobalScript.SymbolTable st;
Absyn.Program p;
//DAE.Exp fileprefix;
Env.Cache cache;
DAE.FunctionTree funcs;
Real timeSimCode, timeTemplates, timeBackend, timeFrontend;
case (cache,env,_,st as Interactive.SYMBOLTABLE(ast=p),filenameprefix,_, _)
case (cache,env,_,st as GlobalScript.SYMBOLTABLE(ast=p),filenameprefix,_, _)
equation
/* calculate stuff that we need to create SimCode data structure */
System.realtimeTick(GlobalScript.RT_CLOCK_FRONTEND);
Expand Down Expand Up @@ -519,13 +518,13 @@ public function translateModel
input Env.Cache inCache;
input Env.Env inEnv;
input Absyn.Path className "path for the model";
input Interactive.SymbolTable inInteractiveSymbolTable;
input GlobalScript.SymbolTable inInteractiveSymbolTable;
input String inFileNamePrefix;
input Boolean addDummy "if true, add a dummy state";
input Option<SimCode.SimulationSettings> inSimSettingsOpt;
input Absyn.FunctionArgs args "labels for remove terms";
output Env.Cache outCache;
output Interactive.SymbolTable outInteractiveSymbolTable;
output GlobalScript.SymbolTable outInteractiveSymbolTable;
output BackendDAE.BackendDAE outBackendDAE;
output list<String> outStringLst;
output String outFileDir;
Expand All @@ -539,13 +538,13 @@ algorithm
list<Env.Frame> env;
BackendDAE.BackendDAE dlow,dlow_1,indexed_dlow_1;
list<String> libs;
Interactive.SymbolTable st;
GlobalScript.SymbolTable st;
Absyn.Program p;
//DAE.Exp fileprefix;
Env.Cache cache;
Real timeSimCode, timeTemplates, timeBackend, timeFrontend;

case (cache,env,_,(st as Interactive.SYMBOLTABLE(ast = p)),filenameprefix,_, _,_)
case (cache,env,_,(st as GlobalScript.SYMBOLTABLE(ast = p)),filenameprefix,_, _,_)
equation
// calculate stuff that we need to create SimCode data structure
System.realtimeTick(GlobalScript.RT_CLOCK_FRONTEND);
Expand Down
6 changes: 4 additions & 2 deletions Compiler/BackEnd/TaskGraphExt.mo
Expand Up @@ -89,17 +89,19 @@ public function registerStartStop
external "C" TaskGraphExt_registerStartStop(inInteger1,inInteger2) annotation(Library = {"modparomc"});
end registerStartStop;

/* TODO: Implement an external C function for bootstrapped omc or remove me. DO NOT SIMPLY REMOVE THIS COMMENT
public function getStartTask
output Integer outInteger;
external "C" outInteger=TaskGraphExt_getStartTask() annotation(Library = {"modparomc"});
end getStartTask;
end getStartTask;*/

/* TODO: Implement an external C function for bootstrapped omc or remove me. DO NOT SIMPLY REMOVE THIS COMMENT
public function getStopTask
output Integer outInteger;
external "C" outInteger=TaskGraphExt_getStopTask() annotation(Library = {"modparomc"});
end getStopTask;
end getStopTask;*/

public function mergeTasks
input Real inReal1;
Expand Down
11 changes: 5 additions & 6 deletions Compiler/BackEnd/Uncertainties.mo
Expand Up @@ -5,8 +5,8 @@ public import BackendDAE;
public import BackendVarTransform;
public import DAE;
public import Env;
public import GlobalScript;
public import HashTable;
public import Interactive;
public import Values;

protected import Algorithm;
Expand All @@ -16,7 +16,6 @@ protected import SCode;
protected import Flags;
protected import Error;
protected import System;
protected import GlobalScript;
protected import Dependency;
protected import SCodeUtil;
protected import Inst;
Expand Down Expand Up @@ -58,12 +57,12 @@ public function modelEquationsUC
input Env.Cache inCache;
input Env.Env inEnv;
input Absyn.Path className "path for the model";
input Interactive.SymbolTable inInteractiveSymbolTable;
input GlobalScript.SymbolTable inInteractiveSymbolTable;
input String outputFileIn;
input Boolean dumpSteps;
output Env.Cache outCache;
output Values.Value outValue;
output Interactive.SymbolTable outInteractiveSymbolTable;
output GlobalScript.SymbolTable outInteractiveSymbolTable;

algorithm
(outCache,outValue,outInteractiveSymbolTable):=
Expand All @@ -77,7 +76,7 @@ algorithm
Absyn.Program p;

BackendDAE.BackendDAE dlow,dlow_1;
Interactive.SymbolTable st;
GlobalScript.SymbolTable st;

BackendDAE.IncidenceMatrix m,mt;

Expand All @@ -100,7 +99,7 @@ algorithm
String outStringA,outStringB,outString;
list<Option<DAE.Distribution>> distributions;

case (cache,env,_,(st as Interactive.SYMBOLTABLE(ast = p)),outputFile,_)
case (cache,env,_,(st as GlobalScript.SYMBOLTABLE(ast = p)),outputFile,_)
equation
//print("Initiating\n");
Print.clearBuf();
Expand Down

0 comments on commit cab3a84

Please sign in to comment.