MCPcopy Create free account
hub / github.com/Kitware/VTK / readCaseFileValues

Function readCaseFileValues

IO/EnSight/core/EnSightDataSet.cxx:388–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386
387template <typename T>
388void 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
423template <typename T>
424void readFileValues(EnSightFile& file, std::vector<T>& values)

Callers 2

ParseVariableSectionMethod · 0.85
ParseTimeSectionMethod · 0.85

Calls 6

extractLinePartFunction · 0.85
ReadNextLineMethod · 0.80
GoBackOneLineMethod · 0.80
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected