VTK  9.6.1
vtkDataSetAttributes.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
48
49#ifndef vtkDataSetAttributes_h
50#define vtkDataSetAttributes_h
51
52#include "vtkCommonDataModelModule.h" // For export macro
53#include "vtkDataSetAttributesFieldList.h" // for vtkDataSetAttributesFieldList
54#include "vtkFieldData.h"
55#include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
56
57VTK_ABI_NAMESPACE_BEGIN
58class vtkLookupTable;
59
60class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALMANUAL vtkDataSetAttributes : public vtkFieldData
61{
62public:
68
70 void PrintSelf(ostream& os, vtkIndent indent) override;
71
76 void Initialize() override;
77
82 virtual void Update() {}
83
84 // -- shallow and deep copy -----------------------------------------------
85
91 void DeepCopy(vtkFieldData* pd) override;
92
97 void ShallowCopy(vtkFieldData* pd) override;
98
99 // -- attribute types -----------------------------------------------------
100
101 // Always keep NUM_ATTRIBUTES as the last entry
118
125
126 // ----------- ghost points and ghost cells -------------------------------------------
127 // The following bit fields are consistent with VisIt ghost zones specification
128 // For details, see http://www.visitusers.org/index.php?title=Representing_ghost_data
129
131 {
132 DUPLICATECELL = 1, // The cell is present on multiple partitions/ranks.
133 HIGHCONNECTIVITYCELL = 2, // The cell has more neighbors than in a regular mesh.
134 LOWCONNECTIVITYCELL = 4, // The cell has less neighbors than in a regular mesh.
135 REFINEDCELL = 8, // Other cells are present that refines it.
136 EXTERIORCELL = 16, // The cell is on the exterior of the data set.
137 HIDDENCELL = 32 // The cell is only present for connectivity; ignore data values.
138 };
139
141 {
142 DUPLICATEPOINT = 1, // The point is present in multiple partitions/ranks.
143 HIDDENPOINT = 2 // The point is only present for connectivity; ignore data values.
144 };
145
146 //-----------------------------------------------------------------------------------
147
149
153 int SetActiveScalars(const char* name);
156
158
162 int SetActiveVectors(const char* name);
165
167
171 int SetActiveNormals(const char* name);
174
176
180 int SetActiveTangents(const char* name);
183
185
189 int SetActiveTCoords(const char* name);
192
194
198 int SetActiveTensors(const char* name);
201
203
207 int SetActiveGlobalIds(const char* name);
210
212
216 int SetActivePedigreeIds(const char* name);
219
221
225 int SetActiveRationalWeights(const char* name);
228
230
234 int SetActiveHigherOrderDegrees(const char* name);
237
239
243 int SetActiveProcessIds(const char* name);
246
248
254 vtkDataArray* GetScalars(const char* name);
255 vtkDataArray* GetVectors(const char* name);
256 vtkDataArray* GetNormals(const char* name);
257 vtkDataArray* GetTangents(const char* name);
258 vtkDataArray* GetTCoords(const char* name);
259 vtkDataArray* GetTensors(const char* name);
260 vtkDataArray* GetGlobalIds(const char* name);
264 vtkDataArray* GetProcessIds(const char* name);
266
285 int SetActiveAttribute(const char* name, int attributeType);
286
292 int SetActiveAttribute(int index, int attributeType);
293
299 void GetAttributeIndices(int* indexArray);
300
307 int IsArrayAnAttribute(int idx);
308
331 int SetAttribute(vtkAbstractArray* aa, int attributeType);
332
339 vtkDataArray* GetAttribute(int attributeType);
340
349
351
356 void RemoveArray(int index) override;
358
360
364 static const char* GetAttributeTypeAsString(int attributeType);
365 static const char* GetLongAttributeTypeAsString(int attributeType);
367
368 // -- attribute copy properties ------------------------------------------
369
370 // NOLINTNEXTLINE(readability-enum-initial-value)
372 {
376 ALLCOPY // all of the above
377 };
378
400 void SetCopyAttribute(int index, int value, int ctype = ALLCOPY);
401
406 int GetCopyAttribute(int index, int ctype);
407
409 void SetCopyScalars(vtkTypeBool i, int ctype = ALLCOPY);
411 vtkBooleanMacro(CopyScalars, vtkTypeBool);
412
414 void SetCopyVectors(vtkTypeBool i, int ctype = ALLCOPY);
416 vtkBooleanMacro(CopyVectors, vtkTypeBool);
417
419 void SetCopyNormals(vtkTypeBool i, int ctype = ALLCOPY);
421 vtkBooleanMacro(CopyNormals, vtkTypeBool);
422
424 void SetCopyTangents(vtkTypeBool i, int ctype = ALLCOPY);
426 vtkBooleanMacro(CopyTangents, vtkTypeBool);
427
429 void SetCopyTCoords(vtkTypeBool i, int ctype = ALLCOPY);
431 vtkBooleanMacro(CopyTCoords, vtkTypeBool);
432
434 void SetCopyTensors(vtkTypeBool i, int ctype = ALLCOPY);
436 vtkBooleanMacro(CopyTensors, vtkTypeBool);
437
441 vtkBooleanMacro(CopyGlobalIds, vtkTypeBool);
442
446 vtkBooleanMacro(CopyPedigreeIds, vtkTypeBool);
447
451 vtkBooleanMacro(CopyRationalWeights, vtkTypeBool);
452
456 vtkBooleanMacro(CopyHigherOrderDegrees, vtkTypeBool);
457
461 vtkBooleanMacro(CopyProcessIds, vtkTypeBool);
462
464 void CopyAllOn(int ctype = ALLCOPY) override;
465
467 void CopyAllOff(int ctype = ALLCOPY) override;
468
469 // -- passthrough operations ----------------------------------------------
470
480 void PassData(vtkFieldData* fd) override;
481
482 // -- copytuple operations ------------------------------------------------
483
485
497 {
498 this->CopyAllocate(pd, sze, ext, 0);
499 }
500 void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze, vtkIdType ext, int shallowCopyArrays);
502
511
521 vtkDataSetAttributes* inDsa, const int* inExt, const int* outExt, bool setSize = true);
522
524
538 void CopyData(vtkDataSetAttributes* fromPd, vtkIdList* fromIds, vtkIdList* toIds);
539 void CopyData(vtkDataSetAttributes* fromPd, vtkIdList* fromIds, vtkIdType destStartId = 0);
541
547 void CopyData(vtkDataSetAttributes* fromPd, vtkIdType dstStart, vtkIdType n, vtkIdType srcStart);
548
550
557 vtkAbstractArray* fromData, vtkAbstractArray* toData, vtkIdType fromId, vtkIdType toId);
559 vtkAbstractArray* fromData, vtkAbstractArray* toData, vtkIdList* fromIds, vtkIdList* toIds);
560 void CopyTuples(vtkAbstractArray* fromData, vtkAbstractArray* toData, vtkIdType dstStart,
561 vtkIdType n, vtkIdType srcStart);
563
564 // -- interpolate operations ----------------------------------------------
565
567
576 {
577 this->InterpolateAllocate(pd, sze, ext, 0);
578 }
580 vtkDataSetAttributes* pd, vtkIdType sze, vtkIdType ext, int shallowCopyArrays);
582
591 vtkDataSetAttributes* fromPd, vtkIdType toId, vtkIdList* ids, double* weights);
592
603 vtkDataSetAttributes* fromPd, vtkIdType toId, vtkIdType p1, vtkIdType p2, double t);
604
618 vtkDataSetAttributes* from1, vtkDataSetAttributes* from2, vtkIdType id, double t);
619
621
622 // field list copy operations ------------------------------------------
623
629
637 vtkIdType fromId, vtkIdType toId);
639 vtkIdType dstStart, vtkIdType n, vtkIdType srcStart);
640
648 vtkDataSetAttributes::FieldList& list, vtkIdType sze = 0, vtkIdType ext = 1000);
649
657 int idx, vtkIdType toId, vtkIdList* ids, double* weights);
658
659protected:
662
664 vtkIdType ext = 1000, int shallowCopyArrays = 0, bool createNewArrays = true);
665
669 void InitializeFields() override;
670
671 int AttributeIndices[NUM_ATTRIBUTES]; // index to attribute array in field data
672 int CopyAttributeFlags[ALLCOPY][NUM_ATTRIBUTES]; // copy flag for attribute data
673
674 friend struct ArrayList; // Friend to base class in vtkArrayListTemplate
677
680 static const char AttributeNames[NUM_ATTRIBUTES][19];
681 static const char LongAttributeNames[NUM_ATTRIBUTES][42];
682
683private:
684 static int CheckNumberOfComponents(vtkAbstractArray* da, int attributeType);
685
686 vtkFieldData::BasicIterator ComputeRequiredArrays(vtkDataSetAttributes* pd, int ctype);
687
689 void operator=(const vtkDataSetAttributes&) = delete;
690
692};
693
694VTK_ABI_NAMESPACE_END
695#endif
Abstract superclass for all arrays.
static const char * GetLongAttributeTypeAsString(int attributeType)
Given an integer attribute type, this static method returns a string type for the attribute (i....
int AttributeIndices[NUM_ATTRIBUTES]
vtkTypeBool GetCopyPedigreeIds(int ctype=ALLCOPY)
void PassData(vtkFieldData *fd) override
Pass entire arrays of input data through to output.
virtual void Update()
Attributes have a chance to bring themselves up to date; right now this is ignored.
vtkDataArray * GetTangents(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
int SetActiveTangents(const char *name)
Set/get the tangent data.
int SetGlobalIds(vtkDataArray *da)
Set/Get the global id data.
void InterpolateEdge(vtkDataSetAttributes *fromPd, vtkIdType toId, vtkIdType p1, vtkIdType p2, double t)
Interpolate data from the two points p1,p2 (forming an edge) and an interpolation factor,...
void CopyAllocate(vtkDataSetAttributes *pd, vtkIdType sze, vtkIdType ext, int shallowCopyArrays)
Allocates point data for point-by-point (or cell-by-cell) copy operation.
void Initialize() override
Initialize all of the object's data to nullptr Also, clear the copy flags.
int GetCopyAttribute(int index, int ctype)
Get the attribute copy flag for copy operation ctype of attribute index.
vtkFieldData::BasicIterator RequiredArrays
vtkDataArray * GetHigherOrderDegrees(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
vtkDataArray * GetScalars(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
vtkTypeBool GetCopyScalars(int ctype=ALLCOPY)
vtkDataArray * GetTCoords()
Set/Get the texture coordinate data.
static vtkDataSetAttributes * ExtendedNew()
int SetActiveAttribute(int index, int attributeType)
Make the array with the given index the active attribute.
void SetCopyAttribute(int index, int value, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
int SetActiveProcessIds(const char *name)
Set/Get the process id data.
~vtkDataSetAttributes() override
int SetHigherOrderDegrees(vtkDataArray *da)
Set/Get the rational degrees data.
int SetActiveNormals(const char *name)
Set/get the normal data.
vtkDataArray * GetTangents()
Set/get the tangent data.
static const int NumberOfAttributeComponents[NUM_ATTRIBUTES]
vtkAbstractArray * GetPedigreeIds(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
vtkDataArray * GetRationalWeights()
Set/Get the rational weights data.
void SetCopyNormals(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
void InterpolateAllocate(vtkDataSetAttributes *pd, vtkIdType sze=0, vtkIdType ext=1000)
Initialize point interpolation method.
void CopyData(vtkDataSetAttributes *fromPd, vtkIdList *fromIds, vtkIdType destStartId=0)
Copy the attribute data from one id to another.
vtkDataArray * GetProcessIds()
Set/Get the process id data.
int SetActiveHigherOrderDegrees(const char *name)
Set/Get the rational degrees data.
vtkDataArray * GetNormals()
Set/get the normal data.
static const char LongAttributeNames[NUM_ATTRIBUTES][42]
int SetScalars(vtkDataArray *da)
Set/Get the scalar data.
vtkDataArray * GetNormals(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
void SetCopyTCoords(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
void InterpolatePoint(vtkDataSetAttributes::FieldList &list, vtkDataSetAttributes *fromPd, int idx, vtkIdType toId, vtkIdList *ids, double *weights)
Interpolate data set attributes from other data set attributes given cell or point ids and associated...
vtkDataArray * GetRationalWeights(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
int SetActiveTCoords(const char *name)
Set/Get the texture coordinate data.
void SetCopyTangents(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
vtkTypeBool GetCopyVectors(int ctype=ALLCOPY)
vtkTypeBool GetCopyNormals(int ctype=ALLCOPY)
void CopyTuples(vtkAbstractArray *fromData, vtkAbstractArray *toData, vtkIdList *fromIds, vtkIdList *toIds)
Copy a tuple (or set of tuples) of data from one data array to another.
void InterpolatePoint(vtkDataSetAttributes *fromPd, vtkIdType toId, vtkIdList *ids, double *weights)
Interpolate data set attributes from other data set attributes given cell or point ids and associated...
void InterpolateAllocate(vtkDataSetAttributes::FieldList &list, vtkIdType sze=0, vtkIdType ext=1000)
A special form of InterpolateAllocate() to be used with FieldLists.
void SetCopyPedigreeIds(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
void InitializeFields() override
Initialize all of the object's data to nullptr.
vtkDataArray * GetTensors()
Set/Get the tensor data.
vtkDataSetAttributesFieldList FieldList
int SetActiveGlobalIds(const char *name)
Set/Get the global id data.
void SetupForCopy(vtkDataSetAttributes *pd)
Create a mapping between the input attributes and this object so that methods like CopyData() and Cop...
int SetActiveScalars(const char *name)
Set/Get the scalar data.
void CopyData(vtkDataSetAttributes *fromPd, vtkIdType dstStart, vtkIdType n, vtkIdType srcStart)
Copy n consecutive attributes starting at srcStart from fromPd to this container, starting at the dst...
int SetNormals(vtkDataArray *da)
Set/get the normal data.
friend class vtkDataSetAttributesFieldList
void InterpolateTime(vtkDataSetAttributes *from1, vtkDataSetAttributes *from2, vtkIdType id, double t)
Interpolate data from the same id (point or cell) at different points in time (parameter t).
void CopyData(vtkDataSetAttributes::FieldList &list, vtkDataSetAttributes *dsa, int idx, vtkIdType fromId, vtkIdType toId)
Special forms of CopyData() to be used with FieldLists.
void CopyAllOn(int ctype=ALLCOPY) override
Turn on/off the copying of attribute data.
int CopyAttributeFlags[ALLCOPY][NUM_ATTRIBUTES]
void SetCopyScalars(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
void CopyTuple(vtkAbstractArray *fromData, vtkAbstractArray *toData, vtkIdType fromId, vtkIdType toId)
Copy a tuple (or set of tuples) of data from one data array to another.
void InternalCopyAllocate(vtkDataSetAttributes *pd, int ctype, vtkIdType sze=0, vtkIdType ext=1000, int shallowCopyArrays=0, bool createNewArrays=true)
int IsArrayAnAttribute(int idx)
Determine whether a data array of index idx is considered a data set attribute (i....
vtkTypeBool GetCopyTangents(int ctype=ALLCOPY)
vtkDataArray * GetTCoords(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
void CopyData(vtkDataSetAttributes *fromPd, vtkIdType fromId, vtkIdType toId)
Copy the attribute data from one id to another.
int SetActivePedigreeIds(const char *name)
Set/Get the pedigree id data.
vtkAbstractArray * GetPedigreeIds()
Set/Get the pedigree id data.
vtkDataArray * GetVectors()
Set/Get the vector data.
int SetProcessIds(vtkDataArray *da)
Set/Get the process id data.
int SetActiveRationalWeights(const char *name)
Set/Get the rational weights data.
vtkAbstractArray * GetAbstractAttribute(int attributeType)
Return an attribute given the attribute type (see vtkDataSetAttributes::AttributeTypes).
void RemoveArray(int index) override
Remove an array (with the given index) from the list of arrays.
vtkTypeBool GetCopyRationalWeights(int ctype=ALLCOPY)
vtkTypeBool GetCopyHigherOrderDegrees(int ctype=ALLCOPY)
vtkDataArray * GetAttribute(int attributeType)
Return an attribute given the attribute type (see vtkDataSetAttributes::AttributeTypes).
void CopyTuples(vtkAbstractArray *fromData, vtkAbstractArray *toData, vtkIdType dstStart, vtkIdType n, vtkIdType srcStart)
Copy a tuple (or set of tuples) of data from one data array to another.
void CopyData(vtkDataSetAttributes::FieldList &list, vtkDataSetAttributes *dsa, int idx, vtkIdType dstStart, vtkIdType n, vtkIdType srcStart)
vtkTypeBool GetCopyGlobalIds(int ctype=ALLCOPY)
vtkTypeBool GetCopyTCoords(int ctype=ALLCOPY)
static vtkDataSetAttributes * New()
Construct object with copying turned on for all data.
void CopyStructuredData(vtkDataSetAttributes *inDsa, const int *inExt, const int *outExt, bool setSize=true)
This method is used to copy data arrays in images.
void CopyAllocate(vtkDataSetAttributes::FieldList &list, vtkIdType sze=0, vtkIdType ext=1000)
A special form of CopyAllocate() to be used with FieldLists.
void CopyAllocate(vtkDataSetAttributes *pd, vtkIdType sze=0, vtkIdType ext=1000)
Allocates point data for point-by-point (or cell-by-cell) copy operation.
friend struct ArrayList
List of possible ArrayTypes that are produced by vtkIOSSUtilities.
void DeepCopy(vtkFieldData *pd) override
Deep copy of data (i.e., create new data arrays and copy from input data).
int SetRationalWeights(vtkDataArray *da)
Set/Get the rational weights data.
void ShallowCopy(vtkFieldData *pd) override
Shallow copy of data (i.e., use reference counting).
static const char * GetAttributeTypeAsString(int attributeType)
Given an integer attribute type, this static method returns a string type for the attribute (i....
void GetAttributeIndices(int *indexArray)
Get the field data array indices corresponding to scalars, vectors, tensors, etc.
static const char AttributeNames[NUM_ATTRIBUTES][19]
void SetCopyRationalWeights(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
void SetCopyTensors(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
int SetActiveAttribute(const char *name, int attributeType)
Make the array with the given name the active attribute.
int SetTCoords(vtkDataArray *da)
Set/Get the texture coordinate data.
vtkTypeBool GetCopyProcessIds(int ctype=ALLCOPY)
void SetCopyHigherOrderDegrees(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
void InterpolateAllocate(vtkDataSetAttributes *pd, vtkIdType sze, vtkIdType ext, int shallowCopyArrays)
Initialize point interpolation method.
int SetPedigreeIds(vtkAbstractArray *da)
Set/Get the pedigree id data.
vtkTypeBool GetCopyTensors(int ctype=ALLCOPY)
void CopyData(vtkDataSetAttributes *fromPd, vtkIdList *fromIds, vtkIdList *toIds)
Copy the attribute data from one id to another.
void SetCopyProcessIds(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
int SetActiveVectors(const char *name)
Set/Get the vector data.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetCopyGlobalIds(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
void CopyAllOff(int ctype=ALLCOPY) override
Turn on/off the copying of attribute data.
vtkDataArray * GetGlobalIds(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
vtkDataArray * GetScalars()
Set/Get the scalar data.
vtkDataArray * GetHigherOrderDegrees()
Set/Get the rational degrees data.
int SetTangents(vtkDataArray *da)
Set/get the tangent data.
int SetActiveTensors(const char *name)
Set/Get the tensor data.
static const int AttributeLimits[NUM_ATTRIBUTES]
void SetCopyVectors(vtkTypeBool i, int ctype=ALLCOPY)
Turn on/off the copying of attribute data.
vtkDataArray * GetVectors(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
int SetVectors(vtkDataArray *da)
Set/Get the vector data.
vtkDataArray * GetTensors(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
vtkDataArray * GetGlobalIds()
Set/Get the global id data.
int SetTensors(vtkDataArray *da)
Set/Get the tensor data.
int SetAttribute(vtkAbstractArray *aa, int attributeType)
Set an array to use as the given attribute type (i.e., vtkDataSetAttributes::SCALAR,...
vtkDataArray * GetProcessIds(const char *name)
If the string is nullptr or empty, calls the alternate method of the same name (that takes no paramet...
virtual void RemoveArray(const char *name)
Remove an array (with the given name) from the list of arrays.
list of point or cell ids
Definition vtkIdList.h:24
a simple class to control print indentation
Definition vtkIndent.h:29
map scalar values into colors via a lookup table
int vtkTypeBool
Definition vtkABI.h:64
#define vtkDataArray
void CopyAllocate(vtkDataSetAttributes *output, int ctype, vtkIdType sz, vtkIdType ext) const
These methods can called to generate and update the output vtkDataSetAttributes.
int vtkIdType
Definition vtkType.h:368
#define VTK_MARSHALMANUAL