Changeset e4dbe3b1 in OpenModelica for SimulationRuntime/c/simulation/solver/nonlinearSolverHybrd.c
- Timestamp:
- 2014-12-11T21:50:17+01:00 (10 years ago)
- Branches:
- Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
- Children:
- 7db0bbb
- Parents:
- 44803ecc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SimulationRuntime/c/simulation/solver/nonlinearSolverHybrd.c
rabfc842 re4dbe3b1 45 45 #include "nonlinearSystem.h" 46 46 #include "nonlinearSolverHybrd.h" 47 extern double enorm_(int *n, double *x);47 extern double enorm_(integer *n, double *x); 48 48 49 49 typedef struct DATA_HYBRD … … 92 92 }; 93 93 94 static int wrapper_fvec_hybrj(const int * n, const double* x, double* f, double* fjac, const int* ldjac, const int* iflag, void* data);94 static int wrapper_fvec_hybrj(const integer* n, const double* x, double* f, double* fjac, const integer* ldjac, const integer* iflag, void* data); 95 95 96 96 /*! \fn allocate memory for nonlinear system solver hybrd … … 182 182 * \author wbraun 183 183 */ 184 static void printVector(const double *vector, const int *size, const int logLevel, const char *name)184 static void printVector(const double *vector, const integer *size, const int logLevel, const char *name) 185 185 { 186 186 int i; … … 250 250 double delta_h = sqrt(solverData->epsfcn); 251 251 double delta_hh, delta_hhh, deltaInv; 252 int iflag = 1;252 integer iflag = 1; 253 253 int i, j, l; 254 254 … … 339 339 * 340 340 */ 341 static int wrapper_fvec_hybrj(const int * n, const double* x, double* f, double* fjac, const int* ldjac, const int* iflag, void* dataAndSysNum)341 static int wrapper_fvec_hybrj(const integer* n, const double* x, double* f, double* fjac, const integer* ldjac, const integer* iflag, void* dataAndSysNum) 342 342 { 343 343 int i,j; … … 358 358 /* debug output */ 359 359 if(ACTIVE_STREAM(LOG_NLS_RES)) { 360 infoStreamPrint(LOG_NLS_RES, 0, "-- residual function call %d -- scaling = %d", solverData->nfev, solverData->useXScaling);360 infoStreamPrint(LOG_NLS_RES, 0, "-- residual function call %d -- scaling = %d", (int)solverData->nfev, solverData->useXScaling); 361 361 printVector(x, n, LOG_NLS_RES, "x vector (scaled)"); 362 362 printVector(solverData->xScaled, n, LOG_NLS_RES, "x vector"); … … 365 365 /* call residual function */ 366 366 if(solverData->useXScaling){ 367 (systemData->residualFunc)(data, (const double*) solverData->xScaled, f, iflag);367 (systemData->residualFunc)(data, (const double*) solverData->xScaled, f, (const int*)iflag); 368 368 } else { 369 (systemData->residualFunc)(data, x, f, iflag);369 (systemData->residualFunc)(data, x, f, (const int*)iflag); 370 370 } 371 371 … … 373 373 if(ACTIVE_STREAM(LOG_NLS_RES)) { 374 374 printVector(f, n, LOG_NLS_RES, "residuals"); 375 infoStreamPrint(LOG_NLS_RES, 0, "-- end of residual function call %d --", solverData->nfev);375 infoStreamPrint(LOG_NLS_RES, 0, "-- end of residual function call %d --", (int)solverData->nfev); 376 376 } 377 377 … … 387 387 /* call apropreated jacobain function */ 388 388 if(systemData->jacobianIndex != -1){ 389 int iflagtmp = 1;389 integer iflagtmp = 1; 390 390 wrapper_fvec_hybrj(n, x, f, fjac, ldjac, &iflagtmp, dataSys); 391 391 … … 403 403 { 404 404 char buffer[16384]; 405 infoStreamPrint(LOG_NLS_JAC, 1, "jacobian matrix [%dx%d]", *n,*n);405 infoStreamPrint(LOG_NLS_JAC, 1, "jacobian matrix [%dx%d]", (int)*n, (int)*n); 406 406 for(i=0; i<*n; i++) 407 407 { … … 420 420 421 421 default: 422 throwStreamPrint(data->threadData, "Well, this is embarrasing. The non-linear solver should never call this case.%d", *iflag);422 throwStreamPrint(data->threadData, "Well, this is embarrasing. The non-linear solver should never call this case.%d", (int)*iflag); 423 423 break; 424 424 } … … 446 446 447 447 int i, j; 448 int iflag = 1;448 integer iflag = 1; 449 449 double xerror, xerror_scaled; 450 450 int success = 0;
Note: See TracChangeset
for help on using the changeset viewer.