OMCompiler/SimulationRuntime/cpp/Core/DataExchange/Policies/DefaultWriter.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 dataexchangePolicies | ||
| 30 | * | ||
| 31 | * @{ | ||
| 32 | */ | ||
| 33 | |||
| 34 | #include <Core/DataExchange/FactoryPolicy.h> | ||
| 35 | #include <fstream> | ||
| 36 | |||
| 37 | /** | ||
| 38 | Policy class to write simulation results | ||
| 39 | */ | ||
| 40 | |||
| 41 | class DefaultWriter : public ContainerManager | ||
| 42 | { | ||
| 43 | public: | ||
| 44 | DefaultWriter(unsigned long size, string file_name) | ||
| 45 | ✗ | : ContainerManager() | |
| 46 | |||
| 47 | { | ||
| 48 | } | ||
| 49 | |||
| 50 | ✗ | ~DefaultWriter() | |
| 51 | ✗ | { | |
| 52 | |||
| 53 | ✗ | } | |
| 54 | |||
| 55 | void init(std::string file_name, size_t dim) | ||
| 56 | { | ||
| 57 | |||
| 58 | } | ||
| 59 | void read(ublas::matrix<double>& R, ublas::matrix<double>& dR) | ||
| 60 | { | ||
| 61 | |||
| 62 | |||
| 63 | } | ||
| 64 | |||
| 65 | void read(ublas::matrix<double>& R, ublas::matrix<double>& dR, ublas::matrix<double>& Re) | ||
| 66 | { | ||
| 67 | |||
| 68 | |||
| 69 | } | ||
| 70 | |||
| 71 | void read(const double& time, ublas::vector<double>& dv, ublas::vector<double>& v) | ||
| 72 | { | ||
| 73 | |||
| 74 | |||
| 75 | } | ||
| 76 | |||
| 77 | void read(ublas::matrix<double>& R) | ||
| 78 | { | ||
| 79 | |||
| 80 | |||
| 81 | } | ||
| 82 | |||
| 83 | /*writes pramater values to results file | ||
| 84 | @v_list values of parameter | ||
| 85 | @start_time | ||
| 86 | @end_time | ||
| 87 | */ | ||
| 88 | ✗ | virtual void write(const all_vars_t& v_list, double start_time, double end_time) | |
| 89 | { | ||
| 90 | |||
| 91 | //not supported for file output | ||
| 92 | ✗ | } | |
| 93 | |||
| 94 | /* | ||
| 95 | writes header of results file with the variable names | ||
| 96 | @s_list name of variables | ||
| 97 | @s_desc_list description of variables | ||
| 98 | @s_parameter_list name of parameter | ||
| 99 | @s_desc_parameter_list description of parameter | ||
| 100 | */ | ||
| 101 | ✗ | virtual void write(const all_names_t& s_list,const all_description_t& s_desc_list, const all_names_t& s_parameter_list,const all_description_t& s_desc_parameter_list) | |
| 102 | { | ||
| 103 | |||
| 104 | ✗ | } | |
| 105 | |||
| 106 | void write(const char c) | ||
| 107 | { | ||
| 108 | |||
| 109 | } | ||
| 110 | |||
| 111 | /* | ||
| 112 | writes simulation results for a time step | ||
| 113 | @v_list variables and state vars | ||
| 114 | @v2_list derivatives vars | ||
| 115 | @time | ||
| 116 | */ | ||
| 117 | ✗ | virtual void write(const all_vars_time_t& v_list,const neg_all_vars_t& neg_v_list) | |
| 118 | { | ||
| 119 | |||
| 120 | ✗ | } | |
| 121 | |||
| 122 | void getTime(std::vector<double>& time) | ||
| 123 | { | ||
| 124 | //not supported for file output | ||
| 125 | } | ||
| 126 | |||
| 127 | unsigned long size() | ||
| 128 | { | ||
| 129 | //not supported for file output | ||
| 130 | return 0; | ||
| 131 | } | ||
| 132 | |||
| 133 | void eraseAll() | ||
| 134 | { | ||
| 135 | |||
| 136 | } | ||
| 137 | protected: | ||
| 138 | vector<string> _var_outputs; | ||
| 139 | |||
| 140 | }; | ||
| 141 | /** @} */ // end of dataexchangePolicies | ||
| 142 |