vtkDataSetAttributes.h 22.7 KB
Newer Older
1
2
3
4
5
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkDataSetAttributes.h

6
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7
8
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9

10
11
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
     PURPOSE.  See the above copyright notice for more information.
13
14

=========================================================================*/
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
 * @class   vtkDataSetAttributes
 * @brief   represent and manipulate attribute data in a dataset
 *
 * vtkDataSetAttributes is a class that is used to represent and manipulate
 * attribute data (e.g., scalars, vectors, normals, texture coordinates,
 * tensors, global ids, pedigree ids, and field data).
 *
 * This adds to vtkFieldData the ability to pick one of the arrays from the
 * field as the currently active array for each attribute type. In other
 * words, you pick one array to be called "THE" Scalars, and then filters down
 * the pipeline will treat that array specially. For example vtkContourFilter
 * will contour "THE" Scalar array unless a different array is asked for.
 *
 * Additionally vtkDataSetAttributes provides methods that filters call to
 * pass data through, copy data into, and interpolate from Fields. PassData
 * passes entire arrays from the source to the destination. Copy passes
 * through some subset of the tuples from the source to the destination.
 * Interpolate interpolates from the chosen tuple(s) in the source data, using
 * the provided weights, to produce new tuples in the destination.
 * Each attribute type has pass, copy and interpolate "copy" flags that
 * can be set in the destination to choose which attribute arrays will be
 * transferred from the source to the destination.
 *
 * Finally this class provides a mechanism to determine which attributes a
 * group of sources have in common, and to copy tuples from a source into
 * the destination, for only those attributes that are held by all.
*/
43

44
45
#ifndef vtkDataSetAttributes_h
#define vtkDataSetAttributes_h
46

47
48
#include "vtkCommonDataModelModule.h"      // For export macro
#include "vtkDataSetAttributesFieldList.h" // for vtkDataSetAttributesFieldList
49
50
#include "vtkFieldData.h"

Utkarsh Ayachit's avatar
ENH:  
Utkarsh Ayachit committed
51
52
class vtkLookupTable;

