Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 13
Functions: 0.0% 0 / 0 / 3
Branches: 0.0% 0 / 0 / 24

OMCompiler/SimulationRuntime/cpp/Core/Utils/Modelica/ModelicaSimulationError.cpp
Line Branch Exec Source
1 /*
2 * This file belongs to the OpenModelica Run-Time System
3 *
4 * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC), c/o Linköpings
5 * universitet, Department of Computer and Information Science, SE-58183 Linköping, Sweden. All rights
6 * reserved.
7 *
8 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE
9 * AGPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8. ANY
10 * USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
11 * ACCEPTANCE OF THE BSD NEW LICENSE OR THE OSMC PUBLIC LICENSE OR THE AGPL
12 * VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
13 *
14 * The OpenModelica software and the OSMC (Open Source Modelica Consortium) Public License
15 * (OSMC-PL) are obtained from OSMC, either from the above address, from the URLs:
16 * http://www.openmodelica.org or https://github.com/OpenModelica/ or
17 * http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica distribution. GNU
18 * AGPL version 3 is obtained from: https://www.gnu.org/licenses/licenses.html#GPL. The BSD NEW
19 * License is obtained from: http://www.opensource.org/licenses/BSD-3-Clause.
20 *
21 * This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY
23 * SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF
24 * OSMC-PL.
25 *
26 */
27
28 /** @addtogroup coreUtils
29 *
30 * @{
31 */
32 #include <Core/ModelicaDefine.h>
33 #include <Core/Modelica.h>
34
35 #include <Core/Utils/Modelica/ModelicaSimulationError.h>
36 ✗ string error_id_string(SIMULATION_ERROR id)
37 {
38 std::map<SIMULATION_ERROR, std::string> error_id_info = MAP_LIST_OF
39 SOLVER, "solver" MAP_LIST_SEP
40 ALGLOOP_SOLVER, "algloop solver" MAP_LIST_SEP
41 MODEL_EQ_SYSTEM, "model equation system" MAP_LIST_SEP
42 ALGLOOP_EQ_SYSTEM, "algloop equation system" MAP_LIST_SEP
43 MODEL_FACTORY, "model factory" MAP_LIST_SEP
44 SIMMANAGER, "simulation manager" MAP_LIST_SEP
45 EVENT_HANDLING, "event handling" MAP_LIST_SEP
46 TIME_EVENTS, "time event" MAP_LIST_SEP
47 DATASTORAGE, "data storage" MAP_LIST_SEP
48 UTILITY, "utility" MAP_LIST_SEP
49 MODEL_ARRAY_FUNCTION, "array function" MAP_LIST_SEP
50 ✗ MATH_FUNCTION, "math function" MAP_LIST_END;
51
52 ✗ return error_id_info[id];
53 }
54
55
56 ✗ string add_error_info(string new_info,string info,SIMULATION_ERROR id,double& time)
57 {
58 ✗ ostringstream ss;
59 ✗ ss << new_info << " stopped at time " << time << " with error in " << error_id_string(id) << ": " << std::endl << info;
60 ✗ return ss.str().c_str();
61
62
63 ✗ }
64
65 ✗ string add_error_info(string new_info,string info,SIMULATION_ERROR id)
66 {
67 ✗ ostringstream ss;
68 ✗ ss << new_info << " with error in " << error_id_string(id) << ": " << std::endl << info;
69 ✗ return ss.str().c_str();
70
71
72 ✗ }
73 /** @} */ // end of coreUtils
74