Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 1 / 0 / 1
Functions: -% 0 / 1 / 1
Branches: -% 0 / 0 / 0

OMCompiler/SimulationRuntime/cpp/Core/Solver/ISolver.h
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 #pragma once
29 /** @addtogroup coreSolver
30 *
31 * @{
32 */
33 /*****************************************************************************/
34 /**
35
36 Abstract interface class for numerical time integration methods
37 in open modelica.
38
39 \date October, 1st, 2008
40 \author
41
42 */
43
44 40 class ISolver
45 {
46 public:
47 /// Enumeration to control the time integration
48 enum SOLVERCALL
49 {
50 UNDEF_CALL = 0x00000000,
51 FIRST_CALL = 0x00000100, ///< First call to solver
52 RECALL = 0x00000400, ///< Call to solver after restart (state vector of solver has to be reinitialized
53 RECORDCALL = 0x00004000, ///< Erster Aufruf zum recorden von y0
54 };
55
56 /// Enum to define the current status of the solver
57 enum SOLVERSTATUS
58 {
59 UNDEF_STATUS = 0x00000,
60 CONTINUE = 0x00001, ///< Continue integration
61 USER_STOP = 0x00002, ///< Integration stopped by user
62 SOLVERERROR = 0x00004, ///< An error occurred. Integration was stopped
63 DONE = 0x00008, ///< Integration successfully done
64 };
65
66 /// Enumeration to denote the event status
67 enum ZEROSTATUS
68 {
69 EQUAL_ZERO, ///< Value of zero function smaller than given tolerance (_zeroTol)
70 ZERO_CROSSING, ///< zero crossing = change in sign of zero function
71 NO_ZERO, ///< Even though zero crossing occurred, no value of zero function did not become zero in given interval
72 UNCHANGED_SIGN ///< no zero crossing = continue time integration
73 };
74
75 virtual ~ISolver() {};
76
77 /// Set start time
78 virtual void setStartTime(const double& time) = 0;
79
80 /// Set end time
81 virtual void setEndTime(const double& time) = 0;
82
83 /// Set the initial step size (needed for reinitialization after external zero search)
84 virtual void setInitStepSize(const double& stepSize) = 0;
85
86 /// (Re-) initialize the solver
87 virtual void initialize() = 0;
88 virtual bool stateSelection() = 0;
89 /// Approximation of the numerical solution in a given time interval
90 virtual void solve(const SOLVERCALL command = UNDEF_CALL) = 0;
91
92 /// Provides the status of the solver after returning
93 virtual SOLVERSTATUS getSolverStatus() = 0;
94 ///sets time out in secondsW
95 virtual void setTimeOut(unsigned int time_out) = 0;
96
97 virtual void stop() = 0;
98
99 /// Write out statistical information (statistical information of last simulation, e.g. time, number of steps, etc.)
100 virtual void writeSimulationInfo() = 0;
101
102 /// Indicates whether a solver error occurred during integration, returns type of error and provides error message
103 /*virtual int reportErrorMessage(ostream& messageStream) = 0;*/
104 };
105 /** @} */ // end of coreSolver
106