Thanks to visit codestin.com
Credit goes to vtk.org

VTK  9.5.20250919
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
158#ifndef vtkDataSetAttributes_h
159#define vtkDataSetAttributes_h
160
161#include "vtkCommonDataModelModule.h" // For export macro
162#include "vtkDataSetAttributesFieldList.h" // for vtkDataSetAttributesFieldList
163#include "vtkFieldData.h"
164#include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
165
166VTK_ABI_NAMESPACE_BEGIN
167class vtkLookupTable;
168
169class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALMANUAL vtkDataSetAttributes : public vtkFieldData
170{
171public:
177
179 void PrintSelf(ostream& os, vtkIndent indent) override;
180
185 void Initialize() override;
186
191 virtual void Update() {}
192
193 // -- shallow and deep copy -----------------------------------------------
194
200 void DeepCopy(vtkFieldData* pd) override;
201
206 void ShallowCopy(vtkFieldData* pd) override;
207
208 // -- attribute types -----------------------------------------------------
209
210 // Always keep NUM_ATTRIBUTES as the last entry
212 {
213 SCALARS = 0,
214 VECTORS = 1,
215 NORMALS = 2,
216 TCOORDS = 3,
217 TENSORS = 4,
218 GLOBALIDS = 5,
219 PEDIGREEIDS = 6,
220 EDGEFLAG = 7,
221 TANGENTS = 8,
222 RATIONALWEIGHTS = 9,
223 HIGHERORDERDEGREES = 10,
224 PROCESSIDS = 11,
225 NUM_ATTRIBUTES = 12
226 };
227
229 {
232 NOLIMIT
233 };
234
235 // ----------- ghost points and ghost cells -------------------------------------------
236 // The following bit fields are consistent with VisIt ghost zones specification
237 // For details, see http://www.visitusers.org/index.php?title=Representing_ghost_data
238
240 {
241 DUPLICATECELL = 1, // the cell is present on multiple processors
242 HIGHCONNECTIVITYCELL = 2, // the cell has more neighbors than in a regular mesh
243 LOWCONNECTIVITYCELL = 4, // the cell has less neighbors than in a regular mesh
244 REFINEDCELL = 8, // other cells are present that refines it.
245 EXTERIORCELL = 16, // the cell is on the exterior of the data set
246 HIDDENCELL =
247 32 // the cell is needed to maintain connectivity, but the data values should be ignored.
248 };
249
251 {
252 DUPLICATEPOINT = 1, // the cell is present on multiple processors
253 HIDDENPOINT =
254 2 // the point is needed to maintain connectivity, but the data values should be ignored.
255 };
256
257 //-----------------------------------------------------------------------------------
258
260
264 int SetActiveScalars(const char* name);
267
269
273 int SetActiveVectors(const char* name);
276
278
282 int SetActiveNormals(const char* name);
285
287
291 int SetActiveTangents(const char* name);
294
296
300 int SetActiveTCoords(const char* name);
303
305
309 int SetActiveTensors(const char* name);
312
314
318 int SetActiveGlobalIds(const char* name);
321
323
327 int SetActivePedigreeIds(const char* name);
330
332
336 int SetActiveRationalWeights(const char* name);
339
341
345 int SetActiveHigherOrderDegrees(const char* name);
348
350
354 int SetActiveProcessIds(const char* name);
357
359
365 vtkDataArray* GetScalars(const char* name);
366 vtkDataArray* GetVectors(const char* name);
367 vtkDataArray* GetNormals(const char* name);
368 vtkDataArray* GetTangents(const char* name);
369 vtkDataArray* GetTCoords(const char* name);
370 vtkDataArray* GetTensors(const char* name);
371 vtkDataArray* GetGlobalIds(const char* name);
375 vtkDataArray* GetProcessIds(const char* name);
377
396 int SetActiveAttribute(const char* name, int attributeType);
397
403 int SetActiveAttribute(int index, int attributeType);
404
410 void GetAttributeIndices(int* indexArray);
411
418 int IsArrayAnAttribute(int idx);
419
442 int SetAttribute(vtkAbstractArray* aa, int attributeType);
443
450 vtkDataArray* GetAttribute(int attributeType);
451
460
462
467 void RemoveArray(int index) override;
469
471
475 static const char* GetAttributeTypeAsString(int attributeType);
476 static const char* GetLongAttributeTypeAsString(int attributeType);
478
479 // -- attribute copy properties ------------------------------------------
480
481 // NOLINTNEXTLINE(readability-enum-initial-value)
483 {
484 COPYTUPLE = 0,
485 INTERPOLATE = 1,
486 PASSDATA = 2,
487 ALLCOPY // all of the above
488 };
489
511 void SetCopyAttribute(int index, int value, int ctype = ALLCOPY);
512
517 int GetCopyAttribute(int index, int ctype);
518
520 void SetCopyScalars(vtkTypeBool i, int ctype = ALLCOPY);
521 vtkTypeBool GetCopyScalars(int ctype = ALLCOPY);
522 vtkBooleanMacro(CopyScalars, vtkTypeBool);
523
525 void SetCopyVectors(vtkTypeBool i, int ctype = ALLCOPY);
526 vtkTypeBool GetCopyVectors(int ctype = ALLCOPY);
527 vtkBooleanMacro(CopyVectors, vtkTypeBool);
528
530 void SetCopyNormals(vtkTypeBool i, int ctype = ALLCOPY);
531 vtkTypeBool GetCopyNormals(int ctype = ALLCOPY);
532 vtkBooleanMacro(CopyNormals, vtkTypeBool);
533
535 void SetCopyTangents(vtkTypeBool i, int ctype = ALLCOPY);
536 vtkTypeBool GetCopyTangents(int ctype = ALLCOPY);
537 vtkBooleanMacro(CopyTangents, vtkTypeBool);
538
540 void SetCopyTCoords(vtkTypeBool i, int ctype = ALLCOPY);
541 vtkTypeBool GetCopyTCoords(int ctype = ALLCOPY);
542 vtkBooleanMacro(CopyTCoords, vtkTypeBool);
543
545 void SetCopyTensors(vtkTypeBool i, int ctype = ALLCOPY);
546 vtkTypeBool GetCopyTensors(int ctype = ALLCOPY);
547 vtkBooleanMacro(CopyTensors, vtkTypeBool);
548
550 void SetCopyGlobalIds(vtkTypeBool i, int ctype = ALLCOPY);
551 vtkTypeBool GetCopyGlobalIds(int ctype = ALLCOPY);
552 vtkBooleanMacro(CopyGlobalIds, vtkTypeBool);
553
555 void SetCopyPedigreeIds(vtkTypeBool i, int ctype = ALLCOPY);
556 vtkTypeBool GetCopyPedigreeIds(int ctype = ALLCOPY);
557 vtkBooleanMacro(CopyPedigreeIds, vtkTypeBool);
558
560 void SetCopyRationalWeights(vtkTypeBool i, int ctype = ALLCOPY);
562 vtkBooleanMacro(CopyRationalWeights, vtkTypeBool);
563
565 void SetCopyHigherOrderDegrees(vtkTypeBool i, int ctype = ALLCOPY);
567 vtkBooleanMacro(CopyHigherOrderDegrees, vtkTypeBool);
568
570 void SetCopyProcessIds(vtkTypeBool i, int ctype = ALLCOPY);
571 vtkTypeBool GetCopyProcessIds(int ctype = ALLCOPY);
572 vtkBooleanMacro(CopyProcessIds, vtkTypeBool);
573
575 void CopyAllOn(int ctype = ALLCOPY) override;
576
578 void CopyAllOff(int ctype = ALLCOPY) override;
579
580 // -- passthrough operations ----------------------------------------------
581
591 void PassData(vtkFieldData* fd) override;
592
593 // -- copytuple operations ------------------------------------------------
594
596
608 {
609 this->CopyAllocate(pd, sze, ext, 0);
610 }
611 void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze, vtkIdType ext, int shallowCopyArrays);
613
622
632 vtkDataSetAttributes* inDsa, const int* inExt, const int* outExt, bool setSize = true);
633
635
649 void CopyData(vtkDataSetAttributes* fromPd, vtkIdList* fromIds, vtkIdList* toIds);
650 void CopyData(vtkDataSetAttributes* fromPd, vtkIdList* fromIds, vtkIdType destStartId = 0);
652
658 void CopyData(vtkDataSetAttributes* fromPd, vtkIdType dstStart, vtkIdType n, vtkIdType srcStart);
659
661
668 vtkAbstractArray* fromData, vtkAbstractArray* toData, vtkIdType fromId, vtkIdType toId);
670 vtkAbstractArray* fromData, vtkAbstractArray* toData, vtkIdList* fromIds, vtkIdList* toIds);
671 void CopyTuples(vtkAbstractArray* fromData, vtkAbstractArray* toData, vtkIdType dstStart,
672 vtkIdType n, vtkIdType srcStart);
674
675 // -- interpolate operations ----------------------------------------------
676
678
687 {
688 this->InterpolateAllocate(pd, sze, ext, 0);
689 }
691 vtkDataSetAttributes* pd, vtkIdType sze, vtkIdType ext, int shallowCopyArrays);
693
702 vtkDataSetAttributes* fromPd, vtkIdType toId, vtkIdList* ids, double* weights);
703
714 vtkDataSetAttributes* fromPd, vtkIdType toId, vtkIdType p1, vtkIdType p2, double t);
715
729 vtkDataSetAttributes* from1, vtkDataSetAttributes* from2, vtkIdType id, double t);
730
732
733 // field list copy operations ------------------------------------------
734
740
748 vtkIdType fromId, vtkIdType toId);
750 vtkIdType dstStart, vtkIdType n, vtkIdType srcStart);
751
759 vtkDataSetAttributes::FieldList& list, vtkIdType sze = 0, vtkIdType ext = 1000);
760
768 int idx, vtkIdType toId, vtkIdList* ids, double* weights);
769
770protected:
773
775 vtkIdType ext = 1000, int shallowCopyArrays = 0, bool createNewArrays = true);
776
780 void InitializeFields() override;
781
782 int AttributeIndices[NUM_ATTRIBUTES]; // index to attribute array in field data
783 int CopyAttributeFlags[ALLCOPY][NUM_ATTRIBUTES]; // copy flag for attribute data
784
785 friend struct ArrayList; // Friend to base class in vtkArrayListTemplate
788
789 static const int NumberOfAttributeComponents[NUM_ATTRIBUTES];
790 static const int AttributeLimits[NUM_ATTRIBUTES];
791 static const char AttributeNames[NUM_ATTRIBUTES][19];
792 static const char LongAttributeNames[NUM_ATTRIBUTES][42];
793
794private:
795 static int CheckNumberOfComponents(vtkAbstractArray* da, int attributeType);
796
797 vtkFieldData::BasicIterator ComputeRequiredArrays(vtkDataSetAttributes* pd, int ctype);
798
800 void operator=(const vtkDataSetAttributes&) = delete;
801
803};
804
805VTK_ABI_NAMESPACE_END
806#endif
Abstract superclass for all arrays.
abstract superclass for arrays of numeric data
helps manage arrays from multiple vtkDataSetAttributes.
represent and manipulate attribute data in a dataset
static const char * GetLongAttributeTypeAsString(int attributeType)
Given an integer attribute type, this static method returns a string type for the attribute (i....
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.
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.
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.
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.
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.
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.
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.
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.
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...
Represents and manipulates a collection of data arrays.
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:133
a simple class to control print indentation
Definition vtkIndent.h:108
map scalar values into colors via a lookup table
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:333
#define VTK_MARSHALMANUAL