53
class VTKCOMMONDATAMODEL_EXPORT vtkDataSetAttributes : public vtkFieldData
54
55
{
public:
56
57
58
  /**
   * Construct object with copying turned on for all data.
   */
59
  static vtkDataSetAttributes *New();
60

61
  vtkTypeMacro(vtkDataSetAttributes,vtkFieldData);
62
  void PrintSelf(ostream& os, vtkIndent indent) override;
63

64
  /**
65
   * Initialize all of the object's data to nullptr
66
67
   * Also, clear the copy flags.
   */
68
  void Initialize() override;
69

70
71
72
73
  /**
   * Attributes have a chance to bring themselves up to date; right
   * now this is ignored.
   */
74
  virtual void Update() {}
75

76
  // -- shallow and deep copy -----------------------------------------------
77

78
79
80
81
82
  /**
   * Deep copy of data (i.e., create new data arrays and
   * copy from input data).
   * Ignores the copy flags but preserves them in the output.
   */
83
  void DeepCopy(vtkFieldData *pd) override;
84

85
86
87
88
  /**
   * Shallow copy of data (i.e., use reference counting).
   * Ignores the copy flags but preserves them in the output.
   */
89
  void ShallowCopy(vtkFieldData *pd) override;
90

91
  // -- attribute types -----------------------------------------------------
92

93
  // Always keep NUM_ATTRIBUTES as the last entry
94
  enum AttributeTypes
95
96
97
98
99
100
101
  {
    SCALARS=0,
    VECTORS=1,
    NORMALS=2,
    TCOORDS=3,
    TENSORS=4,
    GLOBALIDS=5,
102
    PEDIGREEIDS=6,
103
    EDGEFLAG=7,
104
105
106
    NUM_ATTRIBUTES
  };

107
  enum AttributeLimitTypes
108
  {
109
110
    MAX,
    EXACT,
111
112
113
    NOLIMIT
  };

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
  // ----------- ghost points and ghost cells -------------------------------------------
  //The following bit fields are consistent with VisIt ghost zones specification
  //For details, see http://www.visitusers.org/index.php?title=Representing_ghost_data

  enum CellGhostTypes
  {
    DUPLICATECELL           = 1,  //the cell is present on multiple processors
    HIGHCONNECTIVITYCELL    = 2,  //the cell has more neighbors than in a regular mesh
    LOWCONNECTIVITYCELL     = 4,  //the cell has less neighbors than in a regular mesh
    REFINEDCELL             = 8,  //other cells are present that refines it.
    EXTERIORCELL            = 16, //the cell is on the exterior of the data set
    HIDDENCELL              = 32  //the cell is needed to maintain connectivity, but the data values should be ignored.
  };

  enum PointGhostTypes
  {
    DUPLICATEPOINT          =1,   //the cell is present on multiple processors
    HIDDENPOINT             =2    //the point is needed to maintain connectivity, but the data values should be ignored.
  };

  //A vtkDataArray with this name must be of type vtkUnsignedCharArray.
  //Each value must be assigned according to the bit fields described in
  //PointGhostTypes or CellGhostType
  static const char* GhostArrayName()  { return "vtkGhostType";}

  //-----------------------------------------------------------------------------------

141
142
143
144
  //@{
  /**
   * Set/Get the scalar data.
   */
145
146
  int SetScalars(vtkDataArray* da);
  int SetActiveScalars(const char* name);
147
  vtkDataArray* GetScalars();
148
  //@}
149

150
151
152
153
  //@{
  /**
   * Set/Get the vector data.
   */
154
155
  int SetVectors(vtkDataArray* da);
  int SetActiveVectors(const char* name);
156
  vtkDataArray* GetVectors();
157
  //@}
158

159
160
161
162
  //@{
  /**
   * Set/get the normal data.
   */
163
164
  int SetNormals(vtkDataArray* da);
  int SetActiveNormals(const char* name);
165
  vtkDataArray* GetNormals();
166
  //@}
167

168
169
170
171
  //@{
  /**
   * Set/Get the texture coordinate data.
   */
172
173
  int SetTCoords(vtkDataArray* da);
  int SetActiveTCoords(const char* name);
174
  vtkDataArray* GetTCoords();
175
  //@}
176

177
178
179
180
  //@{
  /**
   * Set/Get the tensor data.
   */
181
182
  int SetTensors(vtkDataArray* da);
  int SetActiveTensors(const char* name);
183
  vtkDataArray* GetTensors();
184
  //@}
185

186
187
188
189
  //@{
  /**
   * Set/Get the global id data.
   */
190
191
192
  int SetGlobalIds(vtkDataArray* da);
  int SetActiveGlobalIds(const char* name);
  vtkDataArray* GetGlobalIds();
193
  //@}
194

195
196
197
198
  //@{
  /**
   * Set/Get the pedigree id data.
   */
199
200
201
  int SetPedigreeIds(vtkAbstractArray* da);
  int SetActivePedigreeIds(const char* name);
  vtkAbstractArray* GetPedigreeIds();
202
203
204
205
206
207
208
209
  //@}

  //@{
  /**
   * This will first look for an array with the correct name.
   * If one exists, it is returned. Otherwise, the name argument
   * is ignored, and the active attribute is returned.
   */
210
211
212
213
214
  vtkDataArray* GetScalars(const char* name);
  vtkDataArray* GetVectors(const char* name);
  vtkDataArray* GetNormals(const char* name);
  vtkDataArray* GetTCoords(const char* name);
  vtkDataArray* GetTensors(const char* name);
215
  vtkDataArray* GetGlobalIds(const char* name);
216
  vtkAbstractArray* GetPedigreeIds(const char* name);
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
  //@}

  /**
   * Make the array with the given name the active attribute.
   * Attribute types are:
   * vtkDataSetAttributes::SCALARS = 0
   * vtkDataSetAttributes::VECTORS = 1
   * vtkDataSetAttributes::NORMALS = 2
   * vtkDataSetAttributes::TCOORDS = 3
   * vtkDataSetAttributes::TENSORS = 4
   * vtkDataSetAttributes::GLOBALIDS = 5
   * vtkDataSetAttributes::PEDIGREEIDS = 6
   * vtkDataSetAttributes::EDGEFLAG = 7
   * Returns the index of the array if successful, -1 if the array
   * is not in the list of arrays.
   */
233
234
  int SetActiveAttribute(const char* name, int attributeType);

235
236
237
  /**
   * Make the array with the given index the active attribute.
   */
Berk Geveci's avatar
Berk Geveci committed
238
239
  int SetActiveAttribute(int index, int attributeType);

240
241
242
243
  /**
   * Get the field data array indices corresponding to scalars,
   * vectors, tensors, etc.
   */
244
245
  void GetAttributeIndices(int* indexArray);

246
247
248
249
250
251
  /**
   * Determine whether a data array of index idx is considered a data set
   * attribute (i.e., scalar, vector, tensor, etc). Return less-than zero
   * if it is, otherwise an index 0<=idx<NUM_ATTRIBUTES to indicate
   * which attribute.
   */
252
253
  int IsArrayAnAttribute(int idx);

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
  /**
   * Set an array to use as the given attribute type (i.e.,
   * vtkDataSetAttributes::SCALAR, vtkDataSetAttributes::VECTOR,
   * vtkDataSetAttributes::TENSOR, etc.). If this attribute was
   * previously set to another array, that array is removed from the
   * vtkDataSetAttributes object and the array aa is used as the
   * attribute.

   * Returns the index of aa within the vtkDataSetAttributes object
   * (i.e., the index to pass to the method GetArray(int) to obtain
   * aa) if the attribute was set to aa successfully. If aa was
   * already set as the given attributeType, returns the index of
   * aa.

   * Returns -1 in the following cases:

270
   * - aa is nullptr (used to unset an attribute; not an error indicator)
271
272
273
274
275
   * - aa is not a subclass of vtkDataArray, unless the attributeType
   * is vtkDataSetAttributes::PEDIGREEIDS (error indicator)
   * - aa has a number of components incompatible with the attribute type
   * (error indicator)
   */
276
277
  int SetAttribute(vtkAbstractArray* aa, int attributeType);

278
279
280
281
282
283
  /**
   * Return an attribute given the attribute type
   * (see vtkDataSetAttributes::AttributeTypes).
   * Some attributes (such as PEDIGREEIDS) may not be vtkDataArray subclass,
   * so in that case use GetAbstractAttribute().
   */
284
285
  vtkDataArray* GetAttribute(int attributeType);

286
287
288
289
290
291
292
  /**
   * Return an attribute given the attribute type
   * (see vtkDataSetAttributes::AttributeTypes).
   * This is the same as GetAttribute(), except that the returned array
   * is a vtkAbstractArray instead of vtkDataArray.
   * Some attributes (such as PEDIGREEIDS) may not be vtkDataArray subclass.
   */
293
294
  vtkAbstractArray* GetAbstractAttribute(int attributeType);

295
296
297
298
  //@{
  /**
   * Remove an array (with the given name) from the list of arrays.
   */
299
  using vtkFieldData::RemoveArray;
300
  void RemoveArray(int index) override;
301
  //@}
302

303

304
305
306
307
308
  //@{
  /**
   * Given an integer attribute type, this static method returns a string type
   * for the attribute (i.e. type = 0: returns "Scalars").
   */
309
  static const char* GetAttributeTypeAsString(int attributeType);
310
  static const char* GetLongAttributeTypeAsString(int attributeType);
311
  //@}
312
313
314
315
316
317
318
319
320
321
322

  // -- attribute copy properties ------------------------------------------

  enum AttributeCopyOperations
  {
    COPYTUPLE=0,
    INTERPOLATE=1,
    PASSDATA=2,
    ALLCOPY  //all of the above
  };

323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
  /**
   * Turn on/off the copying of attribute data.
   * ctype is one of the AttributeCopyOperations, and controls copy,
   * interpolate and passdata behavior.
   * For set, ctype=ALLCOPY means set all three flags to the same value.
   * For get, ctype=ALLCOPY returns true only if all three flags are true.

   * During copying, interpolation and passdata, the following rules are
   * followed for each array:
   * 1. If the copy/interpolate/pass flag for an attribute is set (on or off),
   * it is applied. This overrides rules 2 and 3.
   * 2. If the copy flag for an array is set (on or off), it is applied
   * This overrides rule 3.
   * 3. If CopyAllOn is set, copy the array.
   * If CopyAllOff is set, do not copy the array

   * For interpolation, the flag values can be as follows:
   * 0: Do not interpolate.
   * 1: Weighted interpolation.
342
   * 2: Nearest neighbor interpolation.
343
   */
344
345
  void SetCopyAttribute (int index, int value, int ctype=ALLCOPY);

346
347
348
349
  /**
   * Get the attribute copy flag for copy operation <ctype> of attribute
   * <index>.
   */
350
351
352
  int GetCopyAttribute (int index, int ctype);

  /// @copydoc vtkDataSetAttributes::SetCopyAttribute()
Sean McBride's avatar
Sean McBride committed
353
354
355
  void SetCopyScalars(vtkTypeBool i, int ctype=ALLCOPY);
  vtkTypeBool GetCopyScalars(int ctype=ALLCOPY);
  vtkBooleanMacro(CopyScalars, vtkTypeBool);
356

357
  /// @copydoc vtkDataSetAttributes::SetCopyAttribute()
Sean McBride's avatar
Sean McBride committed
358
359
360
  void SetCopyVectors(vtkTypeBool i, int ctype=ALLCOPY);
  vtkTypeBool GetCopyVectors(int ctype=ALLCOPY);
  vtkBooleanMacro(CopyVectors, vtkTypeBool);
361

362
  /// @copydoc vtkDataSetAttributes::SetCopyAttribute()
Sean McBride's avatar
Sean McBride committed
363
364
365
  void SetCopyNormals(vtkTypeBool i, int ctype=ALLCOPY);
  vtkTypeBool GetCopyNormals(int ctype=ALLCOPY);
  vtkBooleanMacro(CopyNormals, vtkTypeBool);
366

367
  /// @copydoc vtkDataSetAttributes::SetCopyAttribute()
Sean McBride's avatar
Sean McBride committed
368
369
370
  void SetCopyTCoords(vtkTypeBool i, int ctype=ALLCOPY);
  vtkTypeBool GetCopyTCoords(int ctype=ALLCOPY);
  vtkBooleanMacro(CopyTCoords, vtkTypeBool);
371

372
  /// @copydoc vtkDataSetAttributes::SetCopyAttribute()
Sean McBride's avatar
Sean McBride committed
373
374
375
  void SetCopyTensors(vtkTypeBool i, int ctype=ALLCOPY);
  vtkTypeBool GetCopyTensors(int ctype=ALLCOPY);
  vtkBooleanMacro(CopyTensors, vtkTypeBool);
376

377
  /// @copydoc vtkDataSetAttributes::SetCopyAttribute()
Sean McBride's avatar
Sean McBride committed
378
379
380
  void SetCopyGlobalIds(vtkTypeBool i, int ctype=ALLCOPY);
  vtkTypeBool GetCopyGlobalIds(int ctype=ALLCOPY);
  vtkBooleanMacro(CopyGlobalIds, vtkTypeBool);
381

382
  /// @copydoc vtkDataSetAttributes::SetCopyAttribute()
Sean McBride's avatar
Sean McBride committed
383
384
385
  void SetCopyPedigreeIds(vtkTypeBool i, int ctype=ALLCOPY);
  vtkTypeBool GetCopyPedigreeIds(int ctype=ALLCOPY);
  vtkBooleanMacro(CopyPedigreeIds, vtkTypeBool);
386

387
  /// @copydoc vtkDataSetAttributes::SetCopyAttribute()
388
  void CopyAllOn(int ctype=ALLCOPY) override;
389

390
  /// @copydoc vtkDataSetAttributes::SetCopyAttribute()
391
  void CopyAllOff(int ctype=ALLCOPY) override;
392
393
394

  // -- passthrough operations ----------------------------------------------

395
396
397
398
399
400
401
402
403
  /**
   * Pass entire arrays of input data through to output. Obey the "copy"
   * flags. When passing a field,  the following copying rules are
   * followed: 1) Check if a field is an attribute, if yes and if there
   * is a PASSDATA copy flag for that attribute (on or off), obey the flag
   * for that attribute, ignore (2) and (3), 2) if there is a copy field for
   * that field (on or off), obey the flag, ignore (3) 3) obey
   * CopyAllOn/Off
   */
404
  void PassData(vtkFieldData* fd) override;
405
406
407

  // -- copytuple operations ------------------------------------------------

408
409
410
411
412
413
414
415
416
417
418
419
  //@{
  /**
   * Allocates point data for point-by-point (or cell-by-cell) copy operation.
   * If sze=0, then use the input DataSetAttributes to create (i.e., find
   * initial size of) new objects; otherwise use the sze variable.
   * Note that pd HAS to be the vtkDataSetAttributes object which
   * will later be used with CopyData. If this is not the case,
   * consider using the alternative forms of CopyAllocate and CopyData.
   * ext is no longer used.
   * If shallowCopyArrays is true, input arrays are copied to the output
   * instead of new ones being allocated.
   */
420
  void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
421
                    vtkIdType ext=1000)
