Changeset eff3237 in OpenModelica


Ignore:
Timestamp:
2020-10-21T15:14:35+02:00 (3 years ago)
Author:
Adrian Pop <adrian.pop@…>
Children:
ca0708d0
Parents:
22914a1b
git-author:
AnHeuermann <andreas.heuermann@…> (10/08/20 12:44:36)
git-committer:
Adrian Pop <adrian.pop@…> (10/21/20 15:14:35)
Message:

Catch error in initalization and close message and file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/SimulationRuntime/c/simulation/solver/initialization/initialization.c

    r28e9af2c reff3237  
    276276    char buffer[4096];
    277277    double lambda;
     278    int success = 0;
    278279
    279280    infoStreamPrint(LOG_INIT_HOMOTOPY, 0, "Global homotopy with equidistant step size started.");
     
    295296
    296297    infoStreamPrint(LOG_INIT_HOMOTOPY, 1, "homotopy process\n---------------------------");
     298    /* try */
     299#ifndef OMC_EMCC
     300  MMC_TRY_INTERNAL(simulationJumpBuffer)
     301#endif
    297302    for(step=0; step<init_lambda_steps; ++step)
    298303    {
     
    326331#endif
    327332    }
     333    success = 1;
     334    /* catch */
     335#ifndef OMC_EMCC
     336  MMC_CATCH_INTERNAL(simulationJumpBuffer)
     337#endif
     338    /* Error handling in case an assert was thrown */
     339    if (!success)
     340    {
     341      messageClose(LOG_INIT_HOMOTOPY);
     342#if !defined(OMC_NO_FILESYSTEM)
     343      if(ACTIVE_STREAM(LOG_INIT_HOMOTOPY))
     344        fclose(pFile);
     345#endif
     346      errorStreamPrint(LOG_ASSERT, 0, "Failed to solve the initialization problem with global homotopy with equidistant step size.");
     347      throwStreamPrint(threadData, "Unable to solve initialization problem.");
     348    }
     349
    328350    data->simulationInfo->homotopySteps += init_lambda_steps;
    329351    messageClose(LOG_INIT_HOMOTOPY);
Note: See TracChangeset for help on using the changeset viewer.