| 386 | |
| 387 | template <typename T> |
| 388 | void readCaseFileValues(EnSightFile& file, std::string& line, std::vector<T>& values) |
| 389 | { |
| 390 | // time values may not all be on one line, and they may not even start |
| 391 | // on the same line as 'time values:' |
| 392 | T val; |
| 393 | bool continueReading = true; |
| 394 | while (continueReading) |
| 395 | { |
| 396 | while (extractLinePart(GetNumRegEx(), line, val)) |
| 397 | { |
| 398 | values.push_back(val); |
| 399 | } |
| 400 | |
| 401 | // Once we process a line, we need |
| 402 | // to read the next to see if it contains time values |
| 403 | // or if we should move on with processing the rest of the file |
| 404 | auto result = file.ReadNextLine(MAX_CASE_LINE_LENGTH); |
| 405 | continueReading = result.first; |
| 406 | if (continueReading) |
| 407 | { |
| 408 | line = result.second; |
| 409 | if (!std::all_of(line.begin(), line.end(), |
| 410 | [](char c) -> bool |
| 411 | { return isdigit(c) || isspace(c) || c == '.' || c == 'e' || c == '+' || c == '-'; })) |
| 412 | { |
| 413 | // The current line is not more time step values, so reset |
| 414 | // this line so we can continue processing. |
| 415 | file.GoBackOneLine(); |
| 416 | continueReading = false; |
| 417 | // break; |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | template <typename T> |
| 424 | void readFileValues(EnSightFile& file, std::vector<T>& values) |
no test coverage detected