422
  {
423
      this->CopyAllocate(pd, sze, ext, 0);
424
  }
425
426
  void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze,
                    vtkIdType ext, int shallowCopyArrays);
427
  //@}
428

429
430
431
432
433
434
435
436
437
438
  /**
  * Create a mapping between the input attributes and this object
  * so that methods like CopyData() and CopyStructuredData()
  * can be called. This method assumes that this object has the
  * same arrays as the input and that they are ordered the same
  * way (same array indices).
  */
  void SetupForCopy(vtkDataSetAttributes* pd);


439
440
  /**
   * This method is used to copy data arrays in images.
441
442
443
444
445
   * You should call CopyAllocate or SetupForCopy before
   * calling this method. If setSize is true, this method
   * will set the size of the output arrays according to
   * the output extent. This is required when CopyAllocate()
   * was used to setup output arrays.
446
   */
447
  void CopyStructuredData(vtkDataSetAttributes *inDsa,
448
449
450
                          const int *inExt,
                          const int *outExt,
                          bool setSize = true);
451

452
453
454
455
456
457
  //@{
  /**
   * Copy the attribute data from one id to another. Make sure CopyAllocate()
   * has been invoked before using this method. When copying a field,
   * the following copying rules are
   * followed: 1) Check if a field is an attribute, if yes and if there
luz.paz's avatar
luz.paz committed
458
   * is a COPYTUPLE copy flag for that attribute (on or off), obey the flag
459
460
461
462
   * for that attribute, ignore (2) and (3), 2) if there is a copy field for
   * that field (on or off), obey the flag, ignore (3) 3) obey
   * CopyAllOn/Off
   */
