------------------------------------------------------------------------------
| 77 | |
| 78 | //------------------------------------------------------------------------------ |
| 79 | int vtkEnSight6Reader::ReadGeometryFile( |
| 80 | const char* fileName, int timeStep, vtkMultiBlockDataSet* output) |
| 81 | { |
| 82 | char line[256]; |
| 83 | int partId; |
| 84 | int lineRead; |
| 85 | int pointId; |
| 86 | float point[3]; |
| 87 | int i, j; |
| 88 | int pointIdsListed; |
| 89 | |
| 90 | // Initialize |
| 91 | // |
| 92 | if (!fileName) |
| 93 | { |
| 94 | vtkErrorMacro("A GeometryFileName must be specified in the case file."); |
| 95 | return 0; |
| 96 | } |
| 97 | std::string sfilename; |
| 98 | if (this->FilePath) |
| 99 | { |
| 100 | sfilename = this->FilePath; |
| 101 | if (sfilename.at(sfilename.length() - 1) != '/') |
| 102 | { |
| 103 | sfilename += "/"; |
| 104 | } |
| 105 | sfilename += fileName; |
| 106 | vtkDebugMacro("full path to geometry file: " << sfilename); |
| 107 | } |
| 108 | else |
| 109 | { |
| 110 | sfilename = fileName; |
| 111 | } |
| 112 | |
| 113 | this->IS = new vtksys::ifstream(sfilename.c_str(), ios::in); |
| 114 | if (this->IS->fail()) |
| 115 | { |
| 116 | vtkErrorMacro("Unable to open file: " << sfilename); |
| 117 | delete this->IS; |
| 118 | this->IS = nullptr; |
| 119 | return 0; |
| 120 | } |
| 121 | |
| 122 | this->ReadLine(line); |
| 123 | |
| 124 | auto resultSubLine0 = |
| 125 | vtk::scan<std::string_view, std::string_view>(std::string_view(line), "{:s} {:s}"); |
| 126 | if (resultSubLine0) |
| 127 | { |
| 128 | auto subLine = std::get<1>(resultSubLine0->values()); |
| 129 | if (subLine == "Binary") |
| 130 | { |
| 131 | vtkErrorMacro("This is a binary data set. Try vtkEnSight6BinaryReader."); |
| 132 | return 0; |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | if (this->UseFileSets) |
no test coverage detected