OMCompiler/SimulationRuntime/cpp/Solver/CVode/FactoryExport.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file belongs to the OpenModelica Run-Time System | ||
| 3 | * | ||
| 4 | * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC), c/o Linköpings | ||
| 5 | * universitet, Department of Computer and Information Science, SE-58183 Linköping, Sweden. All rights | ||
| 6 | * reserved. | ||
| 7 | * | ||
| 8 | * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE | ||
| 9 | * AGPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8. ANY | ||
| 10 | * USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S | ||
| 11 | * ACCEPTANCE OF THE BSD NEW LICENSE OR THE OSMC PUBLIC LICENSE OR THE AGPL | ||
| 12 | * VERSION 3, ACCORDING TO RECIPIENTS CHOICE. | ||
| 13 | * | ||
| 14 | * The OpenModelica software and the OSMC (Open Source Modelica Consortium) Public License | ||
| 15 | * (OSMC-PL) are obtained from OSMC, either from the above address, from the URLs: | ||
| 16 | * http://www.openmodelica.org or https://github.com/OpenModelica/ or | ||
| 17 | * http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica distribution. GNU | ||
| 18 | * AGPL version 3 is obtained from: https://www.gnu.org/licenses/licenses.html#GPL. The BSD NEW | ||
| 19 | * License is obtained from: http://www.opensource.org/licenses/BSD-3-Clause. | ||
| 20 | * | ||
| 21 | * This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY | ||
| 23 | * SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF | ||
| 24 | * OSMC-PL. | ||
| 25 | * | ||
| 26 | */ | ||
| 27 | |||
| 28 | /** @addtogroup solverCvode | ||
| 29 | * | ||
| 30 | * @{ | ||
| 31 | */ | ||
| 32 | #include <Core/ModelicaDefine.h> | ||
| 33 | #include <Core/Modelica.h> | ||
| 34 | #if defined(__vxworks) | ||
| 35 | |||
| 36 | |||
| 37 | #elif defined(SIMSTER_BUILD) | ||
| 38 | |||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | /*Simster factory*/ | ||
| 43 | extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_cvode(boost::extensions::factory_map & fm) | ||
| 44 | { | ||
| 45 | fm.get<ISolver,int,IMixedSystem*, ISolverSettings*>()[1].set<Cvode>(); | ||
| 46 | //fm.get<ISolverSettings,int, IGlobalSettings* >()[2].set<CVodeSettings>(); | ||
| 47 | } | ||
| 48 | |||
| 49 | #elif defined(OMC_BUILD) && !defined(RUNTIME_STATIC_LINKING) | ||
| 50 | |||
| 51 | #include <Solver/CVode/CVode.h> | ||
| 52 | #include <Solver/CVode/CVodeSettings.h> | ||
| 53 | |||
| 54 | /* OMC factory */ | ||
| 55 | using boost::extensions::factory; | ||
| 56 | |||
| 57 | 39 | BOOST_EXTENSION_TYPE_MAP_FUNCTION { | |
| 58 | types.get<std::map<std::string, factory<ISolver,IMixedSystem*, ISolverSettings*> > >() | ||
| 59 |
1/1✓ Branch 2 taken 39 times.
|
78 | ["cvodeSolver"].set<Cvode>(); |
| 60 | types.get<std::map<std::string, factory<ISolverSettings, IGlobalSettings* > > >() | ||
| 61 |
1/1✓ Branch 2 taken 39 times.
|
39 | ["cvodeSettings"].set<CVodeSettings>(); |
| 62 | 39 | } | |
| 63 | #elif defined(OMC_BUILD) && defined(RUNTIME_STATIC_LINKING) | ||
| 64 | #include <Solver/CVode/CVodeSettings.h> | ||
| 65 | #include <Solver/CVode/CVode.h> | ||
| 66 | #include <Solver/IDA/IDASettings.h> | ||
| 67 | #include <Solver/IDA/IDA.h> | ||
| 68 | |||
| 69 | #ifdef ENABLE_SUNDIALS_STATIC | ||
| 70 | shared_ptr<ISolver> createCVode(IMixedSystem* system, shared_ptr<ISolverSettings> solver_settings) | ||
| 71 | { | ||
| 72 | shared_ptr<ISolver> cvode = shared_ptr<ISolver>(new Cvode(system,solver_settings.get())); | ||
| 73 | return cvode; | ||
| 74 | } | ||
| 75 | shared_ptr<ISolverSettings> createCVodeSettings(shared_ptr<IGlobalSettings> globalSettings) | ||
| 76 | { | ||
| 77 | shared_ptr<ISolverSettings> cvode_settings = shared_ptr<ISolverSettings>(new CVodeSettings(globalSettings.get())); | ||
| 78 | return cvode_settings; | ||
| 79 | } | ||
| 80 | #else | ||
| 81 | shared_ptr<ISolver> createCVode(IMixedSystem* system, shared_ptr<ISolverSettings> solver_settings) | ||
| 82 | { | ||
| 83 | throw ModelicaSimulationError(SOLVER,"CVode was disabled during build"); | ||
| 84 | } | ||
| 85 | shared_ptr<ISolverSettings> createCVodeSettings(shared_ptr<IGlobalSettings> globalSettings) | ||
| 86 | { | ||
| 87 | throw ModelicaSimulationError(SOLVER,"CVode was disabled during build"); | ||
| 88 | } | ||
| 89 | #endif //ENABLE_SUNDIALS_STATIC | ||
| 90 | |||
| 91 | #else | ||
| 92 | error "operating system not supported" | ||
| 93 | #endif | ||
| 94 | /** @} */ // end of solverCvode | ||
| 95 | |||
| 96 |