463
  void CopyData(vtkDataSetAttributes *fromPd, vtkIdType fromId, vtkIdType toId);
464
465
  void CopyData(vtkDataSetAttributes *fromPd,
                vtkIdList *fromIds, vtkIdList *toIds);
466
  //@}
467

468
469
470
471
472
  /**
   * Copy n consecutive attributes starting at srcStart from fromPd to this
   * container, starting at the dstStart location.
   * Note that memory allocation is performed as necessary to hold the data.
   */
473
474
475
  void CopyData(vtkDataSetAttributes *fromPd, vtkIdType dstStart, vtkIdType n,
                vtkIdType srcStart);

476
477
478
479
480
481
482
  //@{
  /**
   * Copy a tuple (or set of tuples) of data from one data array to another.
   * This method assumes that the fromData and toData objects are of the
   * same type, and have the same number of components. This is true if you
   * invoke CopyAllocate() or InterpolateAllocate().
   */
483
  void CopyTuple(vtkAbstractArray *fromData, vtkAbstractArray *toData,
484
                 vtkIdType fromId, vtkIdType toId);
485
486
  void CopyTuples(vtkAbstractArray *fromData, vtkAbstractArray *toData,
                  vtkIdList *fromIds, vtkIdList *toIds);
487
488
  void CopyTuples(vtkAbstractArray *fromData, vtkAbstractArray *toData,
                  vtkIdType dstStart, vtkIdType n, vtkIdType srcStart);
