Skip to content

Commit

Permalink
activated Cvode in cpp runtime
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17177 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
niklwors committed Sep 11, 2013
1 parent f861d37 commit 9438ebb
Show file tree
Hide file tree
Showing 10 changed files with 304 additions and 492 deletions.
4 changes: 2 additions & 2 deletions SimulationRuntime/cpp/CMakeLists.txt
Expand Up @@ -50,7 +50,7 @@ set(DataExchangeName ${LIBPREFIX}DataExchange)

SET(USE_MICO OFF)
SET(REDUCE_DAE OFF)
SET(USE_SUNDIALS OFF)
SET(USE_SUNDIALS ON)
SET(OMC_BUILD ON)
SET(SIMSTER_BUILD OFF)
# Boost
Expand Down Expand Up @@ -161,7 +161,7 @@ endif()
if(USE_SUNDIALS)
#add Cvode solver project
add_subdirectory (Solver/CVode)
add_subdirectory (Solver/Kinsol)
#Todo add_subdirectory (Solver/Kinsol)
#add Idas solver project
#add_subdirectory (Solver/Idas/Implementation)
#add_subdirectory (Solver/Ida/Implementation)
Expand Down
Expand Up @@ -83,7 +83,14 @@ struct SolverOMCFactory : public ObjectFactory<CreationPolicy>
}
else if(solvername.compare("CVode")==0)
{

PATH cvode_path = ObjectFactory<CreationPolicy>::_library_path;
PATH cvode_name(CVODE_LIB);
cvode_path/=cvode_name;
LOADERRESULT result = ObjectFactory<CreationPolicy>::_factory->LoadLibrary(cvode_path.string(),*_solver_type_map);
if (result != LOADER_SUCCESS)
{
throw std::runtime_error("Failed loading CVode solver library!");
}
}
else
throw std::invalid_argument("Selected Solver is not available");
Expand Down
Expand Up @@ -49,7 +49,16 @@ struct SolverSettingsOMCFactory : public ObjectFactory<CreationPolicy>
}
else if(solvername.compare("CVode")==0)
{
solver_settings_key.assign("extension_export_cvode");
PATH cvode_path = ObjectFactory<CreationPolicy>::_library_path;
PATH cvode_name(CVODE_LIB);
cvode_path/=cvode_name;
LOADERRESULT result = ObjectFactory<CreationPolicy>::_factory->LoadLibrary(cvode_path.string(),*_solver_type_map);
if (result != LOADER_SUCCESS)
{
throw std::runtime_error("Failed loading CVode solver library!");
}

solver_settings_key.assign("extension_export_cvode");
}
else
throw std::invalid_argument("Selected Solver is not available");
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/cpp/Solver/CVode/CMakeLists.txt
Expand Up @@ -4,7 +4,7 @@ project(${CVodeName})
include_directories(${SUNDIALS_INCLUDE_DIR}/cvodes ${SUNDIALS_INCLUDE_DIR}/nvector ${SUNDIALS_INCLUDE_DIR}/sundials ${SUNDIALS_INCLUDE_DIR})

# add the solver default implementation library
add_library(${CVodeName} SHARED CVode.cpp CVodeSettings.cpp )
add_library(${CVodeName} SHARED CVode.cpp CVodeSettings.cpp FactoryExport.cpp )
target_link_libraries (${CVodeName} ${SolverName} ${Boost_LIBRARIES} ${SUNDIALS_LIBS})
#target_link_libraries( Euler ${Boost_serialization_LIBRARY})

Expand Down

0 comments on commit 9438ebb

Please sign in to comment.