Skip to content

Commit

Permalink
[Janitor mode] Fix tabs
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19450 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
OpenModelica-Hudson committed Mar 5, 2014
1 parent b8b4f38 commit 4d92d06
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 104 deletions.
130 changes: 65 additions & 65 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -575,17 +575,17 @@ case SIMCODE(modelInfo=MODELINFO(__)) then
case {} then
<<
int <%classname%>StateSelection::getDimStateSets() const
{
return 0;
}
int <%classname%>StateSelection::getDimCanditates() const
{
return 0;
}
int <%classname%>StateSelection::getDimDummyStates() const
{
return 0;
}
{
return 0;
}
int <%classname%>StateSelection::getDimCanditates() const
{
return 0;
}
int <%classname%>StateSelection::getDimDummyStates() const
{
return 0;
}
>>
else
let statesets = (stateSets |> set hasindex i1 fromindex 0 => (match set
Expand All @@ -595,18 +595,18 @@ case SIMCODE(modelInfo=MODELINFO(__)) then
<<


int <%classname%>StateSelection::getDimStateSets() const
{
return <%nStates%>;
}
int <%classname%>StateSelection::getDimCanditates() const
{
return <%nCandidates%>;
}
int <%classname%>StateSelection::getDimDummyStates() const
{
return <%nCandidates%>-<%nStates%>;
}
int <%classname%>StateSelection::getDimStateSets() const
{
return <%nStates%>;
}
int <%classname%>StateSelection::getDimCanditates() const
{
return <%nCandidates%>;
}
int <%classname%>StateSelection::getDimDummyStates() const
{
return <%nCandidates%>-<%nStates%>;
}
>>
)
;separator="\n\n")
Expand All @@ -627,30 +627,30 @@ case SIMCODE(modelInfo=MODELINFO(__)) then
case {} then
<<
void <%classname%>StateSelection::getStates(double* z)
{
}
void <%classname%>StateSelection::setStates(const double* z)
{
}
{
}
void <%classname%>StateSelection::setStates(const double* z)
{
}
void <%classname%>StateSelection::getStateCanditates(double* z)
{
}
void <%classname%>StateSelection::getAMatrix(multi_array<int,2> & A)
{
{
}
void <%classname%>StateSelection::setAMatrix(multi_array<int,2>& A)
{
}
void <%classname%>StateSelection::initialize()
{
}
}
void <%classname%>StateSelection::setAMatrix(multi_array<int,2>& A)
{
}
void <%classname%>StateSelection::initialize()
{
}
>>
else
let stateset = (stateSets |> set hasindex i1 fromindex 0 => (match set
Expand All @@ -661,30 +661,30 @@ case SIMCODE(modelInfo=MODELINFO(__)) then

<<
void <%classname%>StateSelection::getStates(double* z)
{
<%statesvarsset%>
}
void <%classname%>StateSelection::setStates(const double* z)
{
<%statesvarsget%>
}
{
<%statesvarsset%>
}
void <%classname%>StateSelection::setStates(const double* z)
{
<%statesvarsget%>
}
void <%classname%>StateSelection::getStateCanditates(double* z)
{
<%statescandidatesvarsset%>
<%statescandidatesvarsset%>
}
void <%classname%>StateSelection::getAMatrix(multi_array<int,2> & A)
{
assign_array(A,<%arraycref(crA)%>);
{
assign_array(A,<%arraycref(crA)%>);
}
void <%classname%>StateSelection::setAMatrix(multi_array<int,2>& A)
{
assign_array(<%arraycref(crA)%>,A);
}
void <%classname%>StateSelection::initialize()
{
fill_array<int,2 >( <%arraycref(crA)%>,0);
}
}
void <%classname%>StateSelection::setAMatrix(multi_array<int,2>& A)
{
assign_array(<%arraycref(crA)%>,A);
}
void <%classname%>StateSelection::initialize()
{
fill_array<int,2 >( <%arraycref(crA)%>,0);
}
>>


Expand All @@ -696,7 +696,7 @@ case SIMCODE(modelInfo=MODELINFO(__)) then

<<


<%stateset%>

Expand Down Expand Up @@ -8923,9 +8923,9 @@ case _ then

let jacvals = ( sparsepattern |> (cref,indexes) hasindex index0 =>
let jaccol = ( indexes |> i_index =>
(match indexColumn case "1" then ' _<%matrixName%>jacobian(<%crefWithoutIndexOperator(cref,simCode)%>$pDER<%matrixName%>$indexdiff,0) = _<%matrixName%>jac_y(0);'
else ' _<%matrixName%>jacobian(<%index0%>,<%crefWithoutIndexOperator(cref,simCode)%>$pDER<%matrixName%>$indexdiff) = _<%matrixName%>jac_y(<%crefWithoutIndexOperator(cref,simCode)%>$pDER<%matrixName%>$indexdiff);'
)
(match indexColumn case "1" then ' _<%matrixName%>jacobian(<%crefWithoutIndexOperator(cref,simCode)%>$pDER<%matrixName%>$indexdiff,0) = _<%matrixName%>jac_y(0);'
else ' _<%matrixName%>jacobian(<%index0%>,<%crefWithoutIndexOperator(cref,simCode)%>$pDER<%matrixName%>$indexdiff) = _<%matrixName%>jac_y(<%crefWithoutIndexOperator(cref,simCode)%>$pDER<%matrixName%>$indexdiff);'
)
;separator="\n" )


Expand Down
6 changes: 3 additions & 3 deletions SimulationRuntime/cpp/Core/SimController/Initialization.cpp
Expand Up @@ -15,7 +15,7 @@ Initialization::~Initialization(void)
void Initialization::initializeSystem()
{

boost::shared_ptr<IContinuous> continous_system = boost::dynamic_pointer_cast<IContinuous>(_system);
boost::shared_ptr<IContinuous> continous_system = boost::dynamic_pointer_cast<IContinuous>(_system);
boost::shared_ptr<IEvent> event_system =boost::dynamic_pointer_cast<IEvent>(_system);
boost::shared_ptr<IMixedSystem> mixed_system = boost::dynamic_pointer_cast<IMixedSystem>(_system);
int dim = event_system->getDimZeroFunc();
Expand All @@ -25,8 +25,8 @@ void Initialization::initializeSystem()
_system->setInitial(true);
//Initialization of continous equations and bounded parameters

_system->initialize();
_solver->stateSelection();
_system->initialize();
_solver->stateSelection();
bool restart=true;
int iter=0;
bool cond_restart = true;
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/cpp/Core/SimController/Initialization.h
Expand Up @@ -9,6 +9,6 @@ class Initialization
private:

boost::shared_ptr<ISystemInitialization> _system;
boost::shared_ptr<ISolver> _solver;
boost::shared_ptr<ISolver> _solver;
};

Expand Up @@ -75,7 +75,7 @@ SolverDefaultImplementation::~SolverDefaultImplementation()
{
return _solverStatus;
};
bool SolverDefaultImplementation::stateSelection()
{
return _state_selection->stateSelection(1);
Expand Down
48 changes: 24 additions & 24 deletions SimulationRuntime/cpp/Core/Solver/SystemStateSelection.cpp
Expand Up @@ -14,7 +14,7 @@ SystemStateSelection::SystemStateSelection(IMixedSystem* system)
{
_state_selection = dynamic_cast<IStateSelection*>(system);
if ( !_state_selection)
throw std::invalid_argument("No state selection system");
throw std::invalid_argument("No state selection system");
}
void SystemStateSelection::initialize()
{
Expand All @@ -40,33 +40,33 @@ SystemStateSelection::~SystemStateSelection()

bool SystemStateSelection::stateSelection(int switchStates)
{
if(!_initialized)
initialize();
int res=0;
if(!_initialized)
initialize();
int res=0;

int* oldColPivot = new int[_dimStateCanditates];
int* oldRowPivot = new int[_dimDummyStates];
SparseMatrix stateset_matrix;
_system->getStateSetJacobian(stateset_matrix);
/* call pivoting function to select the states */
_system->getStateSetJacobian(stateset_matrix);
/* call pivoting function to select the states */
memcpy(oldColPivot,_colPivot, _dimStateCanditates*sizeof(int));
memcpy(oldRowPivot, _rowPivot, _dimDummyStates*sizeof(int));
/*workarround for c array*/
double* jac = new double[_dimDummyStates*_dimStateCanditates];
for(int i=0;i<_dimStateCanditates;i++)
for(int j= 0;j<_dimDummyStates;j++)
jac[i*_dimDummyStates+j]=stateset_matrix(i,j);
if((pivot(jac, _dimDummyStates, _dimStateCanditates, _rowPivot, _colPivot) != 0))
/*workarround for c array*/
double* jac = new double[_dimDummyStates*_dimStateCanditates];
for(int i=0;i<_dimStateCanditates;i++)
for(int j= 0;j<_dimDummyStates;j++)
jac[i*_dimDummyStates+j]=stateset_matrix(i,j);
if((pivot(jac, _dimDummyStates, _dimStateCanditates, _rowPivot, _colPivot) != 0))
{
throw std::invalid_argument("Error, singular Jacobian for dynamic state selection at time");
}
/* if we have a new set throw event for reinitialization
throw std::invalid_argument("Error, singular Jacobian for dynamic state selection at time");
}
/* if we have a new set throw event for reinitialization
and set the A matrix for set.x=A*(states) */
res = comparePivot(oldColPivot, _colPivot, switchStates);
if(!switchStates)
Expand All @@ -76,11 +76,11 @@ bool SystemStateSelection::stateSelection(int switchStates)
}
delete [] oldColPivot;
delete [] oldRowPivot;
if(res)
return true;
else
return false;
else
return false;
}

void SystemStateSelection::setAMatrix(int* newEnable)
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/cpp/Include/Core/Solver/ISolver.h
Expand Up @@ -62,7 +62,7 @@ class ISolver

/// (Re-) initialize the solver
virtual void initialize() = 0;
virtual bool stateSelection() = 0;
virtual bool stateSelection() = 0;
/// Approximation of the numerical solution in a given time interval
virtual void solve(const SOLVERCALL command = UNDEF_CALL) = 0;

Expand Down
Expand Up @@ -59,7 +59,7 @@ class BOOST_EXTENSION_SOLVER_DECL SolverDefaultImplementation

/// Called by solver after every successfull integration step (calls writeOutput)
void writeToFile(const int& stp, const double& t, const double& h);
virtual bool stateSelection();
virtual bool stateSelection();

protected:
// Member variables
Expand Down Expand Up @@ -121,8 +121,8 @@ class BOOST_EXTENSION_SOLVER_DECL SolverDefaultImplementation

private:

/// Definition of signum function
/// Definition of signum function
inline static int sgn (const double &c)
{
return (c < 0) ? -1 : ((c == 0) ? 0 : 1);
Expand Down
Expand Up @@ -9,7 +9,7 @@ class BOOST_EXTENSION_STATESELECT_DECL SystemStateSelection
~SystemStateSelection();

bool stateSelection(int switchStates);
void initialize();
void initialize();
private:

void setAMatrix(int* newEnable);
Expand All @@ -21,8 +21,8 @@ class BOOST_EXTENSION_STATESELECT_DECL SystemStateSelection
int* _rowPivot;
int* _colPivot;
unsigned int _dimStates;
unsigned int _dimDummyStates;
unsigned int _dimStateCanditates;
bool _initialized;
unsigned int _dimDummyStates;
unsigned int _dimStateCanditates;
bool _initialized;
};

4 changes: 2 additions & 2 deletions SimulationRuntime/cpp/Solver/CVode/CVode.cpp
Expand Up @@ -243,7 +243,7 @@ void Cvode::solve(const SOLVERCALL action)

// Solverstart
CVodeCore();
}

// Integration war nicht erfolgreich und wurde auch nicht vom User unterbrochen
Expand Down Expand Up @@ -426,7 +426,7 @@ int Cvode::calcFunction(const double& time, const double* y, double* f)
_continuous_system->setContinuousStates(y);
_continuous_system->evaluate(IContinuous::CONTINUOUS);
_continuous_system->getRHS(f);
}//workaround until exception can be catch from c- libraries
catch(std::exception& ex)
{
Expand Down

0 comments on commit 4d92d06

Please sign in to comment.