Skip to content

Commit

Permalink
- sundials is now available again, if static linking is selected (c++…
Browse files Browse the repository at this point in the history
… runtime)

- fixed an issue with the std::vector fill constructor, because he could not distinguish between the different constructors in GCC 4.4 (MinGW)
  • Loading branch information
Marcus Walther committed Sep 17, 2015
1 parent ac0ef81 commit 0ad7abb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
12 changes: 6 additions & 6 deletions Compiler/Template/CodegenCppHpcom.tpl
Expand Up @@ -454,19 +454,19 @@ template additionalHpcomConstructorBodyStatements(Option<tuple<Schedule,Schedule
<%if boolNot(stringEq(getConfigString(PROFILING_LEVEL),"none")) then
<<
#ifdef MEASURETIME_MODELFUNCTIONS
measureTimeSchedulerArrayHpcom_evaluateODE = new std::vector<MeasureTimeData*>(<%listLength(odeSchedule.tasksOfLevels)%>, NULL);
measureTimeSchedulerArrayHpcom_evaluateODE = new std::vector<MeasureTimeData*>(size_t(<%listLength(odeSchedule.tasksOfLevels)%>), NULL);
MeasureTime::addResultContentBlock("<%fullModelName%>","functions_HPCOM_Sections",measureTimeSchedulerArrayHpcom_evaluateODE);
measuredSchedulerStartValues = MeasureTime::getZeroValues();
measuredSchedulerEndValues = MeasureTime::getZeroValues();
<%List.intRange(listLength(odeSchedule.tasksOfLevels)) |> levelIdx => '(*measureTimeSchedulerArrayHpcom_evaluateODE)[<%intSub(levelIdx,1)%>] = new MeasureTimeData("evaluateODE_level_<%levelIdx%>");'; separator="\n"%>

measureTimeSchedulerArrayHpcom_evaluateDAE = new std::vector<MeasureTimeData*>(<%listLength(daeSchedule.tasksOfLevels)%>, NULL);
measureTimeSchedulerArrayHpcom_evaluateDAE = new std::vector<MeasureTimeData*>(size_t(<%listLength(daeSchedule.tasksOfLevels)%>), NULL);
MeasureTime::addResultContentBlock("<%fullModelName%>","functions_HPCOM_Sections",measureTimeSchedulerArrayHpcom_evaluateDAE);
measuredSchedulerStartValues = MeasureTime::getZeroValues();
measuredSchedulerEndValues = MeasureTime::getZeroValues();
<%List.intRange(listLength(daeSchedule.tasksOfLevels)) |> levelIdx => '(*measureTimeSchedulerArrayHpcom_evaluateDAE)[<%intSub(levelIdx,1)%>] = new MeasureTimeData("evaluateDAE_level_<%levelIdx%>");'; separator="\n"%>

measureTimeSchedulerArrayHpcom_evaluateZeroFuncs = new std::vector<MeasureTimeData*>(<%listLength(odeSchedule.tasksOfLevels)%>, NULL);
measureTimeSchedulerArrayHpcom_evaluateZeroFuncs = new std::vector<MeasureTimeData*>(size_t(<%listLength(odeSchedule.tasksOfLevels)%>), NULL);
MeasureTime::addResultContentBlock("<%fullModelName%>","functions_HPCOM_Sections",measureTimeSchedulerArrayHpcom_evaluateZeroFuncs);
measuredSchedulerStartValues = MeasureTime::getZeroValues();
measuredSchedulerEndValues = MeasureTime::getZeroValues();
Expand Down Expand Up @@ -544,9 +544,9 @@ template generateThreadMeasureTimeDeclaration(String fullModelName, Integer numb
::=
<<
#ifdef MEASURETIME_MODELFUNCTIONS
measureTimeThreadArrayOdeHpcom = new std::vector<MeasureTimeData*>(<%numberOfThreads%>, NULL);
measureTimeThreadArrayDaeHpcom = new std::vector<MeasureTimeData*>(<%numberOfThreads%>, NULL);
measureTimeThreadArrayZeroFuncHpcom = new std::vector<MeasureTimeData*>(<%numberOfThreads%>, NULL);
measureTimeThreadArrayOdeHpcom = new std::vector<MeasureTimeData*>(size_t(<%numberOfThreads%>), NULL);
measureTimeThreadArrayDaeHpcom = new std::vector<MeasureTimeData*>(size_t(<%numberOfThreads%>), NULL);
measureTimeThreadArrayZeroFuncHpcom = new std::vector<MeasureTimeData*>(size_t(<%numberOfThreads%>), NULL);
MeasureTime::addResultContentBlock("<%fullModelName%>","evaluateODE_threads",measureTimeThreadArrayOdeHpcom);
MeasureTime::addResultContentBlock("<%fullModelName%>","evaluateDAE_threads",measureTimeThreadArrayDaeHpcom);
MeasureTime::addResultContentBlock("<%fullModelName%>","evaluateZeroFunc_threads",measureTimeThreadArrayZeroFuncHpcom);
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/cpp/Solver/CVode/CMakeLists.txt
Expand Up @@ -7,7 +7,7 @@ project(${CVodeName})

add_library(${CVodeName}_static STATIC CVode.cpp CVodeSettings.cpp FactoryExport.cpp)
add_precompiled_header(${CVodeName}_static Include/Core/Modelica.h )
set_target_properties(${CVodeName}_static PROPERTIES COMPILE_DEFINITIONS "RUNTIME_STATIC_LINKING")
set_target_properties(${CVodeName}_static PROPERTIES COMPILE_DEFINITIONS "RUNTIME_STATIC_LINKING;ENABLE_SUNDIALS_STATIC")
install (TARGETS ${CVodeName}_static DESTINATION ${LIBINSTALLEXT})

MESSAGE(STATUS "Sundials Libraries used for linking:")
Expand Down
20 changes: 0 additions & 20 deletions SimulationRuntime/cpp/Solver/CVode/FactoryExport.cpp
Expand Up @@ -50,17 +50,6 @@ extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_cvode(boost::extens
boost::shared_ptr<ISolverSettings> cvode_settings = boost::shared_ptr<ISolverSettings>(new CVodeSettings(globalSettings.get()));
return cvode_settings;
}

boost::shared_ptr<ISolver> createIda(IMixedSystem* system, boost::shared_ptr<ISolverSettings> solver_settings)
{
boost::shared_ptr<ISolver> ida = boost::shared_ptr<ISolver>(new Ida(system,solver_settings.get()));
return ida;
}
boost::shared_ptr<ISolverSettings> createIdaSettings(boost::shared_ptr<IGlobalSettings> globalSettings)
{
boost::shared_ptr<ISolverSettings> ida_settings = boost::shared_ptr<ISolverSettings>(new IDASettings(globalSettings.get()));
return ida_settings;
}
#else
boost::shared_ptr<ISolver> createCVode(IMixedSystem* system, boost::shared_ptr<ISolverSettings> solver_settings)
{
Expand All @@ -70,15 +59,6 @@ extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_cvode(boost::extens
{
throw ModelicaSimulationError(SOLVER,"CVode was disabled during build");
}

boost::shared_ptr<ISolver> createIda(IMixedSystem* system, boost::shared_ptr<ISolverSettings> solver_settings)
{
throw ModelicaSimulationError(SOLVER,"IDA was disabled during build");
}
boost::shared_ptr<ISolverSettings> createIdaSettings(boost::shared_ptr<IGlobalSettings> globalSettings)
{
throw ModelicaSimulationError(SOLVER,"IDA was disabled during build");
}
#endif //ENABLE_SUNDIALS_STATIC

#else
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/cpp/Solver/IDA/CMakeLists.txt
Expand Up @@ -5,7 +5,7 @@ project(${IDAName})

# add the solver default implementation library
add_library(${IDAName}_static STATIC IDA.cpp IDASettings.cpp FactoryExport.cpp)
set_target_properties(${IDAName}_static PROPERTIES COMPILE_DEFINITIONS "RUNTIME_STATIC_LINKING")
set_target_properties(${IDAName}_static PROPERTIES COMPILE_DEFINITIONS "RUNTIME_STATIC_LINKING;ENABLE_SUNDIALS_STATIC")
add_precompiled_header(${IDAName}_static Include/Core/Modelica.h )

add_library(${IDAName} SHARED IDA.cpp IDASettings.cpp FactoryExport.cpp)
Expand Down
13 changes: 13 additions & 0 deletions SimulationRuntime/cpp/Solver/IDA/FactoryExport.cpp
Expand Up @@ -33,6 +33,8 @@ extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_ida(boost::extensio
#elif defined(OMC_BUILD) && defined(RUNTIME_STATIC_LINKING)
#include <Solver/IDA/IDA.h>
#include <Solver/IDA/IDASettings.h>

#ifdef ENABLE_SUNDIALS_STATIC
boost::shared_ptr<ISolver> createIda(IMixedSystem* system, boost::shared_ptr<ISolverSettings> solver_settings)
{
boost::shared_ptr<ISolver> ida = boost::shared_ptr<ISolver>(new Ida(system,solver_settings.get()));
Expand All @@ -43,6 +45,17 @@ extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_ida(boost::extensio
boost::shared_ptr<ISolverSettings> ida_settings = boost::shared_ptr<ISolverSettings>(new IDASettings(globalSettings.get()));
return ida_settings;
}
#else
boost::shared_ptr<ISolver> createIda(IMixedSystem* system, boost::shared_ptr<ISolverSettings> solver_settings)
{
throw ModelicaSimulationError(SOLVER,"IDA was disabled during build");
}
boost::shared_ptr<ISolverSettings> createIdaSettings(boost::shared_ptr<IGlobalSettings> globalSettings)
{
throw ModelicaSimulationError(SOLVER,"IDA was disabled during build");
}
#endif //ENABLE_SUNDIALS_STATIC


#else
error "operating system not supported"
Expand Down

0 comments on commit 0ad7abb

Please sign in to comment.