Skip to content

Commit

Permalink
Some fixes to compile with parmodelica
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25350 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Apr 1, 2015
1 parent 0b3b011 commit 3a4f448
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 39 deletions.
11 changes: 3 additions & 8 deletions Compiler/SimCode/SimCodeMain.mo
Expand Up @@ -538,14 +538,9 @@ end callTargetTemplates;
protected function dumpTaskSystemIfFlag
input SimCode.SimCode simCode;
algorithm
_ := matchcontinue(simCode)
case(_)
equation
true = Flags.isSet(Flags.PARMODAUTO);
Tpl.tplNoret2(TaskSystemDump.dumpTaskSystem, simCode, Flags.isSet(Flags.INFO_XML_OPERATIONS));
then ();
else ();
end matchcontinue;
if Flags.isSet(Flags.PARMODAUTO) then
Tpl.tplNoret2(TaskSystemDump.dumpTaskSystem, simCode, Flags.isSet(Flags.INFO_XML_OPERATIONS));
end if;
end dumpTaskSystemIfFlag;

protected function callTargetTemplatesCPP
Expand Down
12 changes: 4 additions & 8 deletions Compiler/Template/CodegenC.tpl
Expand Up @@ -2810,14 +2810,12 @@ end equationNamesArrayFormat;
template functionXXX_systems_arrayFormat(list<list<SimEqSystem>> eqlstlst, String name, Text &fncalls, Text &nrfuncs, Text &varDecls, String modelNamePrefixStr)
::=
match eqlstlst
case ({}) then
<<
/* no <%name%> systems */
>>

case ({})
case ({{}}) then
let &nrfuncs += "0"
<<
/* no <%name%> systems */
static void (**function<%name%>_systems)(DATA *) = NULL;
>>

case eqlstlst as ({eqlst}) then
Expand All @@ -2836,9 +2834,7 @@ match eqlstlst
>>

case eqlstlst as ({eqlst::_}) then
<<
/* TODO more than ODE list in <%name%> systems */
>>
error(sourceInfo(), 'TODO more than ODE list in <%name%> systems')
end functionXXX_systems_arrayFormat;

template functionODE(list<list<SimEqSystem>> derivativEquations, Text method, Option<HpcOmSimCode.Schedule> hpcOmSchedule, String modelNamePrefix)
Expand Down
8 changes: 4 additions & 4 deletions Compiler/Template/TaskSystemDump.tpl
Expand Up @@ -29,11 +29,11 @@ template tasksystemdump_dispatch(SimCode code, Boolean withOperations)
<dae-equations size="<%listLength(allEquations)%>">
<%dumpEqs(SimCodeUtil.sortEqSystems(allEquations),0,withOperations)%>
</dae-equations>
<ode-equations size="<%listLength(listGet(odeEquations,1))%>">
<%dumpEqs(SimCodeUtil.sortEqSystems(listGet(odeEquations,1)),0,withOperations)%>
<ode-equations size="<%if odeEquations then listLength(listGet(odeEquations,1)) else 0%>">
<%if odeEquations then dumpEqs(SimCodeUtil.sortEqSystems(listGet(odeEquations,1)),0,withOperations)%>
</ode-equations>
<alg-equations size="<%listLength(listGet(algebraicEquations,1))%>">
<%dumpEqs(SimCodeUtil.sortEqSystems(listGet(algebraicEquations,1)),0,withOperations)%>
<alg-equations size="<%if algebraicEquations then listLength(listGet(algebraicEquations,1)) else 0%>">
<%if algebraicEquations then dumpEqs(SimCodeUtil.sortEqSystems(listGet(algebraicEquations,1)),0,withOperations)%>
</alg-equations>
<start-equations size="<%listLength(startValueEquations)%>">
<%dumpEqs(SimCodeUtil.sortEqSystems(startValueEquations),0,withOperations)%>
Expand Down
38 changes: 19 additions & 19 deletions SimulationRuntime/ParModelica/auto/pm_posix_timer.cpp
Expand Up @@ -41,25 +41,25 @@
namespace openmodelica {
namespace parmodelica {

//PMTimer::PMTimer(){
// total_time = boost::chrono::seconds::zero();
//}
//
//void PMTimer::start_timer(){
// started_at = boost::chrono::system_clock::now();
//}
//
//void PMTimer::stop_timer(){
// total_time += (boost::chrono::system_clock::now() - started_at);
//}
//
//void PMTimer::reset_timer(){
// total_time = boost::chrono::seconds::zero();
//}
//
//double PMTimer::get_elapsed_time(){
// return boost::chrono::nanoseconds(total_time).count() / 1000000000.0;
//}
PMTimer::PMTimer(){
total_time = boost::chrono::seconds::zero();
}

void PMTimer::start_timer(){
started_at = boost::chrono::system_clock::now();
}

void PMTimer::stop_timer(){
total_time += (boost::chrono::system_clock::now() - started_at);
}

void PMTimer::reset_timer(){
total_time = boost::chrono::seconds::zero();
}

double PMTimer::get_elapsed_time(){
return boost::chrono::nanoseconds(total_time).count() / 1000000000.0;
}

} // parmodelica
} // openmodelica
Expand Down
2 changes: 2 additions & 0 deletions configure.in
Expand Up @@ -949,6 +949,8 @@ OMOptimBasis/build/Makefile.unix \
OMOptimBasis/build/OMOptimBasis.config \
OMVisualize/OMVisualizeGUI/OMVisualizeGUI.config \
SimulationRuntime/c/Makefile \
SimulationRuntime/ParModelica/Makefile \
SimulationRuntime/ParModelica/auto/Makefile \
SimulationRuntime/ParModelica/explicit/openclrt/Makefile \
mosh/src/Makefile \
Compiler/boot/Makefile \
Expand Down

0 comments on commit 3a4f448

Please sign in to comment.