Ignore:
Timestamp:
2014-12-11T21:50:17+01:00 (10 years ago)
Author:
Adrian Pop <adrian.pop@…>
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
Message:
  • return something in SimulationRuntime/c/util/integer_array.c
  • hopefully fix condition in SimulationRuntime/c/simulation/solver/initialization/initialization.c
  • try to use proper data types in function interfaces
  • get rid of some of the warnings
  • transform to char* where needed

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23747 f25d12d1-65f4-0310-ae8a-bbce733d8d8e

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SimulationRuntime/c/simulation/solver/nonlinearSolverHybrd.c

    rabfc842 re4dbe3b1  
    4545#include "nonlinearSystem.h"
    4646#include "nonlinearSolverHybrd.h"
    47 extern double enorm_(int *n, double *x);
     47extern double enorm_(integer *n, double *x);
    4848
    4949typedef struct DATA_HYBRD
     
    9292};
    9393
    94 static int wrapper_fvec_hybrj(const int* n, const double* x, double* f, double* fjac, const int* ldjac, const int* iflag, void* data);
     94static int wrapper_fvec_hybrj(const integer* n, const double* x, double* f, double* fjac, const integer* ldjac, const integer* iflag, void* data);
    9595
    9696/*! \fn allocate memory for nonlinear system solver hybrd
     
    182182 *  \author wbraun
    183183 */
    184 static void printVector(const double *vector, const int *size, const int logLevel, const char *name)
     184static void printVector(const double *vector, const integer *size, const int logLevel, const char *name)
    185185{
    186186  int i;
     
    250250  double delta_h = sqrt(solverData->epsfcn);
    251251  double delta_hh, delta_hhh, deltaInv;
    252   int iflag = 1;
     252  integer iflag = 1;
    253253  int i, j, l;
    254254
     
    339339 *
    340340 */
    341 static int wrapper_fvec_hybrj(const int* n, const double* x, double* f, double* fjac, const int* ldjac, const int* iflag, void* dataAndSysNum)
     341static int wrapper_fvec_hybrj(const integer* n, const double* x, double* f, double* fjac, const integer* ldjac, const integer* iflag, void* dataAndSysNum)
    342342{
    343343  int i,j;
     
    358358    /* debug output */
    359359    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);
    361361      printVector(x, n, LOG_NLS_RES, "x vector (scaled)");
    362362      printVector(solverData->xScaled, n, LOG_NLS_RES, "x vector");
     
    365365    /* call residual function */
    366366    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);
    368368    } else {
    369       (systemData->residualFunc)(data, x, f, iflag);
     369      (systemData->residualFunc)(data, x, f, (const int*)iflag);
    370370    }
    371371
     
    373373    if(ACTIVE_STREAM(LOG_NLS_RES)) {
    374374      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);
    376376    }
    377377
     
    387387    /* call apropreated jacobain function */
    388388    if(systemData->jacobianIndex != -1){
    389       int iflagtmp = 1;
     389      integer iflagtmp = 1;
    390390      wrapper_fvec_hybrj(n, x, f, fjac, ldjac, &iflagtmp, dataSys);
    391391
     
    403403      {
    404404        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);
    406406        for(i=0; i<*n; i++)
    407407        {
     
    420420
    421421  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);
    423423    break;
    424424  }
     
    446446
    447447  int i, j;
    448   int iflag = 1;
     448  integer iflag = 1;
    449449  double xerror, xerror_scaled;
    450450  int success = 0;
Note: See TracChangeset for help on using the changeset viewer.