Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25460 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
1 parent
a9009b7
commit ffdd23b
Showing
2 changed files
with
153 additions
and
153 deletions.
There are no files selected for viewing
54 changes: 27 additions & 27 deletions
54
SimulationRuntime/cpp/Include/SimCoreFactory/VxWorksFactory/VxWorksFactory.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
#pragma once | ||
//#include <stdio.h> | ||
#include <Core/SimController/ISimController.h> | ||
#include <Core/Modelica.h> | ||
|
||
class ISimController; | ||
|
||
class VxWorksFactory | ||
{ | ||
public: | ||
VxWorksFactory(string library_path, string modelicasystem_path); | ||
~VxWorksFactory(); | ||
boost::shared_ptr<ISimController> LoadSimController(); | ||
boost::shared_ptr<ISettingsFactory> LoadSettingsFactory(); | ||
boost::shared_ptr<IAlgLoopSolverFactory> LoadAlgLoopSolverFactory(IGlobalSettings*); | ||
boost::shared_ptr<ISolver> LoadSolver(IMixedSystem* system, string solver_name,boost::shared_ptr<ISolverSettings> solver_settings); | ||
boost::shared_ptr<IMixedSystem> LoadSystem(IGlobalSettings*, boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData> simData); | ||
boost::shared_ptr<ISimData> LoadSimData(); | ||
boost::shared_ptr<ISolverSettings> LoadSolverSettings(string solver_name,boost::shared_ptr<IGlobalSettings>); | ||
boost::shared_ptr<IAlgLoopSolver> LoadAlgLoopSolver(IAlgLoop* algLoop, string solver_name, boost::shared_ptr<INonLinSolverSettings> solver_settings); | ||
boost::shared_ptr<INonLinSolverSettings> LoadAlgLoopSolverSettings(string solver_name); | ||
private: | ||
string _library_path; | ||
string _modelicasystem_path; | ||
}; | ||
|
||
|
||
#pragma once | ||
//#include <stdio.h> | ||
#include <Core/SimController/ISimController.h> | ||
#include <Core/Modelica.h> | ||
|
||
class ISimController; | ||
|
||
class VxWorksFactory | ||
{ | ||
public: | ||
VxWorksFactory(string library_path, string modelicasystem_path); | ||
~VxWorksFactory(); | ||
boost::shared_ptr<ISimController> LoadSimController(); | ||
boost::shared_ptr<ISettingsFactory> LoadSettingsFactory(); | ||
boost::shared_ptr<IAlgLoopSolverFactory> LoadAlgLoopSolverFactory(IGlobalSettings*); | ||
boost::shared_ptr<ISolver> LoadSolver(IMixedSystem* system, string solver_name,boost::shared_ptr<ISolverSettings> solver_settings); | ||
boost::shared_ptr<IMixedSystem> LoadSystem(IGlobalSettings*, boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData> simData); | ||
boost::shared_ptr<ISimData> LoadSimData(); | ||
boost::shared_ptr<ISolverSettings> LoadSolverSettings(string solver_name,boost::shared_ptr<IGlobalSettings>); | ||
boost::shared_ptr<IAlgLoopSolver> LoadAlgLoopSolver(IAlgLoop* algLoop, string solver_name, boost::shared_ptr<INonLinSolverSettings> solver_settings); | ||
boost::shared_ptr<INonLinSolverSettings> LoadAlgLoopSolverSettings(string solver_name); | ||
private: | ||
string _library_path; | ||
string _modelicasystem_path; | ||
}; | ||
|
||
|
252 changes: 126 additions & 126 deletions
252
SimulationRuntime/cpp/SimCoreFactory/VxWorksFactory/VxWorksFactory.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,127 +1,127 @@ | ||
#include <SimCoreFactory/VxWorksFactory/VxWorksFactory.h> | ||
|
||
extern "C" ISimController* createSimController(PATH library_path, PATH modelicasystem_path); | ||
extern "C" ISettingsFactory* createSettingsFactory(PATH library_path,PATH modelicasystem_path); | ||
extern "C" IAlgLoopSolverFactory* createAlgLoopSolverFactory(IGlobalSettings* globalSettings,PATH library_path,PATH modelicasystem_path); | ||
extern "C" ISimData* createSimData(); | ||
extern "C" IMixedSystem* createModelCG(IGlobalSettings* globalSettings, boost::shared_ptr<IAlgLoopSolverFactory> nonlinsolverfactor, boost::shared_ptr<ISimData> simData); | ||
extern "C" ISolver* createRTEuler(IMixedSystem* system, ISolverSettings* settings); | ||
extern "C" ISolver* createRTRK(IMixedSystem* system, ISolverSettings* settings); | ||
extern "C" ISolverSettings* createRTEulerSettings(IGlobalSettings* globalSettings); | ||
extern "C" ISolverSettings* createRTRKSettings(IGlobalSettings* globalSettings); | ||
extern "C" IAlgLoopSolver* createKinsol(IAlgLoop* algLoop, INonLinSolverSettings* settings); | ||
extern "C" INonLinSolverSettings* createKinsolSettings(); | ||
extern "C" IMixedSystem* createModelicaSystem(IGlobalSettings* globalSettings, boost::shared_ptr<IAlgLoopSolverFactory> nonlinsolver, boost::shared_ptr<ISimData> simdata); | ||
|
||
VxWorksFactory::VxWorksFactory(string library_path, string modelicasystem_path) | ||
: _library_path(library_path) | ||
, _modelicasystem_path(modelicasystem_path) | ||
{ | ||
} | ||
|
||
VxWorksFactory::~VxWorksFactory() | ||
{ | ||
} | ||
|
||
boost::shared_ptr<ISimController> VxWorksFactory::LoadSimController() | ||
{ | ||
ISimController* simController = createSimController(_library_path, _modelicasystem_path); | ||
return boost::shared_ptr<ISimController>(simController); | ||
} | ||
|
||
boost::shared_ptr<ISettingsFactory> VxWorksFactory::LoadSettingsFactory() | ||
{ | ||
ISettingsFactory* settingsFactory = createSettingsFactory(_library_path, _modelicasystem_path); | ||
return boost::shared_ptr<ISettingsFactory>(settingsFactory); | ||
} | ||
|
||
boost::shared_ptr<IAlgLoopSolverFactory> VxWorksFactory::LoadAlgLoopSolverFactory(IGlobalSettings* globalSettings) | ||
{ | ||
IAlgLoopSolverFactory* algloopsolverFactory = createAlgLoopSolverFactory(globalSettings, _library_path, _modelicasystem_path); | ||
return boost::shared_ptr<IAlgLoopSolverFactory>(algloopsolverFactory); | ||
|
||
} | ||
|
||
boost::shared_ptr<IMixedSystem> VxWorksFactory::LoadSystem(IGlobalSettings* globalSettings, boost::shared_ptr<IAlgLoopSolverFactory> nonlinsolver, boost::shared_ptr<ISimData> simData) | ||
{ | ||
IMixedSystem* system = createModelicaSystem(globalSettings, nonlinsolver, simData); | ||
return boost::shared_ptr<IMixedSystem>(system); | ||
} | ||
|
||
boost::shared_ptr<ISimData> VxWorksFactory::LoadSimData() | ||
{ | ||
ISimData* simData = createSimData(); | ||
return boost::shared_ptr<ISimData>(simData); | ||
} | ||
|
||
boost::shared_ptr<ISolver> VxWorksFactory::LoadSolver(IMixedSystem* system, string solver_name,boost::shared_ptr<ISolverSettings> solver_settings) | ||
{ | ||
ISolver* solver; | ||
if (solver_name.compare("createRTEuler") == 0) | ||
{ | ||
solver = createRTEuler(system, solver_settings.get()); | ||
} | ||
else if (solver_name.compare("createRTRK") == 0) | ||
{ | ||
solver = createRTRK(system, solver_settings.get()); | ||
} | ||
else | ||
{ | ||
} | ||
|
||
return boost::shared_ptr<ISolver>(solver); | ||
} | ||
|
||
boost::shared_ptr<ISolverSettings> VxWorksFactory::LoadSolverSettings(string solver_name,boost::shared_ptr<IGlobalSettings> global_settings) | ||
{ | ||
ISolverSettings* solver_settings; | ||
if (solver_name.compare("createRTEulerSettings") == 0) | ||
{ | ||
solver_settings = createRTEulerSettings(global_settings.get()); | ||
} | ||
else if (solver_name.compare("createRTRKSettings") == 0) | ||
{ | ||
solver_settings = createRTRKSettings(global_settings.get()); | ||
} | ||
else | ||
{ | ||
|
||
} | ||
return boost::shared_ptr<ISolverSettings>(solver_settings); | ||
} | ||
|
||
boost::shared_ptr<IAlgLoopSolver> VxWorksFactory::LoadAlgLoopSolver(IAlgLoop* algLoop, string solver_name, boost::shared_ptr<INonLinSolverSettings> solver_settings) | ||
{ | ||
IAlgLoopSolver* algloopsolver; | ||
if (solver_name.compare("createNewton") == 0) | ||
{ | ||
//algloopsolver = createNewton(algLoop, solver_settings.get()); | ||
} | ||
else if (solver_name.compare("createKinsol") == 0) | ||
{ | ||
algloopsolver = createKinsol(algLoop, solver_settings.get()); | ||
} | ||
else | ||
{ | ||
} | ||
|
||
return boost::shared_ptr<IAlgLoopSolver>(algloopsolver); | ||
} | ||
|
||
boost::shared_ptr<INonLinSolverSettings> VxWorksFactory::LoadAlgLoopSolverSettings(string solver_name) | ||
{ | ||
INonLinSolverSettings* solver_settings; | ||
if (solver_name.compare("createNewtonSettings") == 0) | ||
{ | ||
//solver_settings = createNewtonSettings(); | ||
} | ||
else if (solver_name.compare("createKinsolSettings") == 0) | ||
{ | ||
solver_settings = createKinsolSettings(); | ||
} | ||
else | ||
{ | ||
|
||
} | ||
return boost::shared_ptr<INonLinSolverSettings>(solver_settings); | ||
#include <SimCoreFactory/VxWorksFactory/VxWorksFactory.h> | ||
|
||
extern "C" ISimController* createSimController(PATH library_path, PATH modelicasystem_path); | ||
extern "C" ISettingsFactory* createSettingsFactory(PATH library_path,PATH modelicasystem_path); | ||
extern "C" IAlgLoopSolverFactory* createAlgLoopSolverFactory(IGlobalSettings* globalSettings,PATH library_path,PATH modelicasystem_path); | ||
extern "C" ISimData* createSimData(); | ||
extern "C" IMixedSystem* createModelCG(IGlobalSettings* globalSettings, boost::shared_ptr<IAlgLoopSolverFactory> nonlinsolverfactor, boost::shared_ptr<ISimData> simData); | ||
extern "C" ISolver* createRTEuler(IMixedSystem* system, ISolverSettings* settings); | ||
extern "C" ISolver* createRTRK(IMixedSystem* system, ISolverSettings* settings); | ||
extern "C" ISolverSettings* createRTEulerSettings(IGlobalSettings* globalSettings); | ||
extern "C" ISolverSettings* createRTRKSettings(IGlobalSettings* globalSettings); | ||
extern "C" IAlgLoopSolver* createKinsol(IAlgLoop* algLoop, INonLinSolverSettings* settings); | ||
extern "C" INonLinSolverSettings* createKinsolSettings(); | ||
extern "C" IMixedSystem* createModelicaSystem(IGlobalSettings* globalSettings, boost::shared_ptr<IAlgLoopSolverFactory> nonlinsolver, boost::shared_ptr<ISimData> simdata); | ||
|
||
VxWorksFactory::VxWorksFactory(string library_path, string modelicasystem_path) | ||
: _library_path(library_path) | ||
, _modelicasystem_path(modelicasystem_path) | ||
{ | ||
} | ||
|
||
VxWorksFactory::~VxWorksFactory() | ||
{ | ||
} | ||
|
||
boost::shared_ptr<ISimController> VxWorksFactory::LoadSimController() | ||
{ | ||
ISimController* simController = createSimController(_library_path, _modelicasystem_path); | ||
return boost::shared_ptr<ISimController>(simController); | ||
} | ||
|
||
boost::shared_ptr<ISettingsFactory> VxWorksFactory::LoadSettingsFactory() | ||
{ | ||
ISettingsFactory* settingsFactory = createSettingsFactory(_library_path, _modelicasystem_path); | ||
return boost::shared_ptr<ISettingsFactory>(settingsFactory); | ||
} | ||
|
||
boost::shared_ptr<IAlgLoopSolverFactory> VxWorksFactory::LoadAlgLoopSolverFactory(IGlobalSettings* globalSettings) | ||
{ | ||
IAlgLoopSolverFactory* algloopsolverFactory = createAlgLoopSolverFactory(globalSettings, _library_path, _modelicasystem_path); | ||
return boost::shared_ptr<IAlgLoopSolverFactory>(algloopsolverFactory); | ||
|
||
} | ||
|
||
boost::shared_ptr<IMixedSystem> VxWorksFactory::LoadSystem(IGlobalSettings* globalSettings, boost::shared_ptr<IAlgLoopSolverFactory> nonlinsolver, boost::shared_ptr<ISimData> simData) | ||
{ | ||
IMixedSystem* system = createModelicaSystem(globalSettings, nonlinsolver, simData); | ||
return boost::shared_ptr<IMixedSystem>(system); | ||
} | ||
|
||
boost::shared_ptr<ISimData> VxWorksFactory::LoadSimData() | ||
{ | ||
ISimData* simData = createSimData(); | ||
return boost::shared_ptr<ISimData>(simData); | ||
} | ||
|
||
boost::shared_ptr<ISolver> VxWorksFactory::LoadSolver(IMixedSystem* system, string solver_name,boost::shared_ptr<ISolverSettings> solver_settings) | ||
{ | ||
ISolver* solver; | ||
if (solver_name.compare("createRTEuler") == 0) | ||
{ | ||
solver = createRTEuler(system, solver_settings.get()); | ||
} | ||
else if (solver_name.compare("createRTRK") == 0) | ||
{ | ||
solver = createRTRK(system, solver_settings.get()); | ||
} | ||
else | ||
{ | ||
} | ||
|
||
return boost::shared_ptr<ISolver>(solver); | ||
} | ||
|
||
boost::shared_ptr<ISolverSettings> VxWorksFactory::LoadSolverSettings(string solver_name,boost::shared_ptr<IGlobalSettings> global_settings) | ||
{ | ||
ISolverSettings* solver_settings; | ||
if (solver_name.compare("createRTEulerSettings") == 0) | ||
{ | ||
solver_settings = createRTEulerSettings(global_settings.get()); | ||
} | ||
else if (solver_name.compare("createRTRKSettings") == 0) | ||
{ | ||
solver_settings = createRTRKSettings(global_settings.get()); | ||
} | ||
else | ||
{ | ||
|
||
} | ||
return boost::shared_ptr<ISolverSettings>(solver_settings); | ||
} | ||
|
||
boost::shared_ptr<IAlgLoopSolver> VxWorksFactory::LoadAlgLoopSolver(IAlgLoop* algLoop, string solver_name, boost::shared_ptr<INonLinSolverSettings> solver_settings) | ||
{ | ||
IAlgLoopSolver* algloopsolver; | ||
if (solver_name.compare("createNewton") == 0) | ||
{ | ||
//algloopsolver = createNewton(algLoop, solver_settings.get()); | ||
} | ||
else if (solver_name.compare("createKinsol") == 0) | ||
{ | ||
algloopsolver = createKinsol(algLoop, solver_settings.get()); | ||
} | ||
else | ||
{ | ||
} | ||
|
||
return boost::shared_ptr<IAlgLoopSolver>(algloopsolver); | ||
} | ||
|
||
boost::shared_ptr<INonLinSolverSettings> VxWorksFactory::LoadAlgLoopSolverSettings(string solver_name) | ||
{ | ||
INonLinSolverSettings* solver_settings; | ||
if (solver_name.compare("createNewtonSettings") == 0) | ||
{ | ||
//solver_settings = createNewtonSettings(); | ||
} | ||
else if (solver_name.compare("createKinsolSettings") == 0) | ||
{ | ||
solver_settings = createKinsolSettings(); | ||
} | ||
else | ||
{ | ||
|
||
} | ||
return boost::shared_ptr<INonLinSolverSettings>(solver_settings); | ||
} |