This repository has been archived by the owner on May 18, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed code generation for algebraic loop variables and added it to …
…algebraic loop default solver implementation Belonging to [master]: - #2577
- Loading branch information
1 parent
04d541f
commit c5bc6e5
Showing
36 changed files
with
646 additions
and
450 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
71 changes: 71 additions & 0 deletions
71
SimulationRuntime/cpp/Core/Solver/AlgLoopSolverDefaultImplementation.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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** @addtogroup coreSolver | ||
* | ||
* @{ | ||
*/ | ||
#include <Core/ModelicaDefine.h> | ||
#include <Core/Modelica.h> | ||
#include <Core/Solver/FactoryExport.h> | ||
#include <Core/Solver/AlgLoopSolverDefaultImplementation.h> | ||
|
||
|
||
AlgLoopSolverDefaultImplementation::AlgLoopSolverDefaultImplementation() | ||
:_dimZeroFunc(-1) | ||
, _dimSys(-1) | ||
,_algloopVars(NULL) | ||
,_conditions0(NULL) | ||
,_conditions1(NULL) | ||
{ | ||
|
||
} | ||
|
||
AlgLoopSolverDefaultImplementation::~AlgLoopSolverDefaultImplementation() | ||
{ | ||
if(_algloopVars) | ||
delete [] _algloopVars; | ||
if(_conditions0) | ||
delete [] _conditions0; | ||
if(_conditions1) | ||
delete [] _conditions1; | ||
} | ||
bool* AlgLoopSolverDefaultImplementation::getConditionsWorkArray() | ||
{ | ||
if(_conditions0) | ||
return _conditions0; | ||
else | ||
ModelicaSimulationError(ALGLOOP_SOLVER, "algloop working arrays are not initialized"); | ||
|
||
} | ||
bool* AlgLoopSolverDefaultImplementation::getConditions2WorkArray() | ||
{ | ||
if(_conditions1) | ||
return _conditions1; | ||
else | ||
ModelicaSimulationError(ALGLOOP_SOLVER, "algloop working arrays are not initialized"); | ||
} | ||
|
||
|
||
double* AlgLoopSolverDefaultImplementation::getVariableWorkArray() | ||
{ | ||
if(_algloopVars) | ||
return _algloopVars; | ||
else | ||
ModelicaSimulationError(ALGLOOP_SOLVER, "algloop working arrays are not initialized"); | ||
|
||
} | ||
|
||
void AlgLoopSolverDefaultImplementation::initialize(int dimZeroFunc,int dimSys) | ||
{ | ||
_dimZeroFunc = dimZeroFunc; | ||
if(_conditions0) | ||
delete [] _conditions0; | ||
if(_conditions1) | ||
delete [] _conditions1; | ||
_conditions0 = new bool[_dimZeroFunc]; | ||
_conditions1 = new bool[_dimZeroFunc]; | ||
_dimSys=dimSys; | ||
if(_algloopVars) | ||
delete [] _algloopVars; | ||
_algloopVars = new double[_dimSys]; | ||
memset(_algloopVars, 0, _dimSys*sizeof(double)); | ||
} | ||
/** @} */ // end of coreSolver |
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
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
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
35 changes: 35 additions & 0 deletions
35
SimulationRuntime/cpp/Include/Core/Solver/AlgLoopSolverDefaultImplementation.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma once | ||
/** @addtogroup coreSolver | ||
* | ||
* @{ | ||
*/ | ||
|
||
|
||
/***************************************************************************** | ||
Copyright (c) 2008, OSMC | ||
*****************************************************************************/ | ||
|
||
class BOOST_EXTENSION_SOLVER_DECL AlgLoopSolverDefaultImplementation | ||
{ | ||
public: | ||
AlgLoopSolverDefaultImplementation(); | ||
~AlgLoopSolverDefaultImplementation(); | ||
/// (Re-) initialize the solver | ||
virtual void initialize(int dimZeroFunc,int dimSys); | ||
virtual bool* getConditionsWorkArray(); | ||
virtual bool* getConditions2WorkArray(); | ||
virtual double* getVariableWorkArray(); | ||
protected: | ||
long int _dimZeroFunc; | ||
long int _dimSys; ///< Number of unknowns (=dimension of system of equations) | ||
long int _max_dimSys; | ||
long int _max_dimZeroFunc; | ||
bool _single_instance; | ||
private: | ||
double* _algloopVars; | ||
bool* _conditions0; | ||
bool* _conditions1; | ||
|
||
|
||
}; | ||
/** @} */ // end of coreSolver |
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.