OMCompiler/SimulationRuntime/cpp/Core/DataExchange/Policies/MatfileWriter.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 | /** @addtogroup dataexchangePolicies | ||
| 29 | * | ||
| 30 | * @{ | ||
| 31 | */ | ||
| 32 | |||
| 33 | /*=={info}======================================================================================*/ | ||
| 34 | /*! | ||
| 35 | * \title MatfileWriter | ||
| 36 | * \date 2014-07-29 | ||
| 37 | * | ||
| 38 | * \content Policy class to write simulation results in a MATLAB file | ||
| 39 | */ | ||
| 40 | /*========================================================================================{end}==*/ | ||
| 41 | #pragma once | ||
| 42 | /*includes removed for static linking not needed any more | ||
| 43 | #ifdef RUNTIME_STATIC_LINKING | ||
| 44 | #include <sstream> | ||
| 45 | #include <vector> | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #include <fstream> | ||
| 49 | using std::ios; | ||
| 50 | */ | ||
| 51 | #include <Core/DataExchange/FactoryPolicy.h> | ||
| 52 | |||
| 53 | |||
| 54 | class MatFileWriter : public ContainerManager | ||
| 55 | { | ||
| 56 | public: | ||
| 57 | 38 | MatFileWriter(unsigned long size, string file_name) | |
| 58 | 38 | : ContainerManager(), | |
| 59 | _dataHdrPos(), | ||
| 60 | _dataEofPos(), | ||
| 61 | 38 | _curser_position(0), | |
| 62 | 38 | _uiValueCount(0), | |
| 63 |
1/1✓ Branch 1 taken 38 times.
|
38 | _file_name(file_name), |
| 64 | 38 | _doubleMatrixData1(NULL), | |
| 65 | 38 | _doubleMatrixData2(NULL), | |
| 66 | 38 | _stringMatrix(NULL), | |
| 67 |
1/1✓ Branch 1 taken 38 times.
|
76 | _intMatrix(NULL) |
| 68 | { | ||
| 69 | |||
| 70 | 38 | } | |
| 71 | 38 | ~MatFileWriter() | |
| 72 | 38 | { | |
| 73 | // free memory and initialize pointer | ||
| 74 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | delete[] _doubleMatrixData1; |
| 75 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | delete[] _doubleMatrixData2; |
| 76 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | delete[] _stringMatrix; |
| 77 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | delete[] _intMatrix; |
| 78 | |||
| 79 | 38 | _doubleMatrixData1 = NULL; | |
| 80 | 38 | _doubleMatrixData2 = NULL; | |
| 81 | 38 | _stringMatrix = NULL; | |
| 82 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | _intMatrix = NULL; |
| 83 | |||
| 84 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | if (_output_stream.is_open()) |
| 85 | 38 | _output_stream.close(); | |
| 86 | 76 | } | |
| 87 | |||
| 88 | /*=={function}===================================================================================*/ | ||
| 89 | /*! | ||
| 90 | * static inline void vFixVarName(char *pcStr, size_t uiLength) | ||
| 91 | * | ||
| 92 | * brief: | ||
| 93 | * ------ | ||
| 94 | * function changes names of derivated variables | ||
| 95 | * e.g. der(secondOrder.y) is changed in secondOrder.der(y) | ||
| 96 | * | ||
| 97 | * \param[in] *pcStr | ||
| 98 | * \n usage: pointer to changing string | ||
| 99 | * range: not relevant | ||
| 100 | * | ||
| 101 | * \param[in] uiLength | ||
| 102 | * \n usage: length of changing string | ||
| 103 | * \n range: [0 ; +4294967295] | ||
| 104 | * | ||
| 105 | * \return | ||
| 106 | */ | ||
| 107 | /*========================================================================================{end}==*/ | ||
| 108 | static inline void vFixVarName(char *pcStr, size_t uiLength) | ||
| 109 | { | ||
| 110 | char* pcDot; | ||
| 111 | |||
| 112 | if (uiLength < 6) | ||
| 113 | return; | ||
| 114 | |||
| 115 | while (strncmp(pcStr, "der(", 4) == 0 && (pcDot = strrchr(pcStr, '.')) != NULL) | ||
| 116 | { | ||
| 117 | size_t uiPos = (size_t) (pcDot - pcStr) + 1; | ||
| 118 | |||
| 119 | for (size_t uiIndex = 4; uiIndex < uiPos; ++uiIndex) | ||
| 120 | pcStr[uiIndex - 4] = pcStr[uiIndex]; | ||
| 121 | |||
| 122 | strncpy(&pcStr[uiPos - 4], "der(", 4); | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | /*=={function}===================================================================================*/ | ||
| 127 | /*! | ||
| 128 | * void writeMatVer4MatrixHeader(const char *name, int rows, int cols, unsigned int size) | ||
| 129 | * | ||
| 130 | * brief: | ||
| 131 | * ------ | ||
| 132 | * function writes a matrix header | ||
| 133 | * | ||
| 134 | * \param[in] *name | ||
| 135 | * \n usage: pointer to name of matrix | ||
| 136 | * range: not relevant | ||
| 137 | * | ||
| 138 | * \param[in] rows | ||
| 139 | * \n usage: number of rows | ||
| 140 | * \n range: [-2147483648 ; +2147483647] | ||
| 141 | * | ||
| 142 | * \param[in] cols | ||
| 143 | * \n usage: number of cols | ||
| 144 | * \n range: [-2147483648 ; +2147483647] | ||
| 145 | * | ||
| 146 | * \param[in] size | ||
| 147 | * \n usage: length of changing string | ||
| 148 | * \n range: [0 ; +4294967295] | ||
| 149 | * | ||
| 150 | * \return | ||
| 151 | */ | ||
| 152 | /*========================================================================================{end}==*/ | ||
| 153 | 339659 | void writeMatVer4MatrixHeader(const char *name, int rows, int cols, unsigned int size) | |
| 154 | { | ||
| 155 | // matrix header struct | ||
| 156 | typedef struct MHeader | ||
| 157 | { | ||
| 158 | unsigned int type; | ||
| 159 | unsigned int mrows; | ||
| 160 | unsigned int ncols; | ||
| 161 | unsigned int imagf; | ||
| 162 | unsigned int namelen; | ||
| 163 | } MHeader_t; | ||
| 164 | const int endian_test = 1; | ||
| 165 | MHeader_t hdr; | ||
| 166 | |||
| 167 | // every data type has an own type value | ||
| 168 | int type = 0; | ||
| 169 |
2/2✓ Branch 0 taken 114 times.
✓ Branch 1 taken 339545 times.
|
339659 | if (size == 1) //char |
| 170 | type = 51; | ||
| 171 |
2/2✓ Branch 0 taken 38 times.
✓ Branch 1 taken 339621 times.
|
339659 | if (size == 4) //int32 |
| 172 | type = 20; | ||
| 173 | |||
| 174 | // initializing header | ||
| 175 | 339659 | hdr.type = 1000 * ((*(char*) &endian_test) == 0) + type; | |
| 176 | 339659 | hdr.mrows = rows; | |
| 177 | 339659 | hdr.ncols = cols; | |
| 178 | 339659 | hdr.imagf = 0; | |
| 179 | 339659 | hdr.namelen = strlen(name) + 1; | |
| 180 | |||
| 181 | // special treatment for "data_2" matrix. After new simualtion data, header has to be written | ||
| 182 |
4/4✓ Branch 0 taken 339469 times.
✓ Branch 1 taken 190 times.
✓ Branch 3 taken 339431 times.
✓ Branch 4 taken 38 times.
|
339659 | if ((strcmp(name, "data_2") == 0) && (_dataHdrPos != _output_stream.tellp())) |
| 183 | { | ||
| 184 | 339431 | _dataEofPos = _output_stream.tellp(); | |
| 185 | 339431 | _output_stream.seekp(_dataHdrPos); | |
| 186 | 339431 | _output_stream.write((char*) &hdr, sizeof(MHeader_t)); | |
| 187 | 339431 | _output_stream.write(name, sizeof(char) * hdr.namelen); | |
| 188 | 339431 | _output_stream.seekp(_dataEofPos); | |
| 189 | } | ||
| 190 | else // standard routine for header | ||
| 191 | { | ||
| 192 | 228 | _output_stream.write((char*) &hdr, sizeof(MHeader_t)); | |
| 193 | 228 | _output_stream.write(name, sizeof(char) * hdr.namelen); | |
| 194 | } | ||
| 195 | 339659 | } | |
| 196 | |||
| 197 | /*=={function}===================================================================================*/ | ||
| 198 | /*! | ||
| 199 | * void writeMatVer4Matrix(const char *name, int rows, int cols, const void *matrixData, unsigned int size) | ||
| 200 | * | ||
| 201 | * brief: | ||
| 202 | * ------ | ||
| 203 | * function writes the data of a matrix | ||
| 204 | * | ||
| 205 | * \param[in] *name | ||
| 206 | * \n usage: pointer to name of matrix | ||
| 207 | * range: not relevant | ||
| 208 | * | ||
| 209 | * \param[in] rows | ||
| 210 | * \n usage: number of rows | ||
| 211 | * \n range: [-2147483648 ; +2147483647] | ||
| 212 | * | ||
| 213 | * \param[in] cols | ||
| 214 | * \n usage: number of cols | ||
| 215 | * \n range: [-2147483648 ; +2147483647] | ||
| 216 | * | ||
| 217 | * \param[in] *matrixData | ||
| 218 | * \n usage: pointer to data | ||
| 219 | * \n range: not relevant | ||
| 220 | * | ||
| 221 | * \param[in] size | ||
| 222 | * \n usage: length of changing string | ||
| 223 | * \n range: [0 ; +4294967295] | ||
| 224 | * | ||
| 225 | * \return | ||
| 226 | */ | ||
| 227 | /*========================================================================================{end}==*/ | ||
| 228 | 339659 | void writeMatVer4Matrix(const char *name, int rows, int cols, const void *matrixData, unsigned int size) | |
| 229 | { | ||
| 230 | // first matrix header has to be written | ||
| 231 | 339659 | writeMatVer4MatrixHeader(name, rows, cols, size); | |
| 232 | |||
| 233 | // special treatment for "data_2" matrix. cols = 1 | ||
| 234 |
2/2✓ Branch 0 taken 339469 times.
✓ Branch 1 taken 190 times.
|
339659 | if (strcmp(name, "data_2") == 0) |
| 235 | { | ||
| 236 | 339469 | _output_stream.write((const char*) matrixData, (size) * rows * 1); | |
| 237 | //dataDummy = _output_stream.tellp(); // workaround: because with gcc compiled, sporadicaly the last simulation data is not written to file | ||
| 238 | } | ||
| 239 | else // standard write routine | ||
| 240 | { | ||
| 241 | 190 | _output_stream.write((const char*) matrixData, (size) * rows * cols); | |
| 242 | } | ||
| 243 | 339659 | } | |
| 244 | |||
| 245 | /*=={function}===================================================================================*/ | ||
| 246 | /*! | ||
| 247 | * void init(std::string file_name) | ||
| 248 | * | ||
| 249 | * brief: | ||
| 250 | * ------ | ||
| 251 | * function initialize a matlab file | ||
| 252 | * | ||
| 253 | * \param[in] file_name | ||
| 254 | * \n usage: file name | ||
| 255 | * \n range: not relevant | ||
| 256 | * | ||
| 257 | * \return | ||
| 258 | */ | ||
| 259 | /*========================================================================================{end}==*/ | ||
| 260 | 38 | void init(std::string file_name, size_t dim) | |
| 261 | { | ||
| 262 | 38 | const char Aclass[] = "A1 bt. ir1 na Tj re ac nt so r y "; // special header string | |
| 263 | |||
| 264 | 38 | _file_name = file_name; | |
| 265 | |||
| 266 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
|
38 | if (_output_stream.is_open()) |
| 267 | ✗ | _output_stream.close(); | |
| 268 | |||
| 269 | // open new file | ||
| 270 | 38 | _output_stream.open(file_name.c_str(), ios::binary | ios::trunc); | |
| 271 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
|
38 | if (_output_stream.fail()) |
| 272 | ✗ | throw ModelicaSimulationError(DATASTORAGE, string("Failed to open results file ") + file_name); | |
| 273 | |||
| 274 | // write header matrix | ||
| 275 | 38 | writeMatVer4Matrix("Aclass", 4, 11, Aclass, sizeof(char)); | |
| 276 | |||
| 277 | // initialize help variables | ||
| 278 | 38 | _uiValueCount = 0; | |
| 279 | 38 | _dataHdrPos = 0; | |
| 280 | 38 | _dataEofPos = 0; | |
| 281 | |||
| 282 | 38 | _doubleMatrixData1 = NULL; | |
| 283 | 38 | _doubleMatrixData2 = NULL; | |
| 284 | 38 | _stringMatrix = NULL; | |
| 285 | 38 | _intMatrix = NULL; | |
| 286 | |||
| 287 | // allocate temp buffer for simulation data: | ||
| 288 | // dim_1 (number of variables) + dim_2 (number of der. variables) + 1 (time) | ||
| 289 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | _doubleMatrixData2 = new double[dim + 1]; |
| 290 | 38 | } | |
| 291 | |||
| 292 | /*=={function}===================================================================================*/ | ||
| 293 | /*! | ||
| 294 | * void write(const value_type_p& v_list,double start_time,double end_time) | ||
| 295 | * | ||
| 296 | * brief: | ||
| 297 | * ------ | ||
| 298 | * function writes the parameters, which are constant over simulation time | ||
| 299 | * | ||
| 300 | * \param[in] v_list | ||
| 301 | * \n usage: list of parameters | ||
| 302 | * \n range: not relevant | ||
| 303 | * | ||
| 304 | * \param[in] start_time | ||
| 305 | * \n usage: simulation start time | ||
| 306 | * \n range: [1,7E-308 ; +2147483647] | ||
| 307 | * | ||
| 308 | * \param[in] end_time | ||
| 309 | * \n usage: simulation end time | ||
| 310 | * \n range: [-2147483648 ; +2147483647] | ||
| 311 | * | ||
| 312 | * \return | ||
| 313 | */ | ||
| 314 | /*========================================================================================{end}==*/ | ||
| 315 | 38 | virtual void write(const all_vars_t& v_list, double start_time, double end_time) | |
| 316 | { | ||
| 317 | 38 | unsigned int uiParCount = get<0>(v_list).size() +get<1>(v_list).size()+get<2>(v_list).size()+ 1; // all variables + time | |
| 318 | double *doubleHelpMatrix = NULL; | ||
| 319 | |||
| 320 | // get memory and reset to zero | ||
| 321 | 38 | _doubleMatrixData1 = new double[2 * uiParCount]; | |
| 322 | 38 | memset(_doubleMatrixData1, 0, sizeof(double) * 2 * uiParCount); | |
| 323 | doubleHelpMatrix = _doubleMatrixData1; | ||
| 324 | |||
| 325 | // first we have to put in start and stop time... | ||
| 326 | 38 | *doubleHelpMatrix = start_time; | |
| 327 | 38 | *(doubleHelpMatrix + uiParCount) = end_time; | |
| 328 | 38 | doubleHelpMatrix++; | |
| 329 | |||
| 330 | // ...then the other real variables | ||
| 331 |
2/2✓ Branch 0 taken 542 times.
✓ Branch 1 taken 38 times.
|
580 | for (real_vars_t::const_iterator it = get<0>(v_list).begin(); it != get<0>(v_list).end(); ++it) |
| 332 | { | ||
| 333 | 542 | *doubleHelpMatrix = *(*it); | |
| 334 | 542 | *(doubleHelpMatrix + uiParCount) = *(*it); | |
| 335 | 542 | doubleHelpMatrix++; | |
| 336 | } | ||
| 337 | // ...then the other int variables | ||
| 338 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 38 times.
|
234 | for (int_vars_t::const_iterator it = get<1>(v_list).begin(); it != get<1>(v_list).end(); ++it) |
| 339 | { | ||
| 340 | 196 | *doubleHelpMatrix = *(*it); | |
| 341 | 196 | *(doubleHelpMatrix + uiParCount) = *(*it); | |
| 342 | 196 | doubleHelpMatrix++; | |
| 343 | } | ||
| 344 | // ...then the other bool variables | ||
| 345 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 38 times.
|
101 | for (bool_vars_t::const_iterator it = get<2>(v_list).begin(); it != get<2>(v_list).end(); ++it) |
| 346 | { | ||
| 347 | 63 | *doubleHelpMatrix = *(*it); | |
| 348 | 63 | *(doubleHelpMatrix + uiParCount) = *(*it); | |
| 349 | 63 | doubleHelpMatrix++; | |
| 350 | } | ||
| 351 | |||
| 352 | // if matrix is complete, write to file! | ||
| 353 | 38 | writeMatVer4Matrix("data_1", uiParCount, 2, _doubleMatrixData1, sizeof(double)); | |
| 354 | |||
| 355 | // initialize pointer | ||
| 356 | doubleHelpMatrix = NULL; | ||
| 357 | |||
| 358 | // remember file position. it's the position of the "data_2" header | ||
| 359 | // is needed to change header afterwards | ||
| 360 | 38 | _dataHdrPos = _output_stream.tellp(); | |
| 361 | 38 | } | |
| 362 | |||
| 363 | /*=={function}===================================================================================*/ | ||
| 364 | /*! | ||
| 365 | * void write(var_names_t& s_list,var_names_t& s_desc_list,var_names_t& s_parameter_list,var_names_t& s_desc_parameter_list) | ||
| 366 | * | ||
| 367 | * brief: | ||
| 368 | * ------ | ||
| 369 | * function writes names and descriptions of simulation variables and parameters | ||
| 370 | * | ||
| 371 | * \param[in] s_list | ||
| 372 | * \n usage: list with names of the simulation variables | ||
| 373 | * \n range: not relevant | ||
| 374 | * | ||
| 375 | * \param[in] s_desc_list | ||
| 376 | * \n usage: list with descriptions of the simulation variables | ||
| 377 | * \n range: not relevant | ||
| 378 | * | ||
| 379 | * \param[in] s_parameter_list | ||
| 380 | * \n usage: list with names of the simulation parameters | ||
| 381 | * \n range: not relevant | ||
| 382 | * | ||
| 383 | * \param[in] s_desc_parameter_list | ||
| 384 | * \n usage: list with descriptions of the simulation parameters | ||
| 385 | * \n range: not relevant | ||
| 386 | * | ||
| 387 | * \return | ||
| 388 | */ | ||
| 389 | /*========================================================================================{end}==*/ | ||
| 390 | 38 | 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) | |
| 391 | { | ||
| 392 | unsigned int uilongest = 12; // help variable for temp buffer size | ||
| 393 | 38 | unsigned int uilongestName = 5; // because of "Time" | |
| 394 | 38 | unsigned int uilongestDesc = 12; // because of "Time in [s]" | |
| 395 | 38 | unsigned int uiVarCount = get<0>(s_list).size() +get<1>(s_list).size() +get<2>(s_list).size() + get<0>(s_parameter_list).size() + get<1>(s_parameter_list).size() + get<2>(s_parameter_list).size()+ 1; // all variables, all parameters + time | |
| 396 | unsigned int uiIndex = 2; | ||
| 397 | int iCols = 0; | ||
| 398 | char *stringHelpMatrix = NULL; | ||
| 399 | int *intHelpMatrix = NULL; | ||
| 400 | |||
| 401 | // get longest string of the variable names | ||
| 402 |
2/2✓ Branch 0 taken 1405 times.
✓ Branch 1 taken 38 times.
|
1443 | for (var_names_t::const_iterator it = get<0>(s_list).begin(); it != get<0>(s_list).end(); ++it) |
| 403 | { | ||
| 404 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 1347 times.
|
1405 | if (it->size() > uilongestName) |
| 405 | 58 | uilongestName = it->size() + 1; // +1 because of string end | |
| 406 | } | ||
| 407 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 38 times.
|
290 | for (var_names_t::const_iterator it = get<1>(s_list).begin(); it != get<1>(s_list).end(); ++it) |
| 408 | { | ||
| 409 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 243 times.
|
252 | if (it->size() > uilongestName) |
| 410 | 9 | uilongestName = it->size() + 1; // +1 because of string end | |
| 411 | } | ||
| 412 |
2/2✓ Branch 0 taken 208 times.
✓ Branch 1 taken 38 times.
|
246 | for (var_names_t::const_iterator it = get<2>(s_list).begin(); it != get<2>(s_list).end(); ++it) |
| 413 | { | ||
| 414 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 205 times.
|
208 | if (it->size() > uilongestName) |
| 415 | 3 | uilongestName = it->size() + 1; // +1 because of string end | |
| 416 | } | ||
| 417 | |||
| 418 | // get longest string of the parameter names | ||
| 419 |
2/2✓ Branch 0 taken 542 times.
✓ Branch 1 taken 38 times.
|
580 | for (var_names_t::const_iterator it = get<0>(s_parameter_list).begin(); it != get<0>(s_parameter_list).end(); ++it) |
| 420 | { | ||
| 421 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 535 times.
|
542 | if (it->size() > uilongestName) |
| 422 | 7 | uilongestName = it->size() + 1; // +1 because of string end | |
| 423 | } | ||
| 424 | // get longest string of the parameter names | ||
| 425 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 38 times.
|
234 | for (var_names_t::const_iterator it = get<1>(s_parameter_list).begin(); it != get<1>(s_parameter_list).end(); ++it) |
| 426 | { | ||
| 427 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 193 times.
|
196 | if (it->size() > uilongestName) |
| 428 | 3 | uilongestName = it->size() + 1; // +1 because of string end | |
| 429 | } | ||
| 430 | // get longest string of the parameter names | ||
| 431 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 38 times.
|
101 | for (var_names_t::const_iterator it = get<2>(s_parameter_list).begin(); it != get<2>(s_parameter_list).end(); ++it) |
| 432 | { | ||
| 433 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 56 times.
|
63 | if (it->size() > uilongestName) |
| 434 | 7 | uilongestName = it->size() + 1; // +1 because of string end | |
| 435 | } | ||
| 436 | |||
| 437 | // get longest string of the variable descriptions | ||
| 438 |
2/2✓ Branch 0 taken 1405 times.
✓ Branch 1 taken 38 times.
|
1443 | for (var_names_t::const_iterator it = get<0>(s_desc_list).begin(); it != get<0>(s_desc_list).end(); ++it) |
| 439 | { | ||
| 440 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 1365 times.
|
1405 | if (it->size() > uilongestDesc) |
| 441 | 40 | uilongestDesc = it->size() + 1; // +1 because of string end | |
| 442 | } | ||
| 443 | // get longest string of the variable descriptions | ||
| 444 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 38 times.
|
290 | for (var_names_t::const_iterator it = get<1>(s_desc_list).begin(); it != get<1>(s_desc_list).end(); ++it) |
| 445 | { | ||
| 446 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 246 times.
|
252 | if (it->size() > uilongestDesc) |
| 447 | 6 | uilongestDesc = it->size() + 1; // +1 because of string end | |
| 448 | } | ||
| 449 | // get longest string of the variable descriptions | ||
| 450 |
2/2✓ Branch 0 taken 208 times.
✓ Branch 1 taken 38 times.
|
246 | for (var_names_t::const_iterator it = get<2>(s_desc_list).begin(); it != get<2>(s_desc_list).end(); ++it) |
| 451 | { | ||
| 452 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 204 times.
|
208 | if (it->size() > uilongestDesc) |
| 453 | 4 | uilongestDesc = it->size() + 1; // +1 because of string end | |
| 454 | } | ||
| 455 | |||
| 456 | // get longest string of the parameter descriptions | ||
| 457 |
2/2✓ Branch 0 taken 542 times.
✓ Branch 1 taken 38 times.
|
580 | for (var_names_t::const_iterator it = get<0>(s_desc_parameter_list).begin(); it != get<0>(s_desc_parameter_list).end(); ++it) |
| 458 | { | ||
| 459 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 530 times.
|
542 | if (it->size() > uilongestDesc) |
| 460 | 12 | uilongestDesc = it->size() + 1; // +1 because of string end | |
| 461 | } | ||
| 462 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 38 times.
|
234 | for (var_names_t::const_iterator it = get<1>(s_desc_parameter_list).begin(); it != get<1>(s_desc_parameter_list).end(); ++it) |
| 463 | { | ||
| 464 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 192 times.
|
196 | if (it->size() > uilongestDesc) |
| 465 | 4 | uilongestDesc = it->size() + 1; // +1 because of string end | |
| 466 | } | ||
| 467 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 38 times.
|
101 | for (var_names_t::const_iterator it = get<2>(s_desc_parameter_list).begin(); it != get<2>(s_desc_parameter_list).end(); ++it) |
| 468 | { | ||
| 469 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 61 times.
|
63 | if (it->size() > uilongestDesc) |
| 470 | 2 | uilongestDesc = it->size() + 1; // +1 because of string end | |
| 471 | } | ||
| 472 | |||
| 473 | // get longest string. is needed for temp buffer | ||
| 474 | 38 | uilongest = max(uilongestName, uilongestDesc); | |
| 475 | |||
| 476 | // get memory and reset to zero | ||
| 477 | 38 | _stringMatrix = new char[uiVarCount * uilongest]; | |
| 478 | 38 | memset(_stringMatrix, 0, sizeof(char) * uiVarCount * uilongest); | |
| 479 | stringHelpMatrix = _stringMatrix; | ||
| 480 | |||
| 481 | // first time ist written to "name" matrix... | ||
| 482 | strncpy(stringHelpMatrix, "time", 4); | ||
| 483 | 38 | stringHelpMatrix += uilongestName; | |
| 484 | |||
| 485 | // ...followed by variable names... | ||
| 486 |
2/2✓ Branch 0 taken 1405 times.
✓ Branch 1 taken 38 times.
|
1443 | for (var_names_t::const_iterator it = get<0>(s_list).begin(); it != get<0>(s_list).end(); ++it) |
| 487 | { | ||
| 488 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 489 | 1405 | stringHelpMatrix += uilongestName; | |
| 490 | } | ||
| 491 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 38 times.
|
290 | for (var_names_t::const_iterator it = get<1>(s_list).begin(); it != get<1>(s_list).end(); ++it) |
| 492 | { | ||
| 493 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 494 | 252 | stringHelpMatrix += uilongestName; | |
| 495 | } | ||
| 496 |
2/2✓ Branch 0 taken 208 times.
✓ Branch 1 taken 38 times.
|
246 | for (var_names_t::const_iterator it = get<2>(s_list).begin(); it != get<2>(s_list).end(); ++it) |
| 497 | { | ||
| 498 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 499 | 208 | stringHelpMatrix += uilongestName; | |
| 500 | } | ||
| 501 | |||
| 502 | // ...followed by parameter names | ||
| 503 |
2/2✓ Branch 0 taken 542 times.
✓ Branch 1 taken 38 times.
|
580 | for (var_names_t::const_iterator it = get<0>(s_parameter_list).begin(); it != get<0>(s_parameter_list).end(); ++it) |
| 504 | { | ||
| 505 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 506 | 542 | stringHelpMatrix += uilongestName; | |
| 507 | } | ||
| 508 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 38 times.
|
234 | for (var_names_t::const_iterator it = get<1>(s_parameter_list).begin(); it != get<1>(s_parameter_list).end(); ++it) |
| 509 | { | ||
| 510 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 511 | 196 | stringHelpMatrix += uilongestName; | |
| 512 | } | ||
| 513 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 38 times.
|
101 | for (var_names_t::const_iterator it = get<2>(s_parameter_list).begin(); it != get<2>(s_parameter_list).end(); ++it) |
| 514 | { | ||
| 515 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 516 | 63 | stringHelpMatrix += uilongestName; | |
| 517 | } | ||
| 518 | |||
| 519 | // write matrix to file | ||
| 520 | 38 | writeMatVer4Matrix("name", (int) uilongestName, (int) uiVarCount, _stringMatrix, sizeof(char)); | |
| 521 | |||
| 522 | // initialize pointer and reset to zero | ||
| 523 | 38 | memset(_stringMatrix, 0, sizeof(char) * uiVarCount * uilongest); | |
| 524 | 38 | stringHelpMatrix = _stringMatrix; | |
| 525 | |||
| 526 | // first description of time ist written to "name" matrix... | ||
| 527 | strncpy(stringHelpMatrix, "Time in [s]", 11); | ||
| 528 | 38 | stringHelpMatrix += uilongestDesc; | |
| 529 | |||
| 530 | // ...followed by variable descriptions... | ||
| 531 |
2/2✓ Branch 0 taken 1405 times.
✓ Branch 1 taken 38 times.
|
1443 | for (var_names_t::const_iterator it = get<0>(s_desc_list).begin(); it != get<0>(s_desc_list).end(); ++it) |
| 532 | { | ||
| 533 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 534 | 1405 | stringHelpMatrix += uilongestDesc; | |
| 535 | } | ||
| 536 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 38 times.
|
290 | for (var_names_t::const_iterator it = get<1>(s_desc_list).begin(); it != get<1>(s_desc_list).end(); ++it) |
| 537 | { | ||
| 538 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 539 | 252 | stringHelpMatrix += uilongestDesc; | |
| 540 | } | ||
| 541 |
2/2✓ Branch 0 taken 208 times.
✓ Branch 1 taken 38 times.
|
246 | for (var_names_t::const_iterator it = get<2>(s_desc_list).begin(); it != get<2>(s_desc_list).end(); ++it) |
| 542 | { | ||
| 543 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 544 | 208 | stringHelpMatrix += uilongestDesc; | |
| 545 | } | ||
| 546 | |||
| 547 | // ...followed by parameter descriptions... | ||
| 548 |
2/2✓ Branch 0 taken 542 times.
✓ Branch 1 taken 38 times.
|
580 | for (var_names_t::const_iterator it = get<0>(s_desc_parameter_list).begin(); it != get<0>(s_desc_parameter_list).end(); ++it) |
| 549 | { | ||
| 550 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 551 | 542 | stringHelpMatrix += uilongestDesc; | |
| 552 | } | ||
| 553 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 38 times.
|
234 | for (var_names_t::const_iterator it = get<1>(s_desc_parameter_list).begin(); it != get<1>(s_desc_parameter_list).end(); ++it) |
| 554 | { | ||
| 555 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 556 | 196 | stringHelpMatrix += uilongestDesc; | |
| 557 | } | ||
| 558 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 38 times.
|
101 | for (var_names_t::const_iterator it = get<2>(s_desc_parameter_list).begin(); it != get<2>(s_desc_parameter_list).end(); ++it) |
| 559 | { | ||
| 560 | strncpy(stringHelpMatrix, it->c_str(), it->size()); | ||
| 561 | 63 | stringHelpMatrix += uilongestDesc; | |
| 562 | } | ||
| 563 | |||
| 564 | // write matrix to file | ||
| 565 | 38 | writeMatVer4Matrix("description", (int) uilongestDesc, (int) uiVarCount, _stringMatrix, sizeof(char)); | |
| 566 | |||
| 567 | // get memory and reset to zero | ||
| 568 | 38 | _intMatrix = new int[4 * uiVarCount]; | |
| 569 | 38 | memset(_intMatrix, 0, sizeof(int) * 4 * uiVarCount); | |
| 570 | intHelpMatrix = _intMatrix; | ||
| 571 | |||
| 572 | /*==========================================================================================================*/ | ||
| 573 | /* Die "dataInfo"-Matrix schluesselt die Speicherung der Simulationswerte in "data_1" und "data_2" | ||
| 574 | * | ||
| 575 | * Beispiel: | ||
| 576 | * ========= | ||
| 577 | * int dataInfo(5,4) | ||
| 578 | * 0 1 0 -1 # Time | ||
| 579 | * 2 2 0 -1 # _dummy | ||
| 580 | * 2 3 0 -1 # _derdummy | ||
| 581 | * 1 2 0 0 # Parameter1 | ||
| 582 | * 2 4 0 -1 # Variable1 | ||
| 583 | * | ||
| 584 | * Auszug aus einem Dymola-Export mit Erklaerung der Architektur: | ||
| 585 | * ============================================================== | ||
| 586 | * dataInfo(i,1)= j: name i data is stored in matrix "data_j". | ||
| 587 | * (1,1)=0, means that name(1) is used as abscissa | ||
| 588 | * for ALL data matrices! | ||
| 589 | * | ||
| 590 | * dataInfo(i,2)= k: name i data is stored in column abs(k) of matrix | ||
| 591 | * data_j with sign(k) used as sign. | ||
| 592 | * | ||
| 593 | * dataInfo(i,3)= 0: Linear interpolation of the column data | ||
| 594 | * = 1..4: Piecewise convex hermite spline interpolation | ||
| 595 | * of the column data. Curve is differentiable upto | ||
| 596 | * order 1..4. The spline is defined by a polygon. | ||
| 597 | * It touches the polygon in the middle of every segment | ||
| 598 | * and at the beginning and final point. Between such | ||
| 599 | * points the spline is convex. The polygon is also the | ||
| 600 | * convex envelope of the spline. | ||
| 601 | * | ||
| 602 | * dataInfo(i,4)= -1: name i is not defined outside of the defined time range | ||
| 603 | * = 0: Keep first/last value outside of time range | ||
| 604 | * = 1: Linear interpolation through first/last two points outside | ||
| 605 | * of time range. | ||
| 606 | */ | ||
| 607 | /*==========================================================================================================*/ | ||
| 608 | |||
| 609 | // time | ||
| 610 | 38 | *intHelpMatrix++ = 2; // according to Dymola-Spec the value should be 0. But in the Matlab export method of the C-Runtime the value is 2. | |
| 611 | 38 | *intHelpMatrix++ = 1; | |
| 612 | 38 | *intHelpMatrix++ = 0; | |
| 613 | 38 | *intHelpMatrix++ = -1; | |
| 614 | |||
| 615 | // dataInfo-code for all variables | ||
| 616 |
2/2✓ Branch 0 taken 1405 times.
✓ Branch 1 taken 38 times.
|
1443 | for (var_names_t::const_iterator it = get<0>(s_list).begin(); it != get<0>(s_list).end(); ++it) |
| 617 | { | ||
| 618 | 1405 | *intHelpMatrix++ = 2; | |
| 619 | 1405 | *intHelpMatrix++ = uiIndex++; | |
| 620 | 1405 | *intHelpMatrix++ = 0; | |
| 621 | 1405 | *intHelpMatrix++ = -1; | |
| 622 | } | ||
| 623 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 38 times.
|
290 | for (var_names_t::const_iterator it = get<1>(s_list).begin(); it != get<1>(s_list).end(); ++it) |
| 624 | { | ||
| 625 | 252 | *intHelpMatrix++ = 2; | |
| 626 | 252 | *intHelpMatrix++ = uiIndex++; | |
| 627 | 252 | *intHelpMatrix++ = 0; | |
| 628 | 252 | *intHelpMatrix++ = -1; | |
| 629 | } | ||
| 630 |
2/2✓ Branch 0 taken 208 times.
✓ Branch 1 taken 38 times.
|
246 | for (var_names_t::const_iterator it = get<2>(s_list).begin(); it != get<2>(s_list).end(); ++it) |
| 631 | { | ||
| 632 | 208 | *intHelpMatrix++ = 2; | |
| 633 | 208 | *intHelpMatrix++ = uiIndex++; | |
| 634 | 208 | *intHelpMatrix++ = 0; | |
| 635 | 208 | *intHelpMatrix++ = -1; | |
| 636 | } | ||
| 637 | |||
| 638 | uiIndex = 2; | ||
| 639 | |||
| 640 | // dataInfo-code for all parameters | ||
| 641 |
2/2✓ Branch 0 taken 542 times.
✓ Branch 1 taken 38 times.
|
580 | for (var_names_t::const_iterator it = get<0>(s_parameter_list).begin(); it != get<0>(s_parameter_list).end(); ++it) |
| 642 | { | ||
| 643 | 542 | *intHelpMatrix++ = 1; | |
| 644 | 542 | *intHelpMatrix++ = uiIndex++; | |
| 645 | 542 | *intHelpMatrix++ = 0; | |
| 646 | 542 | *intHelpMatrix++ = 0; | |
| 647 | } | ||
| 648 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 38 times.
|
234 | for (var_names_t::const_iterator it = get<1>(s_parameter_list).begin(); it != get<1>(s_parameter_list).end(); ++it) |
| 649 | { | ||
| 650 | 196 | *intHelpMatrix++ = 1; | |
| 651 | 196 | *intHelpMatrix++ = uiIndex++; | |
| 652 | 196 | *intHelpMatrix++ = 0; | |
| 653 | 196 | *intHelpMatrix++ = 0; | |
| 654 | } | ||
| 655 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 38 times.
|
101 | for (var_names_t::const_iterator it = get<2>(s_parameter_list).begin(); it != get<2>(s_parameter_list).end(); ++it) |
| 656 | { | ||
| 657 | 63 | *intHelpMatrix++ = 1; | |
| 658 | 63 | *intHelpMatrix++ = uiIndex++; | |
| 659 | 63 | *intHelpMatrix++ = 0; | |
| 660 | 63 | *intHelpMatrix++ = 0; | |
| 661 | } | ||
| 662 | |||
| 663 | // write matrix to file | ||
| 664 | 38 | writeMatVer4Matrix("dataInfo", 4, uiVarCount, _intMatrix, sizeof(int)); | |
| 665 | 38 | } | |
| 666 | |||
| 667 | /*=={function}===================================================================================*/ | ||
| 668 | /*! | ||
| 669 | * void write(const value_type_v& v_list,const value_type_dv& v2_list,double time) | ||
| 670 | * | ||
| 671 | * brief: | ||
| 672 | * ------ | ||
| 673 | * function writes variables, which are NOT constant over simulation time | ||
| 674 | * | ||
| 675 | * \param[in] v_list | ||
| 676 | * \n usage: list with names of the simulation variables | ||
| 677 | * \n range: not relevant | ||
| 678 | * | ||
| 679 | * \param[in] v2_list | ||
| 680 | * \n usage: list with names of the derivated simulation variables | ||
| 681 | * \n range: not relevant | ||
| 682 | * | ||
| 683 | * \param[in] time | ||
| 684 | * \n usage: actual simulation time | ||
| 685 | * \n range: [1,7E-308 ; +2147483647] | ||
| 686 | * | ||
| 687 | * \return | ||
| 688 | */ | ||
| 689 | /*========================================================================================{end}==*/ | ||
| 690 | 339469 | virtual void write(const all_vars_time_t& v_list,const neg_all_vars_t& neg_v_list) | |
| 691 | { | ||
| 692 | 339469 | unsigned int uiVarCount = get<0>(v_list).size() + get<1>(v_list).size() + get<2>(v_list).size() + 1; // alle Variablen, alle abgeleiteten Variablen und die Zeit | |
| 693 | double *doubleHelpMatrix = NULL; | ||
| 694 | |||
| 695 | 339469 | _uiValueCount++; | |
| 696 | |||
| 697 | // reset tempbuffer to zero | ||
| 698 | 339469 | memset(_doubleMatrixData2, 0, sizeof(double) * uiVarCount); | |
| 699 | 339469 | doubleHelpMatrix = _doubleMatrixData2; | |
| 700 | |||
| 701 | // first time ist written to "data_2" matrix... | ||
| 702 | 339469 | *doubleHelpMatrix = get<3>(v_list); | |
| 703 | 339469 | doubleHelpMatrix++; | |
| 704 | |||
| 705 | // ...followed by real variable values... | ||
| 706 | /*for (real_vars_t::const_iterator it = get<0>(v_list).begin(); it != get<0>(v_list).end(); ++it) | ||
| 707 | { | ||
| 708 | *doubleHelpMatrix = *(*it); | ||
| 709 | doubleHelpMatrix++; | ||
| 710 | }*/ | ||
| 711 | |||
| 712 | std::transform(get<0>(v_list).begin(), get<0>(v_list).end(), get<0>(neg_v_list).begin(), | ||
| 713 | doubleHelpMatrix, WriteOutputVar<double>()); | ||
| 714 | |||
| 715 | |||
| 716 | // ...followed by int variable values. | ||
| 717 | /*for (int_vars_t::const_iterator it = get<1>(v_list).begin(); it != get<1>(v_list).end(); ++it) | ||
| 718 | { | ||
| 719 | *doubleHelpMatrix = *(*it); | ||
| 720 | doubleHelpMatrix++; | ||
| 721 | }*/ | ||
| 722 | size_t nReal = get<0>(v_list).size(); | ||
| 723 | 339469 | std::transform(get<1>(v_list).begin(), get<1>(v_list).end(), get<1>(neg_v_list).begin(), | |
| 724 | 339469 | doubleHelpMatrix + nReal, WriteOutputVar<int>()); | |
| 725 | // ...followed by bool variable values. | ||
| 726 | /*for (bool_vars_t::const_iterator it = get<2>(v_list).begin(); it != get<2>(v_list).end(); ++it) | ||
| 727 | { | ||
| 728 | *doubleHelpMatrix = *(*it); | ||
| 729 | doubleHelpMatrix++; | ||
| 730 | } | ||
| 731 | */ | ||
| 732 | size_t nInt = get<1>(v_list).size(); | ||
| 733 | 339469 | std::transform(get<2>(v_list).begin(), get<2>(v_list).end(), get<2>(neg_v_list).begin(), | |
| 734 | 339469 | doubleHelpMatrix+nReal+nInt, WriteOutputVar<bool>()); | |
| 735 | |||
| 736 | // write matrix to file | ||
| 737 | 339469 | writeMatVer4Matrix("data_2", uiVarCount, _uiValueCount, _doubleMatrixData2, sizeof(double)); | |
| 738 | |||
| 739 | // initialize pointer | ||
| 740 | doubleHelpMatrix = NULL; | ||
| 741 | 339469 | } | |
| 742 | |||
| 743 | /*=================================================================================*/ | ||
| 744 | /* | ||
| 745 | * the following functions are not used, but must be declared | ||
| 746 | */ | ||
| 747 | /*=================================================================================*/ | ||
| 748 | void write(const char c) | ||
| 749 | { | ||
| 750 | |||
| 751 | } | ||
| 752 | |||
| 753 | void read(ublas::matrix<double>& R, ublas::matrix<double>& dR) | ||
| 754 | { | ||
| 755 | //not supported for file output | ||
| 756 | } | ||
| 757 | |||
| 758 | void read(ublas::matrix<double>& R, ublas::matrix<double>& dR, ublas::matrix<double>& Re) | ||
| 759 | { | ||
| 760 | //not supported for file output | ||
| 761 | } | ||
| 762 | |||
| 763 | void read(const double& time, ublas::vector<double>& dv, ublas::vector<double>& v) | ||
| 764 | { | ||
| 765 | //not supported for file output | ||
| 766 | } | ||
| 767 | |||
| 768 | void read(ublas::matrix<double>& R) | ||
| 769 | { | ||
| 770 | //not supported for file output | ||
| 771 | } | ||
| 772 | |||
| 773 | void getTime(std::vector<double>& time) | ||
| 774 | { | ||
| 775 | //not supported for file output | ||
| 776 | } | ||
| 777 | |||
| 778 | unsigned long size() | ||
| 779 | { | ||
| 780 | //not supported for file output | ||
| 781 | return 0; | ||
| 782 | } | ||
| 783 | |||
| 784 | void eraseAll() | ||
| 785 | { | ||
| 786 | //_curser_position=0; | ||
| 787 | //_output_stream.seekp(_curser_position); | ||
| 788 | } | ||
| 789 | |||
| 790 | protected: | ||
| 791 | std::ofstream _output_stream; | ||
| 792 | std::ofstream::pos_type _dataHdrPos; | ||
| 793 | std::ofstream::pos_type _dataEofPos; | ||
| 794 | unsigned int _curser_position; | ||
| 795 | unsigned int _uiValueCount; | ||
| 796 | std::string _file_name; | ||
| 797 | double *_doubleMatrixData1; | ||
| 798 | double *_doubleMatrixData2; | ||
| 799 | char *_stringMatrix; | ||
| 800 | int *_intMatrix; | ||
| 801 | vector<string> _var_outputs; | ||
| 802 | }; | ||
| 803 | /** @} */ // end of dataexchangePolicies | ||
| 804 |