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

Method InsertField

IO/TecplotTable/vtkTecplotTableReader.cxx:261–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259
260private:
261 void InsertField()
262 {
263 vtkIdType fieldIndex = this->CurrentFieldIndex;
264 if (this->CurrentRecordIndex == ColumnNamesOnLine)
265 {
266 fieldIndex -= SkipColumnNames;
267 }
268
269 if (fieldIndex >= this->OutputTable->GetNumberOfColumns() &&
270 ColumnNamesOnLine == this->CurrentRecordIndex)
271 {
272 vtkDoubleArray* array = vtkDoubleArray::New();
273
274 array->SetName(this->CurrentField.c_str());
275 this->OutputTable->AddColumn(array);
276 array->Delete();
277 }
278 else if (fieldIndex < this->OutputTable->GetNumberOfColumns())
279 {
280 // Handle case where input file has header information ...
281 vtkIdType recordIndex;
282 recordIndex = this->CurrentRecordIndex - HeaderLines;
283 vtkDoubleArray* array =
284 vtkArrayDownCast<vtkDoubleArray>(this->OutputTable->GetColumn(fieldIndex));
285
286 vtkStdString str = this->CurrentField;
287 bool ok;
288 double doubleValue = vtkVariant(str).ToDouble(&ok);
289 if (ok)
290 {
291 array->InsertValue(recordIndex, doubleValue);
292 }
293 else
294 {
295 array->InsertValue(recordIndex, std::numeric_limits<double>::quiet_NaN());
296 }
297 }
298 }
299
300 vtkIdType MaxRecords;
301 vtkIdType MaxRecordIndex;

Callers 2

ReachedEndOfInputMethod · 0.95

Calls 10

DeleteMethod · 0.65
NewFunction · 0.50
vtkVariantClass · 0.50
GetNumberOfColumnsMethod · 0.45
SetNameMethod · 0.45
c_strMethod · 0.45
AddColumnMethod · 0.45
GetColumnMethod · 0.45
ToDoubleMethod · 0.45
InsertValueMethod · 0.45

Tested by

no test coverage detected