489
  //@}
490

491

492
  // -- interpolate operations ----------------------------------------------
493

494
495
496
497
498
499
500
501
502
  //@{
  /**
   * Initialize point interpolation method.
   * Note that pd HAS to be the vtkDataSetAttributes object which
   * will later be used with InterpolatePoint or InterpolateEdge.
   * ext is no longer used.
   * If shallowCopyArrays is true, input arrays are copied to the output
   * instead of new ones being allocated.
   */
503
  void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
504
                           vtkIdType ext=1000)
505
  {
506
      this->InterpolateAllocate(pd, sze, ext, 0);
507
  }
508
509
  void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze,
                           vtkIdType ext, int shallowCopyArrays);
510
511
512
513
514
515
516
517
518
  //@}

  /**
   * Interpolate data set attributes from other data set attributes
   * given cell or point ids and associated interpolation weights.
   * If the INTERPOLATION copy flag is set to 0 for an array, interpolation
   * is prevented. If the flag is set to 1, weighted interpolation occurs.
   * If the flag is set to 2, nearest neighbor interpolation is used.
   */
519
  void InterpolatePoint(vtkDataSetAttributes *fromPd, vtkIdType toId,
520
                        vtkIdList *ids, double *weights);
521

522
523
524
525
526
527
528
529
530
  /**
   * Interpolate data from the two points p1,p2 (forming an edge) and an
   * interpolation factor, t, along the edge. The weight ranges from (0,1),
   * with t=0 located at p1. Make sure that the method InterpolateAllocate()
   * has been invoked before using this method.
   * If the INTERPOLATION copy flag is set to 0 for an array, interpolation
   * is prevented. If the flag is set to 1, weighted interpolation occurs.
   * If the flag is set to 2, nearest neighbor interpolation is used.
   */
