Skip to content

Commit

Permalink
- Removed tabs.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13024 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Sep 22, 2012
1 parent 46ae320 commit bceff45
Showing 1 changed file with 107 additions and 107 deletions.
214 changes: 107 additions & 107 deletions Compiler/Template/CodegenJava.tpl
Expand Up @@ -102,10 +102,10 @@ case MODELINFO(varInfo=VARINFO(__), vars=SIMVARS(__)) then
<%\t%>private static DATA localData = new DATA();
<%\t%>//final time localData.timeValue = 0;
<%\t%>//final double $P$old$Ptime = localData.oldTime;
<%\t%>//final double $P$current_step_size = globalData.current_stepsize;
<%\t%><%addGlobalInitialization(modelInfo)%>
>>
Expand Down Expand Up @@ -233,29 +233,29 @@ case SIMCODE(modelInfo = MODELINFO(__)) then
<%\t%>public <%dotPath(modelInfo.name)%>()
<%\t%>{
<%\t%><%\t%>//localData = data;
<%\t%><%\t%>//$Px = localData.states[0];
<%\t%>//$P$DER$Px = localData.statesDerivatives[0];
<%\t%>}
>>
end functionModelConstructor;

template functionInitializeDataStruc()
"Generates function in simulation file."
::=
<<
// Used to initialize the data structure
/*
public DATA initializeDataStruc(DATA_FLAGS flags)
{
DATA returnData = new DATA(fortran_integer, fortran_integer, fortran_integer, long, long,
fortran_integer, long, long, long, long, long);
return returnData;
}
*/
// Used to initialize the data structure
/*
public DATA initializeDataStruc(DATA_FLAGS flags)
{
DATA returnData = new DATA(fortran_integer, fortran_integer, fortran_integer, long, long,
fortran_integer, long, long, long, long, long);
return returnData;
}
*/
>>
end functionInitializeDataStruc;

Expand All @@ -265,17 +265,17 @@ template functionDeInitializeDataStruc(ExtObjInfo extObjInfo)
match extObjInfo
case EXTOBJINFO(__) then
<<
protected void finalize ()
{
System.out.println("memsucker %d destroyed...\n");
}
// used to deinitialize the data structure
public void deInitializeDataStruc(DATA data, DATA_FLAGS flags)
{
/* In java, memory deallocation is automatically handled. so no need to free the memory explicitly. */
}
protected void finalize ()
{
System.out.println("memsucker %d destroyed...\n");
}
// used to deinitialize the data structure
public void deInitializeDataStruc(DATA data, DATA_FLAGS flags)
{
/* In java, memory deallocation is automatically handled. so no need to free the memory explicitly. */
}
>>
end functionDeInitializeDataStruc;

Expand All @@ -285,14 +285,14 @@ template functionInput(ModelInfo modelInfo)
match modelInfo
case MODELINFO(vars=SIMVARS(__)) then
<<
public int input_function()
{
<%vars.inputVars |> SIMVAR(__) hasindex i0 =>
'<%cref(name)%> = localData.inputVars[<%i0%>];'
;separator="\n"%>
return 0;
}
public int input_function()
{
<%vars.inputVars |> SIMVAR(__) hasindex i0 =>
'<%cref(name)%> = localData.inputVars[<%i0%>];'
;separator="\n"%>
return 0;
}
>>
end functionInput;

Expand All @@ -302,57 +302,57 @@ template functionOutput(ModelInfo modelInfo)
match modelInfo
case MODELINFO(vars=SIMVARS(__)) then
<<
public int output_function()
{
<%vars.outputVars |> SIMVAR(__) hasindex i0 =>
'localData.outputVars[<%i0%>] = <%cref(name)%>;'
;separator="\n"%>
return 0;
}
public int output_function()
{
<%vars.outputVars |> SIMVAR(__) hasindex i0 =>
'localData.outputVars[<%i0%>] = <%cref(name)%>;'
;separator="\n"%>
return 0;
}
>>
end functionOutput;

