------------------------------------------------------------------------------
| 206 | |
| 207 | //------------------------------------------------------------------------------ |
| 208 | bool vtkTemporalDelimitedTextReader::EnforceColumnName() |
| 209 | { |
| 210 | this->InternalColumnName = ""; |
| 211 | |
| 212 | if (this->TimeColumnName.empty() && this->TimeColumnId == -1) |
| 213 | { |
| 214 | // No user specified input, the reader simply output the whole content of |
| 215 | // the input file. |
| 216 | return true; |
| 217 | } |
| 218 | |
| 219 | // Set TimeColumnName from user input |
| 220 | if (this->TimeColumnId != -1) |
| 221 | { |
| 222 | // use id to retrieve column |
| 223 | if (this->TimeColumnId >= 0 && this->TimeColumnId < this->ReadTable->GetNumberOfColumns()) |
| 224 | { |
| 225 | this->InternalColumnName = this->ReadTable->GetColumnName(this->TimeColumnId); |
| 226 | } |
| 227 | else |
| 228 | { |
| 229 | vtkErrorMacro("Invalid column id: " << this->TimeColumnId); |
| 230 | return false; |
| 231 | } |
| 232 | } |
| 233 | else if (!this->TimeColumnName.empty()) |
| 234 | { |
| 235 | // use name to retrieve column |
| 236 | vtkAbstractArray* arr = this->ReadTable->GetColumnByName(this->TimeColumnName.c_str()); |
| 237 | if (arr == nullptr) |
| 238 | { |
| 239 | vtkErrorMacro("Invalid column name: " << this->TimeColumnName); |
| 240 | return false; |
| 241 | } |
| 242 | else |
| 243 | { |
| 244 | // check valid array |
| 245 | vtkDataArray* numArr = vtkDataArray::SafeDownCast(arr); |
| 246 | if (numArr == nullptr) |
| 247 | { |
| 248 | vtkErrorMacro("Not a numerical column: " << this->TimeColumnName); |
| 249 | return false; |
| 250 | } |
| 251 | else if (numArr->GetNumberOfComponents() != 1) |
| 252 | { |
| 253 | vtkErrorMacro("The time column must have only one component: " << this->TimeColumnName); |
| 254 | return false; |
| 255 | } |
| 256 | } |
| 257 | this->InternalColumnName = this->TimeColumnName; |
| 258 | } |
| 259 | |
| 260 | return true; |
| 261 | } |
| 262 | |
| 263 | //------------------------------------------------------------------------------ |
| 264 | void vtkTemporalDelimitedTextReader::InternalModified() |
no test coverage detected