531
532
  void InterpolateEdge(vtkDataSetAttributes *fromPd, vtkIdType toId,
                       vtkIdType p1, vtkIdType p2, double t);
Berk Geveci's avatar
Berk Geveci committed
533

534
535
536
537
538
539
540
541
542
543
544
545
  /**
   * Interpolate data from the same id (point or cell) at different points
   * in time (parameter t). Two input data set attributes objects are input.
   * The parameter t lies between (0<=t<=1). IMPORTANT: it is assumed that
   * the number of attributes and number of components is the same for both
   * from1 and from2, and the type of data for from1 and from2 are the same.
   * Make sure that the method InterpolateAllocate() has been invoked before
   * using this method.
   * If the INTERPOLATION copy flag is set to 0 for an array, interpolation
   * is prevented. If the flag is set to 1, weighted interpolation occurs.
   * If the flag is set to 2, nearest neighbor interpolation is used.
   */
546
  void InterpolateTime(vtkDataSetAttributes *from1,
547
548
                       vtkDataSetAttributes *from2,
                       vtkIdType id, double t);
549

550
  using FieldList = vtkDataSetAttributesFieldList;
551

552
553
  // field list copy operations ------------------------------------------

554
555
556
557
  /**
   * A special form of CopyAllocate() to be used with FieldLists. Use it
   * when you are copying data from a set of vtkDataSetAttributes.
   */
