Skip to content

Commit

Permalink
- switched to lapack library instead using internal copy
Browse files Browse the repository at this point in the history
 - fixed some compiling warning (clang)


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15293 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed Feb 24, 2013
1 parent e2bb310 commit c1aebce
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 25 deletions.
16 changes: 16 additions & 0 deletions SimulationRuntime/c/openmodelica_func.h
Expand Up @@ -76,6 +76,22 @@ extern void callExternalObjectDestructors(DATA *_data);
*/
extern void initialNonLinearSystem(NONLINEAR_SYSTEM_DATA *data);

/*! \fn initialLinearSystem
*
* This function initialize nonlinear system structure.
*
* \param [ref] [data]
*/
extern void initialLinearSystem(LINEAR_SYSTEM_DATA *data);

/*! \fn initialNonLinearSystem
*
* This function initialize nonlinear system structure.
*
* \param [ref] [data]
*/
extern void initialMixedSystem(MIXED_SYSTEM_DATA *data);

/*! \fn initialNonLinearSystem
*
* This function initialize state set structure.
Expand Down
20 changes: 10 additions & 10 deletions SimulationRuntime/c/simulation/solver/dassl.c
Expand Up @@ -385,7 +385,7 @@ int dasrt_step(DATA* simData, SOLVER_INFO* solverInfo)
solverInfo->currentTime = solverInfo->currentTime + solverInfo->currentStepSize;
sData->timeValue = solverInfo->currentTime;
functionODE(simData);
WARNING1(LOG_DDASRT, "can't continue. time = %f", sData->timeValue);
WARNING1(LOG_STDOUT, "can't continue. time = %f", sData->timeValue);
return retVal;
}

Expand Down Expand Up @@ -440,7 +440,7 @@ continue_DASRT(fortran_integer* idid, double* atol)
retValue = 1; /* adrpo: try to continue */
break;
case -2:
WARNING(LOG_DDASRT, "The error tolerances are too stringent");
WARNING(LOG_STDOUT, "The error tolerances are too stringent");
retValue = -2;
break;
case -3:
Expand All @@ -449,35 +449,35 @@ continue_DASRT(fortran_integer* idid, double* atol)
retValue = -3;
break;
case -6:
WARNING(LOG_DDASRT, "DDASSL had repeated error test failures on the last attempted step.");
WARNING(LOG_STDOUT, "DDASSL had repeated error test failures on the last attempted step.");
retValue = -6;
break;
case -7:
WARNING(LOG_DDASRT, "The corrector could not converge.");
WARNING(LOG_STDOUT, "The corrector could not converge.");
retValue = -7;
break;
case -8:
WARNING(LOG_DDASRT, "The matrix of partial derivatives is singular.");
WARNING(LOG_STDOUT, "The matrix of partial derivatives is singular.");
retValue = -8;
break;
case -9:
WARNING(LOG_DDASRT, "The corrector could not converge. There were repeated error test failures in this step.");
WARNING(LOG_STDOUT, "The corrector could not converge. There were repeated error test failures in this step.");
retValue = -9;
break;
case -10:
INFO(LOG_DDASRT, "The corrector could not converge because IRES was equal to minus one.");
INFO(LOG_STDOUT, "The corrector could not converge because IRES was equal to minus one.");
retValue = -10;
break;
case -11:
WARNING(LOG_DDASRT, "IRES equal to -2 was encountered and control is being returned to the calling program.");
WARNING(LOG_STDOUT, "IRES equal to -2 was encountered and control is being returned to the calling program.");
retValue = -11;
break;
case -12:
WARNING(LOG_DDASRT, "DDASSL failed to compute the initial YPRIME.");
WARNING(LOG_STDOUT, "DDASSL failed to compute the initial YPRIME.");
retValue = -12;
break;
case -33:
WARNING(LOG_DDASRT, "The code has encountered trouble from which it cannot recover.");
WARNING(LOG_STDOUT, "The code has encountered trouble from which it cannot recover.");
retValue = -33;
break;
}
Expand Down
16 changes: 8 additions & 8 deletions SimulationRuntime/c/simulation/solver/linearSolverLapack.c
Expand Up @@ -106,14 +106,14 @@ int solveLapack(DATA *data, int sysNumber)
/* update vector b (rhs) */
systemData->setb(data, systemData);

_omc_dgesv_((integer*) &systemData->size,
(integer*) &solverData->nrhs,
systemData->A,
(integer*) &systemData->size,
solverData->ipiv,
systemData->b,
(integer*) &systemData->size,
&solverData->info);
dgesv_( (integer*) &systemData->size,
(integer*) &solverData->nrhs,
systemData->A,
(integer*) &systemData->size,
solverData->ipiv,
systemData->b,
(integer*) &systemData->size,
&solverData->info);

if(solverData->info < 0) {
data->simulationInfo.found_solution = -3;
Expand Down
8 changes: 4 additions & 4 deletions SimulationRuntime/c/simulation/solver/linearSolverLapack.h
Expand Up @@ -29,11 +29,11 @@
*
*/

/*! \file nonlinearSolverHybrd.h
/*! \file linearSolverLapack.h
*/

#ifndef _NONLINEARSOLVERHYBRD_H_
#define _NONLINEARSOLVERHYBRD_H_
#ifndef _LINEARSOLVERLAPACK_H_
#define _LINEARSOLVERLAPACK_H_

#include "simulation_data.h"

Expand All @@ -48,7 +48,7 @@ extern "C" {
#endif

extern
int _omc_dgesv_(integer *n, integer *nrhs, doublereal *a, integer
int dgesv_(integer *n, integer *nrhs, doublereal *a, integer
*lda, integer *ipiv, doublereal *b, integer *ldb, integer *info);

#ifdef __cplusplus
Expand Down
3 changes: 1 addition & 2 deletions SimulationRuntime/c/simulation/solver/model_help.c
Expand Up @@ -34,11 +34,10 @@
#include <float.h>

#include "simulation_data.h"
#include "model_help.h"
#include "openmodelica_func.h"
#include "omc_error.h"
#include "delay.h"
#include "varinfo.h"
#include "model_help.h"

static const int IterationMax = 200;
const size_t SIZERINGBUFFER = 3;
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/simulation/solver/solver_main.c
Expand Up @@ -111,7 +111,6 @@ int solver_main_step(DATA* data, SOLVER_INFO* solverInfo)
return lobatto6_step(data, solverInfo);
#endif

default:
case 1:
return euler_ex_step(data, solverInfo);
}
Expand Down Expand Up @@ -688,6 +687,7 @@ int finishSimulation(DATA* data, SOLVER_INFO* solverInfo, const char* outputVari

rt_tick(SIM_TIMER_TOTAL);
}
return retValue;
}

/*! \fn solver_main
Expand Down

0 comments on commit c1aebce

Please sign in to comment.