VTK
vtkMappedDataArray.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkMappedDataArray.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14==============================================================================*/
35#ifndef vtkMappedDataArray_h
36#define vtkMappedDataArray_h
37
38#include "vtkTypedDataArray.h"
39
40template <class Scalar>
42{
43public:
45 typedef typename Superclass::ValueType ValueType;
46
56
57 void PrintSelf(ostream &os, vtkIndent indent);
58
59 // vtkAbstractArray virtual method that must be reimplemented.
63 void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output) = 0;
64 void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output) = 0;
66 vtkAbstractArray *source, double *weights) = 0;
68 vtkAbstractArray* source1, vtkIdType id2,
69 vtkAbstractArray* source2, double t) = 0;
70
71 // vtkDataArray virtual method that must be reimplemented.
72 void DeepCopy(vtkDataArray *da) = 0;
73
80
86 void ExportToVoidPointer(void *ptr);
87
96
98
102 void SetVoidArray(void *, vtkIdType, int);
103 void SetVoidArray(void *, vtkIdType, int, int);
105
107
110 void * WriteVoidPointer(vtkIdType /*id*/, vtkIdType /*number*/)
111 {
112 vtkErrorMacro(<<"WriteVoidPointer: Method not implemented.");
113 return NULL;
114 }
116
120 void Modified();
121
122 // vtkAbstractArray override:
123 bool HasStandardMemoryLayout() { return false; }
124
125protected:
128
129 virtual int GetArrayType()
130 {
132 }
133
134private:
135 vtkMappedDataArray(const vtkMappedDataArray &) VTK_DELETE_FUNCTION;
136 void operator=(const vtkMappedDataArray &) VTK_DELETE_FUNCTION;
137
139
142 ValueType *TemporaryScalarPointer;
143 size_t TemporaryScalarPointerSize;
144};
146
147// Declare vtkArrayDownCast implementations for mapped containers:
149
150#include "vtkMappedDataArray.txx"
151
152// Adds an implementation of NewInstanceInternal() that returns an AoS
153// (unmapped) VTK array, if possible. Use this in combination with
154// vtkAbstractTemplateTypeMacro when your subclass is a template class.
155// Otherwise, use vtkMappedDataArrayTypeMacro.
156#define vtkMappedDataArrayNewInstanceMacro(thisClass) \
157 protected: \
158 vtkObjectBase *NewInstanceInternal() const \
159 { \
160 if (vtkDataArray *da = \
161 vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \
162 { \
163 return da; \
164 } \
165 return thisClass::New(); \
166 } \
167 public:
168
169// Same as vtkTypeMacro, but adds an implementation of NewInstanceInternal()
170// that returns a standard (unmapped) VTK array, if possible.
171#define vtkMappedDataArrayTypeMacro(thisClass, superClass) \
172 vtkAbstractTypeMacroWithNewInstanceType(thisClass, superClass, vtkDataArray) \
173 vtkMappedDataArrayNewInstanceMacro(thisClass)
174
175#endif //vtkMappedDataArray_h
176
177// VTK-HeaderTest-Exclude: vtkMappedDataArray.h
Abstract superclass for all arrays.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkTemplateTypeMacro(SelfType, vtkDataArray) enum
Compile time access to the VTK type identifier.
list of point or cell ids
Definition: vtkIdList.h:37
a simple class to control print indentation
Definition: vtkIndent.h:40
Map non-contiguous data structures into the vtkDataArray API.
void InterpolateTuple(vtkIdType i, vtkIdType id1, vtkAbstractArray *source1, vtkIdType id2, vtkAbstractArray *source2, double t)=0
Insert the tuple at dstTupleIdx in this array to the tuple interpolated from the two tuple indices,...
void Modified()
Invalidate the internal temporary array and call superclass method.
void ExportToVoidPointer(void *ptr)
Copy the internal data to the void pointer.
virtual int GetArrayType()
Method for type-checking in FastDownCast implementations.
void SetVariantValue(vtkIdType idx, vtkVariant value)=0
Set a value in the array from a variant.
static vtkTemplateTypeMacro(vtkMappedDataArray< Scalar >, vtkTypedDataArray< Scalar >) typedef typename Superclass vtkMappedDataArray< Scalar > * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkMappedDataArray.
bool HasStandardMemoryLayout()
Returns true if this array uses the standard memory layout defined in the VTK user guide,...
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights)=0
Set the tuple at dstTupleIdx in this array to the interpolated tuple value, given the ptIndices in th...
void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output)=0
Given a list of tuple ids, return an array of tuples.
void * GetVoidPointer(vtkIdType id)
Print an error and create an internal, long-lived temporary array.
void SetVoidArray(void *, vtkIdType, int)
These methods don't make sense for mapped data array.
void SetVoidArray(void *, vtkIdType, int, int)
void * WriteVoidPointer(vtkIdType, vtkIdType)
Not implemented.
void DeepCopy(vtkDataArray *da)=0
void DataChanged()
Read the data from the internal temporary array (created by GetVoidPointer) back into the mapped arra...
void DeepCopy(vtkAbstractArray *aa)=0
Deep copy of data.
void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output)=0
Get the tuples for the range of tuple ids specified (i.e., p1->p2 inclusive).
vtkVariant GetVariantValue(vtkIdType idx)=0
Retrieve value from the array as a variant.
Extend vtkDataArray with abstract type-specific API.
A atomic type representing the union of many types.
Definition: vtkVariant.h:76
@ value
Definition: vtkX3D.h:220
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int vtkIdType
Definition: vtkType.h:287
vtkArrayDownCast_TemplateFastCastMacro(vtkTypedDataArray) template< class Scalar > inline typename vtkTypedDataArray< Scalar >