558
  void CopyAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0,
Amy Squillacote's avatar
Amy Squillacote committed
559
                    vtkIdType ext=1000);
560

561
  /**
562
   * Special forms of CopyData() to be used with FieldLists. Use it when
563
564
565
566
   * you are copying data from a set of vtkDataSetAttributes. Make sure
   * that you have called the special form of CopyAllocate that accepts
   * FieldLists.
   */
567
  void CopyData(vtkDataSetAttributes::FieldList& list,
568
                vtkDataSetAttributes* dsa, int idx, vtkIdType fromId,
Amy Squillacote's avatar
Amy Squillacote committed
569
                vtkIdType toId);
570
571
572
  void CopyData(vtkDataSetAttributes::FieldList& list,
                vtkDataSetAttributes* dsa, int idx, vtkIdType dstStart,
                vtkIdType n, vtkIdType srcStart);
573

574
575
576
577
578
579
  /**
   * A special form of InterpolateAllocate() to be used with FieldLists. Use it
   * when you are interpolating data from a set of vtkDataSetAttributes.
   * \c Warning: This does not copy the Information object associated with
   * each data array. This behavior may change in the future.
   */
580
  void InterpolateAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0,
581
582
                    vtkIdType ext=1000);

583
584
585
586
587
588
  /**
   * Interpolate data set attributes from other data set attributes
   * given cell or point ids and associated interpolation weights.
   * Make sure that special form of InterpolateAllocate() that accepts
   * FieldList has been used.
   */
589
590
591
  void InterpolatePoint(
    vtkDataSetAttributes::FieldList& list,
    vtkDataSetAttributes *fromPd,
592
    int idx, vtkIdType toId,
593
594
    vtkIdList *ids, double *weights);

595
protected:
596
  vtkDataSetAttributes();
597
  ~vtkDataSetAttributes() override;
598

599
  void InternalCopyAllocate(vtkDataSetAttributes* pd,
600
601
                            int ctype,
                            vtkIdType sze=0,
602
                            vtkIdType ext=1000,
603
604
                            int shallowCopyArrays=0,
                            bool createNewArrays=true);
605

606
  /**
607
   * Initialize all of the object's data to nullptr
608
   */
609
  void InitializeFields() override;
610

611
  int AttributeIndices[NUM_ATTRIBUTES]; //index to attribute array in field data
612
  int CopyAttributeFlags[ALLCOPY][NUM_ATTRIBUTES]; //copy flag for attribute data
613

614
  vtkFieldData::BasicIterator RequiredArrays;
615
616
617

  int* TargetIndices;

618
619
  static const int NumberOfAttributeComponents[NUM_ATTRIBUTES];
  static const int AttributeLimits[NUM_ATTRIBUTES];
620
  static const char AttributeNames[NUM_ATTRIBUTES][12];
621
  static const char LongAttributeNames[NUM_ATTRIBUTES][35];
622

623
private:
624
  static int CheckNumberOfComponents(vtkAbstractArray* da, int attributeType);
625

626
  vtkFieldData::BasicIterator  ComputeRequiredArrays(vtkDataSetAttributes* pd, int ctype);
627

628
private:
629
630
  vtkDataSetAttributes(const vtkDataSetAttributes&) = delete;
  void operator=(const vtkDataSetAttributes&) = delete;
631

632
  friend class vtkDataSetAttributesFieldList;
633
634
635
};

#endif