template functionDaeRes()
"Generates function in simulation file."
::=
<<
@SuppressWarnings("null") // To avoid "null" warnings in Java
public int functionDAE_res(double t, double[] x, double[] xd, double[] delta, double ires, double rpar, double ipar)
{
int i;
double[] temp_xd = null;
double[] statesBackup;
double[] statesDerivativesBackup;
double timeBackup;
statesBackup = localData.states;
statesDerivativesBackup = localData.statesDerivatives;
timeBackup = localData.timeValue;
localData.states = x;
for (i = 0; i < localData.nStates; i++) {
temp_xd[i] = localData.statesDerivatives[i];
}
localData.statesDerivatives = temp_xd;
localData.timeValue = t;
functionODE();
/* get the difference between the temp_xd(=localData->statesDerivatives)
and xd(=statesDerivativesBackup) */
for (i = 0; i < localData.nStates; i++) {
delta[i] = localData.statesDerivatives[i] - statesDerivativesBackup[i];
}
localData.states = statesBackup;
localData.statesDerivatives = statesDerivativesBackup;
localData.timeValue = timeBackup;
return 0;
}
@SuppressWarnings("null") // To avoid "null" warnings in Java
public int functionDAE_res(double t, double[] x, double[] xd, double[] delta, double ires, double rpar, double ipar)
{
int i;
double[] temp_xd = null;
double[] statesBackup;
double[] statesDerivativesBackup;
double timeBackup;
statesBackup = localData.states;
statesDerivativesBackup = localData.statesDerivatives;
timeBackup = localData.timeValue;
localData.states = x;
for (i = 0; i < localData.nStates; i++) {
temp_xd[i] = localData.statesDerivatives[i];
}
localData.statesDerivatives = temp_xd;
localData.timeValue = t;
functionODE();
/* get the difference between the temp_xd(=localData->statesDerivatives)
and xd(=statesDerivativesBackup) */
for (i = 0; i < localData.nStates; i++) {
delta[i] = localData.statesDerivatives[i] - statesDerivativesBackup[i];
}
localData.states = statesBackup;
localData.statesDerivatives = statesDerivativesBackup;
localData.timeValue = timeBackup;
return 0;
}
>>
end functionDaeRes;

Expand All @@ -370,18 +370,18 @@ template functionStoreDelayed(DelayedExpression delayed)
>>
))
<<
/*
* extern int const numDelayExpressionIndex = <%match delayed case DELAYED_EXPRESSIONS(__) then maxDelayedIndex%>;
*/
public int function_storeDelayed()
{
<%varDecls%>
<%storePart%>
return 0;
}
/*
* extern int const numDelayExpressionIndex = <%match delayed case DELAYED_EXPRESSIONS(__) then maxDelayedIndex%>;
*/
public int function_storeDelayed()
{
<%varDecls%>
<%storePart%>
return 0;
}
>>
end functionStoreDelayed;

Expand All @@ -393,19 +393,19 @@ template functionODE(list<SimEqSystem> derivativEquations, ModelInfo modelInfo)
equation_(eq, contextSimulationNonDiscrete, &varDecls /*BUFC*/)
;separator="\n")
<<
public int functionODE(DATA localData)
{
<%addGlobalDefinition(modelInfo)%>
<%varDecls%>
public int functionODE(DATA localData)
{
<%addGlobalDefinition(modelInfo)%>
<%varDecls%>
<%odeEquations%>
<%addVarReverseDefinition(modelInfo)%>
return 0;
}
<%odeEquations%>
<%addVarReverseDefinition(modelInfo)%>
return 0;
}
}// end main class

>>
Expand Down Expand Up @@ -1238,7 +1238,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__)) then
#<%\t%>cp TestModel.java $(simulation_dir)
#<%\t%>cp TestModel_init.txt $(top_dir)
#<%\t%>(cd $(top_dir); make -f Makefile)
JFLAGS = -g
JC = javac
.SUFFIXES: .java .class
Expand Down Expand Up @@ -1305,9 +1305,9 @@ end simulationInitFile;

template initVals(list<SimVar> varsLst) ::=
varsLst |> SIMVAR(__) =>
<<
<%match initialValue
case SOME(v) then
<<
<%match initialValue
case SOME(v) then
match v
case ICONST(__) then integer
case RCONST(__) then real
Expand All @@ -1317,7 +1317,7 @@ template initVals(list<SimVar> varsLst) ::=
else "*ERROR* initial value of unknown type"
else "0.0 //default"
%>
>>
>>
;separator="\n"
end initVals;

Expand Down

0 comments on commit bceff45

Please sign in to comment.