1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * Copyright (C) 2004-2012 HUBzero Foundation, LLC |
---|
4 | * |
---|
5 | * Author: Leif Delgass <ldelgass@purdue.edu> |
---|
6 | */ |
---|
7 | |
---|
8 | #include <cassert> |
---|
9 | #include <cstring> |
---|
10 | #include <cfloat> |
---|
11 | #include <cmath> |
---|
12 | |
---|
13 | #include <vtkCharArray.h> |
---|
14 | #include <vtkDataSetReader.h> |
---|
15 | #include <vtkDataSetWriter.h> |
---|
16 | #include <vtkPolyData.h> |
---|
17 | #include <vtkStructuredPoints.h> |
---|
18 | #include <vtkStructuredGrid.h> |
---|
19 | #include <vtkRectilinearGrid.h> |
---|
20 | #include <vtkUnstructuredGrid.h> |
---|
21 | #include <vtkProperty.h> |
---|
22 | #include <vtkPointData.h> |
---|
23 | #include <vtkCellData.h> |
---|
24 | #include <vtkCell.h> |
---|
25 | #include <vtkLookupTable.h> |
---|
26 | #include <vtkExtractUnstructuredGrid.h> |
---|
27 | |
---|
28 | #include "DataSet.h" |
---|
29 | #include "Trace.h" |
---|
30 | |
---|
31 | using namespace VtkVis; |
---|
32 | |
---|
33 | DataSet::DataSet(const std::string& name) : |
---|
34 | _name(name), |
---|
35 | _visible(true), |
---|
36 | _opacity(1), |
---|
37 | _cellSizeAverage(0) |
---|
38 | { |
---|
39 | _cellSizeRange[0] = -1; |
---|
40 | _cellSizeRange[1] = -1; |
---|
41 | } |
---|
42 | |
---|
43 | DataSet::~DataSet() |
---|
44 | { |
---|
45 | } |
---|
46 | |
---|
47 | /** |
---|
48 | * \brief Set opacity of DataSet outline |
---|
49 | * |
---|
50 | * This method is used for record-keeping and opacity of the |
---|
51 | * DataSet bounds outline. The renderer controls opacity |
---|
52 | * of other related graphics objects. |
---|
53 | */ |
---|
54 | void DataSet::setOpacity(double opacity) |
---|
55 | { |
---|
56 | _opacity = opacity; |
---|
57 | } |
---|
58 | |
---|
59 | /** |
---|
60 | * \brief Set visibility flag in DataSet |
---|
61 | * |
---|
62 | * This method is used for record-keeping and visibility of the |
---|
63 | * DataSet bounds outline. The renderer controls visibility |
---|
64 | * of other related graphics objects. |
---|
65 | */ |
---|
66 | void DataSet::setVisibility(bool state) |
---|
67 | { |
---|
68 | _visible = state; |
---|
69 | } |
---|
70 | |
---|
71 | /** |
---|
72 | * \brief Get visibility flag in DataSet |
---|
73 | * |
---|
74 | * This method is used for record-keeping. The renderer controls |
---|
75 | * the visibility of related graphics objects. |
---|
76 | */ |
---|
77 | bool DataSet::getVisibility() const |
---|
78 | { |
---|
79 | return _visible; |
---|
80 | } |
---|
81 | |
---|
82 | void DataSet::writeDataFile(const char *filename) |
---|
83 | { |
---|
84 | if (_dataSet == NULL) |
---|
85 | return; |
---|
86 | |
---|
87 | vtkSmartPointer<vtkDataSetWriter> writer = vtkSmartPointer<vtkDataSetWriter>::New(); |
---|
88 | |
---|
89 | writer->SetFileName(filename); |
---|
90 | #ifdef USE_VTK6 |
---|
91 | writer->SetInputData(_dataSet); |
---|
92 | #else |
---|
93 | writer->SetInput(_dataSet); |
---|
94 | #endif |
---|
95 | writer->Write(); |
---|
96 | } |
---|
97 | |
---|
98 | /** |
---|
99 | * \brief Read a VTK data file |
---|
100 | */ |
---|
101 | bool DataSet::setDataFile(const char *filename) |
---|
102 | { |
---|
103 | vtkSmartPointer<vtkDataSetReader> reader = vtkSmartPointer<vtkDataSetReader>::New(); |
---|
104 | |
---|
105 | #if defined(WANT_TRACE) && defined(DEBUG) |
---|
106 | reader->DebugOn(); |
---|
107 | #endif |
---|
108 | |
---|
109 | reader->SetFileName(filename); |
---|
110 | reader->ReadAllNormalsOn(); |
---|
111 | reader->ReadAllTCoordsOn(); |
---|
112 | reader->ReadAllScalarsOn(); |
---|
113 | reader->ReadAllColorScalarsOn(); |
---|
114 | reader->ReadAllVectorsOn(); |
---|
115 | reader->ReadAllTensorsOn(); |
---|
116 | reader->ReadAllFieldsOn(); |
---|
117 | |
---|
118 | return setData(reader); |
---|
119 | } |
---|
120 | |
---|
121 | /** |
---|
122 | * \brief Read a VTK data file from a memory buffer |
---|
123 | */ |
---|
124 | bool DataSet::setData(char *data, int nbytes) |
---|
125 | { |
---|
126 | vtkSmartPointer<vtkDataSetReader> reader = vtkSmartPointer<vtkDataSetReader>::New(); |
---|
127 | vtkSmartPointer<vtkCharArray> dataSetString = vtkSmartPointer<vtkCharArray>::New(); |
---|
128 | |
---|
129 | #if defined(WANT_TRACE) && defined(DEBUG) |
---|
130 | reader->DebugOn(); |
---|
131 | dataSetString->DebugOn(); |
---|
132 | #endif |
---|
133 | |
---|
134 | dataSetString->SetArray(data, nbytes, 1); |
---|
135 | reader->SetInputArray(dataSetString); |
---|
136 | reader->ReadFromInputStringOn(); |
---|
137 | reader->ReadAllNormalsOn(); |
---|
138 | reader->ReadAllTCoordsOn(); |
---|
139 | reader->ReadAllScalarsOn(); |
---|
140 | reader->ReadAllColorScalarsOn(); |
---|
141 | reader->ReadAllVectorsOn(); |
---|
142 | reader->ReadAllTensorsOn(); |
---|
143 | reader->ReadAllFieldsOn(); |
---|
144 | |
---|
145 | return setData(reader); |
---|
146 | } |
---|
147 | |
---|
148 | /** |
---|
149 | * \brief Read dataset using supplied reader |
---|
150 | * |
---|
151 | * Pipeline information is removed from the resulting |
---|
152 | * vtkDataSet, so that the reader and its data can be |
---|
153 | * released |
---|
154 | */ |
---|
155 | bool DataSet::setData(vtkDataSetReader *reader) |
---|
156 | { |
---|
157 | TRACE("Enter"); |
---|
158 | // Force reading data set |
---|
159 | reader->SetLookupTableName(""); |
---|
160 | reader->Update(); |
---|
161 | |
---|
162 | _dataSet = reader->GetOutput(); |
---|
163 | if (_dataSet == NULL) |
---|
164 | return false; |
---|
165 | |
---|
166 | if (vtkUnstructuredGrid::SafeDownCast(_dataSet) != NULL && !isCloud()) { |
---|
167 | vtkSmartPointer<vtkExtractUnstructuredGrid> filter = vtkSmartPointer<vtkExtractUnstructuredGrid>::New(); |
---|
168 | #ifdef USE_VTK6 |
---|
169 | filter->SetInputData(_dataSet); |
---|
170 | #else |
---|
171 | filter->SetInput(_dataSet); |
---|
172 | #endif |
---|
173 | filter->MergingOn(); |
---|
174 | filter->ReleaseDataFlagOn(); |
---|
175 | filter->Update(); |
---|
176 | _dataSet = filter->GetOutput(); |
---|
177 | } |
---|
178 | |
---|
179 | #ifndef USE_VTK6 |
---|
180 | _dataSet->SetPipelineInformation(NULL); |
---|
181 | #endif |
---|
182 | if (_dataSet->GetPointData() != NULL && |
---|
183 | _dataSet->GetPointData()->GetScalars() != NULL && |
---|
184 | _dataSet->GetPointData()->GetScalars()->GetLookupTable() != NULL) { |
---|
185 | USER_ERROR("No lookup table should be specified in VTK data sets"); |
---|
186 | } |
---|
187 | |
---|
188 | setDefaultArrays(); |
---|
189 | |
---|
190 | #ifdef WANT_TRACE |
---|
191 | print(); |
---|
192 | #endif |
---|
193 | TRACE("Leave"); |
---|
194 | return true; |
---|
195 | } |
---|
196 | |
---|
197 | /** |
---|
198 | * \brief Set DataSet from existing vtkDataSet object |
---|
199 | * |
---|
200 | * Pipeline information is removed from the supplied vtkDataSet |
---|
201 | */ |
---|
202 | bool DataSet::setData(vtkDataSet *ds) |
---|
203 | { |
---|
204 | _dataSet = ds; |
---|
205 | #ifndef USE_VTK6 |
---|
206 | _dataSet->SetPipelineInformation(NULL); |
---|
207 | #endif |
---|
208 | |
---|
209 | if (_dataSet->GetPointData() != NULL && |
---|
210 | _dataSet->GetPointData()->GetScalars() != NULL && |
---|
211 | _dataSet->GetPointData()->GetScalars()->GetLookupTable() != NULL) { |
---|
212 | USER_ERROR("No lookup table should be specified in VTK data sets"); |
---|
213 | } |
---|
214 | |
---|
215 | setDefaultArrays(); |
---|
216 | |
---|
217 | #ifdef WANT_TRACE |
---|
218 | print(); |
---|
219 | #endif |
---|
220 | return true; |
---|
221 | } |
---|
222 | |
---|
223 | /** |
---|
224 | * \brief Copy an existing vtkDataSet object |
---|
225 | * |
---|
226 | * Pipeline information is not copied from the supplied vtkDataSet |
---|
227 | * into this DataSet, but pipeline information in the supplied |
---|
228 | * vtkDataSet is not removed |
---|
229 | */ |
---|
230 | vtkDataSet *DataSet::copyData(vtkDataSet *ds) |
---|
231 | { |
---|
232 | if (vtkPolyData::SafeDownCast(ds) != NULL) { |
---|
233 | _dataSet = vtkSmartPointer<vtkPolyData>::New(); |
---|
234 | _dataSet->DeepCopy(vtkPolyData::SafeDownCast(ds)); |
---|
235 | } else if (vtkStructuredPoints::SafeDownCast(ds) != NULL) { |
---|
236 | _dataSet = vtkSmartPointer<vtkStructuredPoints>::New(); |
---|
237 | _dataSet->DeepCopy(vtkStructuredPoints::SafeDownCast(ds)); |
---|
238 | } else if (vtkStructuredGrid::SafeDownCast(ds) != NULL) { |
---|
239 | _dataSet = vtkSmartPointer<vtkStructuredGrid>::New(); |
---|
240 | _dataSet->DeepCopy(vtkStructuredGrid::SafeDownCast(ds)); |
---|
241 | } else if (vtkRectilinearGrid::SafeDownCast(ds) != NULL) { |
---|
242 | _dataSet = vtkSmartPointer<vtkRectilinearGrid>::New(); |
---|
243 | _dataSet->DeepCopy(vtkRectilinearGrid::SafeDownCast(ds)); |
---|
244 | } else if (vtkUnstructuredGrid::SafeDownCast(ds) != NULL) { |
---|
245 | _dataSet = vtkSmartPointer<vtkUnstructuredGrid>::New(); |
---|
246 | _dataSet->DeepCopy(vtkUnstructuredGrid::SafeDownCast(ds)); |
---|
247 | } else { |
---|
248 | ERROR("Unknown data type"); |
---|
249 | return NULL; |
---|
250 | } |
---|
251 | |
---|
252 | #ifdef WANT_TRACE |
---|
253 | print(); |
---|
254 | #endif |
---|
255 | return _dataSet; |
---|
256 | } |
---|
257 | |
---|
258 | /** |
---|
259 | * \brief Returns the dimensionality of the AABB |
---|
260 | */ |
---|
261 | int DataSet::numDimensions() const |
---|
262 | { |
---|
263 | double bounds[6]; |
---|
264 | getBounds(bounds); |
---|
265 | int numDims = 0; |
---|
266 | if (bounds[0] != bounds[1]) |
---|
267 | numDims++; |
---|
268 | if (bounds[2] != bounds[3]) |
---|
269 | numDims++; |
---|
270 | if (bounds[4] != bounds[5]) |
---|
271 | numDims++; |
---|
272 | |
---|
273 | return numDims; |
---|
274 | } |
---|
275 | |
---|
276 | /** |
---|
277 | * \brief Determines if DataSet lies in a principal axis plane |
---|
278 | * and if so, returns the plane normal and offset from origin |
---|
279 | */ |
---|
280 | bool DataSet::is2D(PrincipalPlane *plane, double *offset) const |
---|
281 | { |
---|
282 | double bounds[6]; |
---|
283 | getBounds(bounds); |
---|
284 | if (bounds[4] == bounds[5]) { |
---|
285 | // Zmin = Zmax, XY plane |
---|
286 | if (plane != NULL) { |
---|
287 | *plane = PLANE_XY; |
---|
288 | } |
---|
289 | if (offset != NULL) |
---|
290 | *offset = bounds[4]; |
---|
291 | return true; |
---|
292 | } else if (bounds[0] == bounds[1]) { |
---|
293 | // Xmin = Xmax, ZY plane |
---|
294 | if (plane != NULL) { |
---|
295 | *plane = PLANE_ZY; |
---|
296 | } |
---|
297 | if (offset != NULL) |
---|
298 | *offset = bounds[0]; |
---|
299 | return true; |
---|
300 | } else if (bounds[2] == bounds[3]) { |
---|
301 | // Ymin = Ymax, XZ plane |
---|
302 | if (plane != NULL) { |
---|
303 | *plane = PLANE_XZ; |
---|
304 | } |
---|
305 | if (offset != NULL) |
---|
306 | *offset = bounds[2]; |
---|
307 | return true; |
---|
308 | } |
---|
309 | return false; |
---|
310 | } |
---|
311 | |
---|
312 | /** |
---|
313 | * \brief Determines a principal plane with the |
---|
314 | * largest two dimensions of the AABB |
---|
315 | */ |
---|
316 | PrincipalPlane DataSet::principalPlane() const |
---|
317 | { |
---|
318 | double bounds[6]; |
---|
319 | getBounds(bounds); |
---|
320 | double xlen = bounds[1] - bounds[0]; |
---|
321 | double ylen = bounds[3] - bounds[2]; |
---|
322 | double zlen = bounds[5] - bounds[4]; |
---|
323 | if (zlen <= xlen && zlen <= ylen) { |
---|
324 | return PLANE_XY; |
---|
325 | } else if (xlen <= ylen && xlen <= zlen) { |
---|
326 | return PLANE_ZY; |
---|
327 | } else { |
---|
328 | return PLANE_XZ; |
---|
329 | } |
---|
330 | } |
---|
331 | |
---|
332 | /** |
---|
333 | * \brief Determines if mesh is a point cloud (has no cells) |
---|
334 | */ |
---|
335 | bool DataSet::isCloud() const |
---|
336 | { |
---|
337 | vtkPolyData *pd = vtkPolyData::SafeDownCast(_dataSet); |
---|
338 | if (pd) { |
---|
339 | // If PolyData, is a cloud if there are no cells other than vertices |
---|
340 | if (pd->GetNumberOfLines() == 0 && |
---|
341 | pd->GetNumberOfPolys() == 0 && |
---|
342 | pd->GetNumberOfStrips() == 0) { |
---|
343 | return true; |
---|
344 | } else { |
---|
345 | // Has cells |
---|
346 | return false; |
---|
347 | } |
---|
348 | } else { |
---|
349 | return (_dataSet->GetNumberOfCells() == 0); |
---|
350 | } |
---|
351 | } |
---|
352 | |
---|
353 | /** |
---|
354 | * \brief Get the name/id of this dataset |
---|
355 | */ |
---|
356 | const std::string& DataSet::getName() const |
---|
357 | { |
---|
358 | return _name; |
---|
359 | } |
---|
360 | |
---|
361 | /** |
---|
362 | * \brief Get the underlying VTK DataSet object |
---|
363 | */ |
---|
364 | vtkDataSet *DataSet::getVtkDataSet() |
---|
365 | { |
---|
366 | return _dataSet; |
---|
367 | } |
---|
368 | |
---|
369 | /** |
---|
370 | * \brief Get the underlying VTK DataSet subclass class name |
---|
371 | */ |
---|
372 | const char *DataSet::getVtkType() const |
---|
373 | { |
---|
374 | return _dataSet->GetClassName(); |
---|
375 | } |
---|
376 | |
---|
377 | /** |
---|
378 | * \brief Set the ative scalar array to the named field |
---|
379 | */ |
---|
380 | bool DataSet::setActiveScalars(const char *name) |
---|
381 | { |
---|
382 | bool found = false; |
---|
383 | if (_dataSet != NULL) { |
---|
384 | if (!hasField(name)) { |
---|
385 | ERROR("No field named %s in %s", name, getName().c_str()); |
---|
386 | } else { |
---|
387 | if (_dataSet->GetPointData() != NULL) { |
---|
388 | if (_dataSet->GetPointData()->SetActiveScalars(name) >= 0) { |
---|
389 | TRACE("Set active point data scalars for %s to %s", getName().c_str(), name); |
---|
390 | found = true; |
---|
391 | } |
---|
392 | } |
---|
393 | if (_dataSet->GetCellData() != NULL) { |
---|
394 | if (_dataSet->GetCellData()->SetActiveScalars(name) >= 0) { |
---|
395 | TRACE("Set active cell data scalars for %s to %s", getName().c_str(), name); |
---|
396 | found = true; |
---|
397 | } |
---|
398 | } |
---|
399 | } |
---|
400 | } |
---|
401 | #ifdef WANT_TRACE |
---|
402 | if (_dataSet->GetPointData() != NULL) { |
---|
403 | if (_dataSet->GetPointData()->GetScalars() != NULL) { |
---|
404 | TRACE("Point data scalars for %s: %s", getName().c_str(), _dataSet->GetPointData()->GetScalars()->GetName()); |
---|
405 | } else { |
---|
406 | TRACE("NULL point data scalars for %s", getName().c_str()); |
---|
407 | } |
---|
408 | } |
---|
409 | if (_dataSet->GetCellData() != NULL) { |
---|
410 | if (_dataSet->GetCellData()->GetScalars() != NULL) { |
---|
411 | TRACE("Cell data scalars for %s: %s", getName().c_str(), _dataSet->GetCellData()->GetScalars()->GetName()); |
---|
412 | } else { |
---|
413 | TRACE("NULL cell data scalars for %s", getName().c_str()); |
---|
414 | } |
---|
415 | } |
---|
416 | #endif |
---|
417 | return found; |
---|
418 | } |
---|
419 | |
---|
420 | /** |
---|
421 | * \brief Get the active scalar array field name |
---|
422 | */ |
---|
423 | const char *DataSet::getActiveScalarsName() const |
---|
424 | { |
---|
425 | if (_dataSet != NULL) { |
---|
426 | if (_dataSet->GetPointData() != NULL && |
---|
427 | _dataSet->GetPointData()->GetScalars() != NULL) { |
---|
428 | return _dataSet->GetPointData()->GetScalars()->GetName(); |
---|
429 | } |
---|
430 | #ifdef DEBUG |
---|
431 | TRACE("No point scalars"); |
---|
432 | #endif |
---|
433 | if (_dataSet->GetCellData() != NULL && |
---|
434 | _dataSet->GetCellData()->GetScalars() != NULL) { |
---|
435 | return _dataSet->GetCellData()->GetScalars()->GetName(); |
---|
436 | } |
---|
437 | #ifdef DEBUG |
---|
438 | TRACE("No cell scalars"); |
---|
439 | #endif |
---|
440 | } |
---|
441 | return NULL; |
---|
442 | } |
---|
443 | |
---|
444 | /** |
---|
445 | * \brief Get the active scalar array default attribute type |
---|
446 | */ |
---|
447 | DataSet::DataAttributeType DataSet::getActiveScalarsType() const |
---|
448 | { |
---|
449 | if (_dataSet != NULL) { |
---|
450 | if (_dataSet->GetPointData() != NULL && |
---|
451 | _dataSet->GetPointData()->GetScalars() != NULL) { |
---|
452 | return POINT_DATA; |
---|
453 | } |
---|
454 | #ifdef DEBUG |
---|
455 | TRACE("No point scalars"); |
---|
456 | #endif |
---|
457 | if (_dataSet->GetCellData() != NULL && |
---|
458 | _dataSet->GetCellData()->GetScalars() != NULL) { |
---|
459 | return CELL_DATA; |
---|
460 | } |
---|
461 | #ifdef DEBUG |
---|
462 | TRACE("No cell scalars"); |
---|
463 | #endif |
---|
464 | } |
---|
465 | return POINT_DATA; |
---|
466 | } |
---|
467 | |
---|
468 | /** |
---|
469 | * \brief Set the ative vector array to the named field |
---|
470 | */ |
---|
471 | bool DataSet::setActiveVectors(const char *name) |
---|
472 | { |
---|
473 | bool found = false; |
---|
474 | if (_dataSet != NULL) { |
---|
475 | if (!hasField(name)) { |
---|
476 | ERROR("No field named %s in %s", name, getName().c_str()); |
---|
477 | } else { |
---|
478 | if (_dataSet->GetPointData() != NULL) { |
---|
479 | if (_dataSet->GetPointData()->SetActiveVectors(name) >= 0) { |
---|
480 | TRACE("Set active point data vectors for %s to %s", getName().c_str(), name); |
---|
481 | found = true; |
---|
482 | } |
---|
483 | } |
---|
484 | if (_dataSet->GetCellData() != NULL) { |
---|
485 | if (_dataSet->GetCellData()->SetActiveVectors(name) >= 0) { |
---|
486 | TRACE("Set active cell data vectors for %s to %s", getName().c_str(), name); |
---|
487 | found = true; |
---|
488 | } |
---|
489 | } |
---|
490 | } |
---|
491 | } |
---|
492 | #ifdef WANT_TRACE |
---|
493 | if (_dataSet->GetPointData() != NULL) { |
---|
494 | if (_dataSet->GetPointData()->GetVectors() != NULL) { |
---|
495 | TRACE("Point data vectors for %s: %s", getName().c_str(), _dataSet->GetPointData()->GetVectors()->GetName()); |
---|
496 | } else { |
---|
497 | TRACE("NULL point data vectors for %s", getName().c_str()); |
---|
498 | } |
---|
499 | } |
---|
500 | if (_dataSet->GetCellData() != NULL) { |
---|
501 | if (_dataSet->GetCellData()->GetVectors() != NULL) { |
---|
502 | TRACE("Cell data vectors for %s: %s", getName().c_str(), _dataSet->GetCellData()->GetVectors()->GetName()); |
---|
503 | } else { |
---|
504 | TRACE("NULL cell data vectors for %s", getName().c_str()); |
---|
505 | } |
---|
506 | } |
---|
507 | #endif |
---|
508 | return found; |
---|
509 | } |
---|
510 | |
---|
511 | /** |
---|
512 | * \brief Get the active vector array default attribute type |
---|
513 | */ |
---|
514 | DataSet::DataAttributeType DataSet::getActiveVectorsType() const |
---|
515 | { |
---|
516 | if (_dataSet != NULL) { |
---|
517 | if (_dataSet->GetPointData() != NULL && |
---|
518 | _dataSet->GetPointData()->GetVectors() != NULL) { |
---|
519 | return POINT_DATA; |
---|
520 | } |
---|
521 | #ifdef DEBUG |
---|
522 | TRACE("No point vectors"); |
---|
523 | #endif |
---|
524 | if (_dataSet->GetCellData() != NULL && |
---|
525 | _dataSet->GetCellData()->GetVectors() != NULL) { |
---|
526 | return CELL_DATA; |
---|
527 | } |
---|
528 | #ifdef DEBUG |
---|
529 | TRACE("No cell vectors"); |
---|
530 | #endif |
---|
531 | } |
---|
532 | return POINT_DATA; |
---|
533 | } |
---|
534 | |
---|
535 | /** |
---|
536 | * \brief Get the active vector array field name |
---|
537 | */ |
---|
538 | const char *DataSet::getActiveVectorsName() const |
---|
539 | { |
---|
540 | if (_dataSet != NULL) { |
---|
541 | if (_dataSet->GetPointData() != NULL && |
---|
542 | _dataSet->GetPointData()->GetVectors() != NULL) { |
---|
543 | return _dataSet->GetPointData()->GetVectors()->GetName(); |
---|
544 | } |
---|
545 | #ifdef DEBUG |
---|
546 | TRACE("No point vectors"); |
---|
547 | #endif |
---|
548 | if (_dataSet->GetCellData() != NULL && |
---|
549 | _dataSet->GetCellData()->GetVectors() != NULL) { |
---|
550 | return _dataSet->GetCellData()->GetVectors()->GetName(); |
---|
551 | } |
---|
552 | #ifdef DEBUG |
---|
553 | TRACE("No cell vectors"); |
---|
554 | #endif |
---|
555 | } |
---|
556 | return NULL; |
---|
557 | } |
---|
558 | |
---|
559 | void DataSet::setDefaultArrays() |
---|
560 | { |
---|
561 | if (_dataSet->GetPointData() != NULL && |
---|
562 | _dataSet->GetPointData()->GetScalars() == NULL && |
---|
563 | _dataSet->GetPointData()->GetNumberOfArrays() > 0) { |
---|
564 | for (int i = 0; i < _dataSet->GetPointData()->GetNumberOfArrays(); i++) { |
---|
565 | if (_dataSet->GetPointData()->GetArray(i) != NULL && |
---|
566 | _dataSet->GetPointData()->GetArray(i)->GetNumberOfComponents() == 1) { |
---|
567 | TRACE("Setting point scalars to '%s'", _dataSet->GetPointData()->GetArrayName(i)); |
---|
568 | _dataSet->GetPointData()->SetActiveScalars(_dataSet->GetPointData()->GetArrayName(i)); |
---|
569 | break; |
---|
570 | } |
---|
571 | } |
---|
572 | } |
---|
573 | if (_dataSet->GetPointData() != NULL && |
---|
574 | _dataSet->GetPointData()->GetVectors() == NULL && |
---|
575 | _dataSet->GetPointData()->GetNumberOfArrays() > 0) { |
---|
576 | for (int i = 0; i < _dataSet->GetPointData()->GetNumberOfArrays(); i++) { |
---|
577 | if (_dataSet->GetPointData()->GetArray(i) != NULL && |
---|
578 | _dataSet->GetPointData()->GetArray(i)->GetNumberOfComponents() == 3) { |
---|
579 | TRACE("Setting point vectors to '%s'", _dataSet->GetPointData()->GetArrayName(i)); |
---|
580 | _dataSet->GetPointData()->SetActiveVectors(_dataSet->GetPointData()->GetArrayName(i)); |
---|
581 | break; |
---|
582 | } |
---|
583 | } |
---|
584 | } |
---|
585 | if (_dataSet->GetCellData() != NULL && |
---|
586 | _dataSet->GetCellData()->GetScalars() == NULL && |
---|
587 | _dataSet->GetCellData()->GetNumberOfArrays() > 0) { |
---|
588 | for (int i = 0; i < _dataSet->GetCellData()->GetNumberOfArrays(); i++) { |
---|
589 | if (_dataSet->GetCellData()->GetArray(i) != NULL && |
---|
590 | _dataSet->GetCellData()->GetArray(i)->GetNumberOfComponents() == 1) { |
---|
591 | TRACE("Setting cell scalars to '%s'", _dataSet->GetCellData()->GetArrayName(i)); |
---|
592 | _dataSet->GetCellData()->SetActiveScalars(_dataSet->GetCellData()->GetArrayName(i)); |
---|
593 | break; |
---|
594 | } |
---|
595 | } |
---|
596 | } |
---|
597 | if (_dataSet->GetCellData() != NULL && |
---|
598 | _dataSet->GetCellData()->GetVectors() == NULL && |
---|
599 | _dataSet->GetCellData()->GetNumberOfArrays() > 0) { |
---|
600 | for (int i = 0; i < _dataSet->GetCellData()->GetNumberOfArrays(); i++) { |
---|
601 | if (_dataSet->GetCellData()->GetArray(i) != NULL && |
---|
602 | _dataSet->GetCellData()->GetArray(i)->GetNumberOfComponents() == 3) { |
---|
603 | TRACE("Setting cell vectors to '%s'", _dataSet->GetCellData()->GetArrayName(i)); |
---|
604 | _dataSet->GetCellData()->SetActiveVectors(_dataSet->GetCellData()->GetArrayName(i)); |
---|
605 | break; |
---|
606 | } |
---|
607 | } |
---|
608 | } |
---|
609 | } |
---|
610 | |
---|
611 | bool DataSet::getFieldInfo(const char *fieldName, |
---|
612 | DataAttributeType *type, |
---|
613 | int *numComponents) const |
---|
614 | { |
---|
615 | if (_dataSet->GetPointData() != NULL && |
---|
616 | _dataSet->GetPointData()->GetAbstractArray(fieldName) != NULL) { |
---|
617 | if (type != NULL) |
---|
618 | *type = POINT_DATA; |
---|
619 | if (numComponents != NULL) |
---|
620 | *numComponents = _dataSet->GetPointData()->GetAbstractArray(fieldName)->GetNumberOfComponents(); |
---|
621 | return true; |
---|
622 | } else if (_dataSet->GetCellData() != NULL && |
---|
623 | _dataSet->GetCellData()->GetAbstractArray(fieldName) != NULL) { |
---|
624 | if (type != NULL) |
---|
625 | *type = CELL_DATA; |
---|
626 | if (numComponents != NULL) |
---|
627 | *numComponents = _dataSet->GetCellData()->GetAbstractArray(fieldName)->GetNumberOfComponents(); |
---|
628 | return true; |
---|
629 | } else if (_dataSet->GetFieldData() != NULL && |
---|
630 | _dataSet->GetFieldData()->GetAbstractArray(fieldName) != NULL) { |
---|
631 | if (type != NULL) |
---|
632 | *type = FIELD_DATA; |
---|
633 | if (numComponents != NULL) |
---|
634 | *numComponents = _dataSet->GetFieldData()->GetAbstractArray(fieldName)->GetNumberOfComponents(); |
---|
635 | return true; |
---|
636 | } |
---|
637 | return false; |
---|
638 | } |
---|
639 | |
---|
640 | bool DataSet::getFieldInfo(const char *fieldName, |
---|
641 | DataAttributeType type, |
---|
642 | int *numComponents) const |
---|
643 | { |
---|
644 | switch (type) { |
---|
645 | case POINT_DATA: |
---|
646 | if (_dataSet->GetPointData() != NULL && |
---|
647 | _dataSet->GetPointData()->GetAbstractArray(fieldName) != NULL) { |
---|
648 | if (numComponents != NULL) |
---|
649 | *numComponents = _dataSet->GetPointData()->GetAbstractArray(fieldName)->GetNumberOfComponents(); |
---|
650 | return true; |
---|
651 | } else |
---|
652 | return false; |
---|
653 | break; |
---|
654 | case CELL_DATA: |
---|
655 | if (_dataSet->GetCellData() != NULL && |
---|
656 | _dataSet->GetCellData()->GetAbstractArray(fieldName) != NULL) { |
---|
657 | if (numComponents != NULL) |
---|
658 | *numComponents = _dataSet->GetCellData()->GetAbstractArray(fieldName)->GetNumberOfComponents(); |
---|
659 | return true; |
---|
660 | } else |
---|
661 | return false; |
---|
662 | break; |
---|
663 | case FIELD_DATA: |
---|
664 | if (_dataSet->GetFieldData() != NULL && |
---|
665 | _dataSet->GetFieldData()->GetAbstractArray(fieldName) != NULL) { |
---|
666 | if (numComponents != NULL) |
---|
667 | *numComponents = _dataSet->GetFieldData()->GetAbstractArray(fieldName)->GetNumberOfComponents(); |
---|
668 | return true; |
---|
669 | } else |
---|
670 | return false; |
---|
671 | break; |
---|
672 | default: |
---|
673 | ; |
---|
674 | } |
---|
675 | return false; |
---|
676 | } |
---|
677 | |
---|
678 | /** |
---|
679 | * \brief Get the list of field names in the DataSet |
---|
680 | * |
---|
681 | * \param[in,out] names The field names will be appended to this list |
---|
682 | * \param[in] type The DataAttributeType: e.g. POINT_DATA, CELL_DATA |
---|
683 | * \param[in] numComponents Filter list by number of components, -1 means to |
---|
684 | * return all fields regardless of dimension |
---|
685 | */ |
---|
686 | void DataSet::getFieldNames(std::vector<std::string>& names, |
---|
687 | DataAttributeType type, int numComponents) const |
---|
688 | { |
---|
689 | if (_dataSet == NULL) |
---|
690 | return; |
---|
691 | switch (type) { |
---|
692 | case POINT_DATA: |
---|
693 | if (_dataSet->GetPointData() != NULL) { |
---|
694 | for (int i = 0; i < _dataSet->GetPointData()->GetNumberOfArrays(); i++) { |
---|
695 | if (numComponents == -1 || |
---|
696 | (_dataSet->GetPointData()->GetAbstractArray(i) != NULL && |
---|
697 | _dataSet->GetPointData()->GetAbstractArray(i)->GetNumberOfComponents() == numComponents)) { |
---|
698 | names.push_back(_dataSet->GetPointData()->GetArrayName(i)); |
---|
699 | } |
---|
700 | } |
---|
701 | } |
---|
702 | break; |
---|
703 | case CELL_DATA: |
---|
704 | if (_dataSet->GetCellData() != NULL) { |
---|
705 | for (int i = 0; i < _dataSet->GetCellData()->GetNumberOfArrays(); i++) { |
---|
706 | if (numComponents == -1 || |
---|
707 | (_dataSet->GetCellData()->GetAbstractArray(i) != NULL && |
---|
708 | _dataSet->GetCellData()->GetAbstractArray(i)->GetNumberOfComponents() == numComponents)) { |
---|
709 | names.push_back(_dataSet->GetCellData()->GetArrayName(i)); |
---|
710 | } |
---|
711 | } |
---|
712 | } |
---|
713 | break; |
---|
714 | case FIELD_DATA: |
---|
715 | if (_dataSet->GetFieldData() != NULL) { |
---|
716 | for (int i = 0; i < _dataSet->GetFieldData()->GetNumberOfArrays(); i++) { |
---|
717 | if (numComponents == -1 || |
---|
718 | (_dataSet->GetFieldData()->GetAbstractArray(i) != NULL && |
---|
719 | _dataSet->GetFieldData()->GetAbstractArray(i)->GetNumberOfComponents() == numComponents)) { |
---|
720 | names.push_back(_dataSet->GetFieldData()->GetArrayName(i)); |
---|
721 | } |
---|
722 | } |
---|
723 | } |
---|
724 | break; |
---|
725 | default: |
---|
726 | ERROR("Unknown DataAttributeType %d", type); |
---|
727 | } |
---|
728 | } |
---|
729 | |
---|
730 | /** |
---|
731 | * \brief Get the range of scalar values in the DataSet |
---|
732 | */ |
---|
733 | void DataSet::getScalarRange(double minmax[2]) const |
---|
734 | { |
---|
735 | if (_dataSet == NULL) |
---|
736 | return; |
---|
737 | if (_dataSet->GetPointData() != NULL && |
---|
738 | _dataSet->GetPointData()->GetScalars() != NULL) { |
---|
739 | _dataSet->GetPointData()->GetScalars()->GetRange(minmax, -1); |
---|
740 | } else if (_dataSet->GetCellData() != NULL && |
---|
741 | _dataSet->GetCellData()->GetScalars() != NULL) { |
---|
742 | _dataSet->GetCellData()->GetScalars()->GetRange(minmax, -1); |
---|
743 | } |
---|
744 | } |
---|
745 | |
---|
746 | /** |
---|
747 | * \brief Get the range of a vector component in the DataSet |
---|
748 | * |
---|
749 | * \param[out] minmax The data range |
---|
750 | * \param[in] component The field component, -1 means magnitude |
---|
751 | */ |
---|
752 | void DataSet::getVectorRange(double minmax[2], int component) const |
---|
753 | { |
---|
754 | if (_dataSet == NULL) |
---|
755 | return; |
---|
756 | if (_dataSet->GetPointData() != NULL && |
---|
757 | _dataSet->GetPointData()->GetVectors() != NULL) { |
---|
758 | _dataSet->GetPointData()->GetVectors()->GetRange(minmax, component); |
---|
759 | } else if (_dataSet->GetCellData() != NULL && |
---|
760 | _dataSet->GetCellData()->GetVectors() != NULL) { |
---|
761 | _dataSet->GetCellData()->GetVectors()->GetRange(minmax, component); |
---|
762 | } |
---|
763 | } |
---|
764 | |
---|
765 | /** |
---|
766 | * \brief Get the range of values for the named field in the DataSet |
---|
767 | * |
---|
768 | * \param[out] minmax The data range |
---|
769 | * \param[in] fieldName The array name |
---|
770 | * \param[in] type The DataAttributeType |
---|
771 | * \param[in] component The field component, -1 means magnitude |
---|
772 | * \return boolean indicating if field was found |
---|
773 | */ |
---|
774 | bool DataSet::getDataRange(double minmax[2], const char *fieldName, |
---|
775 | DataAttributeType type, int component) const |
---|
776 | { |
---|
777 | if (_dataSet == NULL) |
---|
778 | return false; |
---|
779 | switch (type) { |
---|
780 | case POINT_DATA: |
---|
781 | if (_dataSet->GetPointData() != NULL && |
---|
782 | _dataSet->GetPointData()->GetArray(fieldName) != NULL) { |
---|
783 | _dataSet->GetPointData()->GetArray(fieldName)->GetRange(minmax, component); |
---|
784 | return true; |
---|
785 | } else { |
---|
786 | return false; |
---|
787 | } |
---|
788 | break; |
---|
789 | case CELL_DATA: |
---|
790 | if (_dataSet->GetCellData() != NULL && |
---|
791 | _dataSet->GetCellData()->GetArray(fieldName) != NULL) { |
---|
792 | _dataSet->GetCellData()->GetArray(fieldName)->GetRange(minmax, component); |
---|
793 | return true; |
---|
794 | } else { |
---|
795 | return false; |
---|
796 | } |
---|
797 | break; |
---|
798 | case FIELD_DATA: |
---|
799 | if (_dataSet->GetFieldData() != NULL && |
---|
800 | _dataSet->GetFieldData()->GetArray(fieldName) != NULL) { |
---|
801 | _dataSet->GetFieldData()->GetArray(fieldName)->GetRange(minmax, component); |
---|
802 | return true; |
---|
803 | } else { |
---|
804 | return false; |
---|
805 | } |
---|
806 | break; |
---|
807 | default: |
---|
808 | ERROR("Unknown DataAttributeType %d", type); |
---|
809 | break; |
---|
810 | } |
---|
811 | return false; |
---|
812 | } |
---|
813 | |
---|
814 | /** |
---|
815 | * \brief Get the bounds the DataSet |
---|
816 | */ |
---|
817 | void DataSet::getBounds(double bounds[6]) const |
---|
818 | { |
---|
819 | _dataSet->GetBounds(bounds); |
---|
820 | } |
---|
821 | |
---|
822 | /** |
---|
823 | * \brief Get the range of cell AABB diagonal lengths in the DataSet |
---|
824 | */ |
---|
825 | void DataSet::getCellSizeRange(double minmax[2], double *average) |
---|
826 | { |
---|
827 | // Check for cached values |
---|
828 | if (_cellSizeRange[0] >= 0.0) { |
---|
829 | minmax[0] = _cellSizeRange[0]; |
---|
830 | minmax[1] = _cellSizeRange[1]; |
---|
831 | *average = _cellSizeAverage; |
---|
832 | return; |
---|
833 | } |
---|
834 | |
---|
835 | getCellSizeRange(_dataSet, minmax, average); |
---|
836 | |
---|
837 | // Save values in cache |
---|
838 | _cellSizeRange[0] = minmax[0]; |
---|
839 | _cellSizeRange[1] = minmax[1]; |
---|
840 | _cellSizeAverage = *average; |
---|
841 | } |
---|
842 | |
---|
843 | /** |
---|
844 | * \brief Get the range of cell AABB diagonal lengths in the DataSet |
---|
845 | */ |
---|
846 | void DataSet::getCellSizeRange(vtkDataSet *dataSet, double minmax[2], double *average) |
---|
847 | { |
---|
848 | if (dataSet == NULL || |
---|
849 | dataSet->GetNumberOfCells() < 1) { |
---|
850 | minmax[0] = 1; |
---|
851 | minmax[1] = 1; |
---|
852 | *average = 1; |
---|
853 | return; |
---|
854 | } |
---|
855 | |
---|
856 | minmax[0] = DBL_MAX; |
---|
857 | minmax[1] = -DBL_MAX; |
---|
858 | |
---|
859 | *average = 0; |
---|
860 | for (int i = 0; i < dataSet->GetNumberOfCells(); i++) { |
---|
861 | double length2 = dataSet->GetCell(i)->GetLength2(); |
---|
862 | if (length2 < minmax[0]) |
---|
863 | minmax[0] = length2; |
---|
864 | if (length2 > minmax[1]) |
---|
865 | minmax[1] = length2; |
---|
866 | *average += length2; |
---|
867 | } |
---|
868 | if (minmax[0] == DBL_MAX) |
---|
869 | minmax[0] = 1; |
---|
870 | if (minmax[1] == -DBL_MAX) |
---|
871 | minmax[1] = 1; |
---|
872 | |
---|
873 | minmax[0] = sqrt(minmax[0]); |
---|
874 | minmax[1] = sqrt(minmax[1]); |
---|
875 | *average = sqrt(*average/((double)dataSet->GetNumberOfCells())); |
---|
876 | } |
---|
877 | |
---|
878 | /** |
---|
879 | * \brief Get nearest data value given world coordinates x,y,z |
---|
880 | * |
---|
881 | * Note: no interpolation is performed on data |
---|
882 | * |
---|
883 | * \param[in] x World x coordinate to probe |
---|
884 | * \param[in] y World y coordinate to probe |
---|
885 | * \param[in] z World z coordinate to probe |
---|
886 | * \param[out] value On success, contains the data value |
---|
887 | * \return boolean indicating success or failure |
---|
888 | */ |
---|
889 | bool DataSet::getScalarValue(double x, double y, double z, double *value) const |
---|
890 | { |
---|
891 | if (_dataSet == NULL) |
---|
892 | return false; |
---|
893 | if (_dataSet->GetPointData() == NULL || |
---|
894 | _dataSet->GetPointData()->GetScalars() == NULL) { |
---|
895 | return false; |
---|
896 | } |
---|
897 | vtkIdType pt = _dataSet->FindPoint(x, y, z); |
---|
898 | if (pt < 0) |
---|
899 | return false; |
---|
900 | *value = _dataSet->GetPointData()->GetScalars()->GetComponent(pt, 0); |
---|
901 | return true; |
---|
902 | } |
---|
903 | |
---|
904 | /** |
---|
905 | * \brief Get nearest vector data value given world coordinates x,y,z |
---|
906 | * |
---|
907 | * Note: no interpolation is performed on data |
---|
908 | * |
---|
909 | * \param[in] x World x coordinate to probe |
---|
910 | * \param[in] y World y coordinate to probe |
---|
911 | * \param[in] z World z coordinate to probe |
---|
912 | * \param[out] vector On success, contains the data values |
---|
913 | * \return boolean indicating success or failure |
---|
914 | */ |
---|
915 | bool DataSet::getVectorValue(double x, double y, double z, double vector[3]) const |
---|
916 | { |
---|
917 | if (_dataSet == NULL) |
---|
918 | return false; |
---|
919 | if (_dataSet->GetPointData() == NULL || |
---|
920 | _dataSet->GetPointData()->GetVectors() == NULL) { |
---|
921 | return false; |
---|
922 | } |
---|
923 | vtkIdType pt = _dataSet->FindPoint(x, y, z); |
---|
924 | if (pt < 0) |
---|
925 | return false; |
---|
926 | assert(_dataSet->GetPointData()->GetVectors()->GetNumberOfComponents() == 3); |
---|
927 | _dataSet->GetPointData()->GetVectors()->GetTuple(pt, vector); |
---|
928 | return true; |
---|
929 | } |
---|
930 | |
---|
931 | void DataSet::print() const |
---|
932 | { |
---|
933 | print(_dataSet); |
---|
934 | } |
---|
935 | |
---|
936 | void DataSet::print(vtkDataSet *ds) |
---|
937 | { |
---|
938 | if (ds == NULL) |
---|
939 | return; |
---|
940 | |
---|
941 | TRACE("DataSet class: %s", ds->GetClassName()); |
---|
942 | |
---|
943 | TRACE("DataSet memory: %g MiB", ds->GetActualMemorySize()/1024.); |
---|
944 | |
---|
945 | double bounds[6]; |
---|
946 | ds->GetBounds(bounds); |
---|
947 | |
---|
948 | // Topology |
---|
949 | TRACE("DataSet bounds: %g %g %g %g %g %g", |
---|
950 | bounds[0], bounds[1], |
---|
951 | bounds[2], bounds[3], |
---|
952 | bounds[4], bounds[5]); |
---|
953 | TRACE("Points: %d Cells: %d", ds->GetNumberOfPoints(), ds->GetNumberOfCells()); |
---|
954 | |
---|
955 | double dataRange[2]; |
---|
956 | if (ds->GetPointData() != NULL) { |
---|
957 | TRACE("PointData arrays: %d", ds->GetPointData()->GetNumberOfArrays()); |
---|
958 | for (int i = 0; i < ds->GetPointData()->GetNumberOfArrays(); i++) { |
---|
959 | if (ds->GetPointData()->GetArray(i) != NULL) { |
---|
960 | ds->GetPointData()->GetArray(i)->GetRange(dataRange, -1); |
---|
961 | TRACE("PointData[%d]: '%s' comp:%d, (%g,%g)", i, |
---|
962 | ds->GetPointData()->GetArrayName(i), |
---|
963 | ds->GetPointData()->GetAbstractArray(i)->GetNumberOfComponents(), |
---|
964 | dataRange[0], dataRange[1]); |
---|
965 | } else { |
---|
966 | TRACE("PointData[%d]: '%s' comp:%d", i, |
---|
967 | ds->GetPointData()->GetArrayName(i), |
---|
968 | ds->GetPointData()->GetAbstractArray(i)->GetNumberOfComponents()); |
---|
969 | } |
---|
970 | } |
---|
971 | if (ds->GetPointData()->GetScalars() != NULL) { |
---|
972 | TRACE("Active point scalars: %s", ds->GetPointData()->GetScalars()->GetName()); |
---|
973 | } |
---|
974 | if (ds->GetPointData()->GetVectors() != NULL) { |
---|
975 | TRACE("Active point vectors: %s", ds->GetPointData()->GetVectors()->GetName()); |
---|
976 | } |
---|
977 | } |
---|
978 | if (ds->GetCellData() != NULL) { |
---|
979 | TRACE("CellData arrays: %d", ds->GetCellData()->GetNumberOfArrays()); |
---|
980 | for (int i = 0; i < ds->GetCellData()->GetNumberOfArrays(); i++) { |
---|
981 | if (ds->GetCellData()->GetArray(i) != NULL) { |
---|
982 | ds->GetCellData()->GetArray(i)->GetRange(dataRange, -1); |
---|
983 | TRACE("CellData[%d]: '%s' comp:%d, (%g,%g)", i, |
---|
984 | ds->GetCellData()->GetArrayName(i), |
---|
985 | ds->GetCellData()->GetAbstractArray(i)->GetNumberOfComponents(), |
---|
986 | dataRange[0], dataRange[1]); |
---|
987 | } else { |
---|
988 | TRACE("CellData[%d]: '%s' comp:%d", i, |
---|
989 | ds->GetCellData()->GetArrayName(i), |
---|
990 | ds->GetCellData()->GetAbstractArray(i)->GetNumberOfComponents()); |
---|
991 | } |
---|
992 | } |
---|
993 | if (ds->GetCellData()->GetScalars() != NULL) { |
---|
994 | TRACE("Active cell scalars: %s", ds->GetCellData()->GetScalars()->GetName()); |
---|
995 | } |
---|
996 | if (ds->GetCellData()->GetVectors() != NULL) { |
---|
997 | TRACE("Active cell vectors: %s", ds->GetCellData()->GetVectors()->GetName()); |
---|
998 | } |
---|
999 | } |
---|
1000 | if (ds->GetFieldData() != NULL) { |
---|
1001 | TRACE("FieldData arrays: %d", ds->GetFieldData()->GetNumberOfArrays()); |
---|
1002 | for (int i = 0; i < ds->GetFieldData()->GetNumberOfArrays(); i++) { |
---|
1003 | if (ds->GetFieldData()->GetArray(i) != NULL) { |
---|
1004 | ds->GetFieldData()->GetArray(i)->GetRange(dataRange, -1); |
---|
1005 | TRACE("FieldData[%d]: '%s' comp:%d, tuples:%d (%g,%g)", i, |
---|
1006 | ds->GetFieldData()->GetArrayName(i), |
---|
1007 | ds->GetFieldData()->GetAbstractArray(i)->GetNumberOfComponents(), |
---|
1008 | ds->GetFieldData()->GetAbstractArray(i)->GetNumberOfTuples(), |
---|
1009 | dataRange[0], dataRange[1]); |
---|
1010 | } else { |
---|
1011 | TRACE("FieldData[%d]: '%s' comp:%d, tuples:%d", i, |
---|
1012 | ds->GetFieldData()->GetArrayName(i), |
---|
1013 | ds->GetFieldData()->GetAbstractArray(i)->GetNumberOfComponents(), |
---|
1014 | ds->GetFieldData()->GetAbstractArray(i)->GetNumberOfTuples()); |
---|
1015 | } |
---|
1016 | } |
---|
1017 | } |
---|
1018 | } |
---|
1019 | |
---|