Changeset 15372


Ignore:
Timestamp:
2013-02-27T18:35:22+01:00 (11 years ago)
Author:
lochel
Message:
  • get rid of compiler warnings for c-runtime
  • minor changes (typo, spaces, ...)
Location:
trunk/SimulationRuntime/c
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SimulationRuntime/c/simulation/simulation_runtime.cpp

    r15356 r15372  
    340340  string tmp = ("^(" + varfilter + ")$");
    341341  const char *filter = tmp.c_str(); // C++ strings are horrible to work with...
    342   if(modelData->nStates > 0 && 0 == strcmp(modelData->realVarsData[0].info.name,"$dummy")) {
     342  if(modelData->nStates > 0 && 0 == strcmp(modelData->realVarsData[0].info.name, "$dummy")) {
    343343    modelData->realVarsData[0].filterOutput = 1;
    344344    modelData->realVarsData[modelData->nStates].filterOutput = 1;
     
    583583    retVal = linearize(data);
    584584    rt_accumulate(SIM_TIMER_LINEARIZE);
    585     INFO(LOG_STDOUT,"Linear model is created!");
     585    INFO(LOG_STDOUT, "Linear model is created!");
    586586  }
    587587
     
    602602    rt_accumulate(SIM_TIMER_TOTAL);
    603603    const char* plotFormat = omc_flagValue[FLAG_MEASURETIMEPLOTFORMAT];
    604     retVal = printModelInfo(data, modelInfo.c_str(), plotFile.c_str(), plotFormat ? plotFormat : "svg",
     604    retVal = printModelInfo(data, modelInfo.c_str(), plotFile.c_str(), plotFormat ? plotFormat : "svg", 
    605605        data->simulationInfo.solverMethod, data->simulationInfo.outputFormat, result_file_cstr.c_str()) && retVal;
    606606  }
     
    644644    return 1;
    645645  }
    646   sim_result.init(&sim_result,simData);
    647   INFO2(LOG_SOLVER,"Allocated simulation result data storage for method '%s' and file='%s'", simData->simulationInfo.outputFormat, sim_result.filename);
     646  sim_result.init(&sim_result, simData);
     647  INFO2(LOG_SOLVER, "Allocated simulation result data storage for method '%s' and file='%s'", simData->simulationInfo.outputFormat, sim_result.filename);
    648648  return 0;
    649649}
     
    659659 * "dopri5" calls an embedded DOPRI5(4)-solver with stepsize control
    660660 */
    661 int callSolver(DATA* simData, string result_file_cstr, string init_initMethod,
     661int callSolver(DATA* simData, string result_file_cstr, string init_initMethod, 
    662662    string init_optiMethod, string init_file, double init_time, int lambda_steps, string outputVariablesAtEnd, int cpuTime)
    663663{
     
    730730  } else if(simData->simulationInfo.solverMethod == std::string("qss")) {
    731731    INFO1(LOG_SOLVER, " | Recognized solver: %s.", simData->simulationInfo.solverMethod);
    732     retVal = qss_main(argc, argv, simData->simulationInfo.startTime,
    733                       simData->simulationInfo.stopTime, simData->simulationInfo.stepSize,
     732    retVal = qss_main(argc, argv, simData->simulationInfo.startTime, 
     733                      simData->simulationInfo.stopTime, simData->simulationInfo.stepSize, 
    734734                      simData->simulationInfo.numSteps, simData->simulationInfo.tolerance, 3);
    735735#endif
     
    740740  }
    741741
    742   sim_result.free(&sim_result,simData);
     742  sim_result.free(&sim_result, simData);
    743743
    744744  return retVal;
     
    818818  function_initMemoryState();
    819819  read_input_xml(argc, argv, &(data->modelData), &(data->simulationInfo));
    820   initializeOutputFilter(&(data->modelData),data->simulationInfo.variableFilter);
     820  initializeOutputFilter(&(data->modelData), data->simulationInfo.variableFilter);
    821821
    822822  /* allocate memory for mixed system solvers */
     
    877877  printf("<phase>UNKNOWN</phase>\n");
    878878  printf("<currentStepSize>%g</currentStepSize>\n", data->simulationInfo.stepSize);
    879   printf("<oldTime>%.12g</oldTime>\n",data->localData[1]->timeValue);
    880   printf("<oldTime2>%.12g</oldTime2>\n",data->localData[2]->timeValue);
    881   printf("<diffOldTime>%g</diffOldTime>\n",data->localData[1]->timeValue-data->localData[2]->timeValue);
    882   printf("<currentTime>%g</currentTime>\n",data->localData[0]->timeValue);
    883   printf("<diffCurrentTime>%g</diffCurrentTime>\n",data->localData[0]->timeValue-data->localData[1]->timeValue);
     879  printf("<oldTime>%.12g</oldTime>\n", data->localData[1]->timeValue);
     880  printf("<oldTime2>%.12g</oldTime2>\n", data->localData[2]->timeValue);
     881  printf("<diffOldTime>%g</diffOldTime>\n", data->localData[1]->timeValue-data->localData[2]->timeValue);
     882  printf("<currentTime>%g</currentTime>\n", data->localData[0]->timeValue);
     883  printf("<diffCurrentTime>%g</diffCurrentTime>\n", data->localData[0]->timeValue-data->localData[1]->timeValue);
    884884  */
    885885  printf("</status>\n");
  • trunk/SimulationRuntime/c/simulation/solver/linearSolverLapack.c

    r15342 r15372  
    6060
    6161  data->ipiv = (integer*) malloc(size*sizeof(modelica_integer));
    62   ASSERT(data->ipiv, "Could not allocate datae for linear solver lapack.");
     62  ASSERT(data->ipiv, "Could not allocate data for linear solver lapack.");
    6363  data->nrhs = 1;
    6464  data->info = 0;
     
    7474{
    7575  DATA_LAPACK* data = (DATA_LAPACK*) *voiddata;
    76 
     76 
    7777  free(data->ipiv);
    7878
    7979  return 0;
    8080}
    81 
    8281
    8382/*! \fn solve linear system with lapack method
     
    9695   * We want to look it up among all equations. */
    9796  int eqSystemNumber = systemData->equationIndex;
    98 
    9997  int success = 1;
    10098
     
    107105  systemData->setb(data, systemData);
    108106
    109   dgesv_( (integer*) &systemData->size,
    110           (integer*) &solverData->nrhs,
    111           systemData->A,
    112           (integer*) &systemData->size,
    113           solverData->ipiv,
    114           systemData->b,
    115           (integer*) &systemData->size,
    116           &solverData->info);
     107  dgesv_((integer*) &systemData->size,
     108         (integer*) &solverData->nrhs,
     109         systemData->A,
     110         (integer*) &systemData->size,
     111         solverData->ipiv,
     112         systemData->b,
     113         (integer*) &systemData->size,
     114         &solverData->info);
    117115
    118   if(solverData->info < 0) {
     116  if(solverData->info < 0)
     117  {
    119118    WARNING3(LOG_STDOUT, "Error solving linear system of equations (no. %d) at time %f. Argument %d illegal.", (int)systemData->equationIndex, data->localData[0]->timeValue, solverData->info);
    120119    success = 0;
    121   }else if(solverData->info > 0) {
    122     WARNING4(LOG_STDOUT,
    123         "Failed to solve linear system of equations (no. %d) at time %f, system is singular for U[%d,%d].",
     120  }
     121  else if(solverData->info > 0)
     122  {
     123    WARNING4(LOG_STDOUT,
     124        "Failed to solve linear system of equations (no. %d) at time %f, system is singular for U[%d, %d].",
    124125        (int)systemData->equationIndex, data->localData[0]->timeValue, solverData->info+1, solverData->info+1);
    125126
     
    131132      char buffer[4096];
    132133      INDENT(LOG_LS);
    133       DEBUG(LOG_LS,"Matrix U:");
    134       for (l = 0; l < systemData->size; l++)
     134      DEBUG(LOG_LS, "Matrix U:");
     135      for(l = 0; l < systemData->size; l++)
    135136      {
    136137        buffer[0] = 0;
    137         for (k = 0; k < systemData->size; k++)
     138        for(k = 0; k < systemData->size; k++)
    138139          sprintf(buffer, "%s%10g ", buffer, systemData->A[l + k*systemData->size]);
    139         DEBUG(LOG_LS, buffer);
     140        DEBUG1(LOG_LS, "%s", buffer);
    140141      }
    141       DEBUG(LOG_LS,"Solution x:");
     142      DEBUG(LOG_LS, "Solution x:");
    142143      buffer[0] = 0;
    143       for (k = 0; k < systemData->size; k++)
     144      for(k = 0; k < systemData->size; k++)
    144145        sprintf(buffer, "%s%10g ", buffer, systemData->b[k]);
    145       DEBUG(LOG_LS, buffer);
    146       DEBUG(LOG_LS,"Solution x:");
     146      DEBUG1(LOG_LS, "%s", buffer);
     147      DEBUG(LOG_LS, "Solution x:");
    147148      buffer[0] = 0;
    148       for (k = 0; k < systemData->size; k++)
     149      for(k = 0; k < systemData->size; k++)
    149150        sprintf(buffer, "%s%10g ", buffer, systemData->b[k]);
    150       DEBUG(LOG_LS, buffer);
     151      DEBUG1(LOG_LS, "%s", buffer);
    151152      RELEASE(LOG_LS);
    152153    }
     
    158159  memcpy(systemData->x, systemData->b, systemData->size*(sizeof(modelica_real)));
    159160
    160 
    161 
    162161  return success;
    163162}
  • trunk/SimulationRuntime/c/simulation/solver/linearSolverLapack.h

    r15293 r15372  
    3939
    4040#ifdef __cplusplus
    41 extern "C" {
     41  extern "C" {
    4242#endif
    4343
    4444#include "blaswrap.h"
    4545#include "f2c.h"
     46
    4647#ifdef VOID
    47 #undef VOID
     48  #undef VOID
    4849#endif
    4950
    50 extern
    51 int dgesv_(integer *n, integer *nrhs, doublereal *a, integer
    52      *lda, integer *ipiv, doublereal *b, integer *ldb, integer *info);
     51extern int dgesv_(integer *n, integer *nrhs, doublereal *a, integer *lda,
     52                  integer *ipiv, doublereal *b, integer *ldb, integer *info);
    5353
    5454#ifdef __cplusplus
    55 }
     55  }
    5656#endif
    57 
    5857
    5958int allocateLapackData(int size, void **data);
  • trunk/SimulationRuntime/c/simulation/solver/stateset.c

    r15170 r15372  
    193193      for(j=0; j < data->simulationInfo.analyticJacobians[jacIndex].sizeCols; j++)
    194194        sprintf(buffer, "%s%.5e ", buffer, jac[i*data->simulationInfo.analyticJacobians[jacIndex].sizeCols+j]);
    195       DEBUG(LOG_DSS, buffer);
     195      DEBUG1(LOG_DSS, "%s", buffer);
    196196    }
    197197    RELEASE(LOG_DSS);
  • trunk/SimulationRuntime/c/util/omc_error.h

    r15186 r15372  
    6565extern jmp_buf globalJmpbuf;
    6666
    67 /* #define USE_DEBUG_OUTPUT */
     67#define USE_DEBUG_OUTPUT
    6868
    6969enum LOG_STREAM
Note: See TracChangeset for help on using the changeset viewer.