Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# vtkFieldData Class Reference

`#include <vtkFieldData.h>`

Inheritance diagram for vtkFieldData:

[legend]
Collaboration diagram for vtkFieldData:

[legend]
List of all members.

## Detailed Description

represent and manipulate fields of data

Date:
  2002/12/11 22:47:41

Revision:
  1.44

vtkFieldData represents and manipulates fields of data. The model of a field is a m x n matrix of data values, where m is the number of tuples, and n is the number of components. (A tuple is a row of n components in the matrix.) The field is assumed to be composed of a set of one or more data arrays, where the data in the arrays are of different types (e.g., int, float, char, etc.), and there may be variable numbers of components in each array. Note that each data array is assumed to be "m" in length (i.e., number of tuples), which typically corresponds to the number of points or cells in a dataset. Also, each data array must have a character-string name. (This is used to manipulate data.)

There are two ways of manipulating and interfacing to fields. You can do it generically by manipulating components/tuples via a float-type data exchange, or you can do it by grabbing the arrays and manipulating them directly. The former is simpler but performs type conversion, which is bad if your data has non-castable types like (void) pointers, or you lose information as a result of the cast. The, more efficient method means managing each array in the field. Using this method you can create faster, more efficient algorithms that do not lose information.

See also:
  vtkDataArray vtkAttribueData vtkPointData vtkCellData

Created by:
  - Schroeder, Will

CVS contributions (if > 5%):
  - Geveci, Berk (43%)
  - Schroeder, Will (30%)
  - Martin, Ken (5%)

CVS logs (CVSweb):
  - .`h` (`/Common/vtkFieldData.h)`
  - .`cxx` (`/Common/vtkFieldData.cxx)`

Tests:
  vtkFieldData (Tests)

Definition at line 70 of file vtkFieldData.h.

## Public Types
typedef vtkObject | Superclass
## Public Methods
virtual const char * | GetClassName ()
virtual int | IsA (const char *type)
void | PrintSelf (ostream &os, vtkIndent indent)
virtual void | Initialize ()
int | Allocate (const vtkIdType sz, const vtkIdType ext=1000)
virtual vtkFieldData * | MakeObject ()
void | CopyStructure (vtkFieldData *)
void | AllocateArrays (int num)
void | SetNumberOfArrays (int num)
int | GetNumberOfArrays ()
int | AddArray (vtkDataArray *array)
vtkDataArray * | GetArray (int i)
vtkDataArray * | GetArray (const char *arrayName, int &index)
vtkDataArray * | GetArray (const char *arrayName)
virtual void | PassData (vtkFieldData *fd)
virtual void | CopyAllOn ()
virtual void | CopyAllOff ()
virtual void | DeepCopy (vtkFieldData *da)
virtual void | ShallowCopy (vtkFieldData *da)
void | Squeeze ()
void | Reset ()
virtual unsigned long | GetActualMemorySize ()
unsigned long int | GetMTime ()
void | GetField (vtkIdList *ptId, vtkFieldData *f)
int | GetArrayContainingComponent (int i, int &arrayComp)
int | GetNumberOfComponents ()
vtkIdType | GetNumberOfTuples ()
void | SetNumberOfTuples (const vtkIdType number)
float * | GetTuple (const vtkIdType i)
void | GetTuple (const vtkIdType i, float *tuple)
void | SetTuple (const vtkIdType i, const float *tuple)
void | InsertTuple (const vtkIdType i, const float *tuple)
vtkIdType | InsertNextTuple (const float *tuple)
float | GetComponent (const vtkIdType i, const int j)
void | SetComponent (const vtkIdType i, const int j, const float c)
void | InsertComponent (const vtkIdType i, const int j, const float c)
virtual void | RemoveArray (const char *name)
const char * | GetArrayName (int i)
void | CopyFieldOn (const char *name)
void | CopyFieldOff (const char *name)
## Static Public Methods
vtkFieldData * | New ()
int | IsTypeOf (const char *type)
vtkFieldData * | SafeDownCast (vtkObject *o)
## Protected Methods
| vtkFieldData ()
| ~vtkFieldData ()
void | SetArray (int i, vtkDataArray *array)
virtual void | RemoveArray (int index)
virtual void | InitializeFields ()
void | CopyFieldOnOff (const char *name, int onOff)
void | ClearFieldFlags ()
int | FindFlag (const char *field)
int | GetFlag (const char *field)
void | CopyFlags (const vtkFieldData *source)
## Protected Attributes
int | NumberOfArrays
int | NumberOfActiveArrays
vtkDataArray ** | Data
int | TupleSize
float * | Tuple
CopyFieldFlag * | CopyFieldFlags
int | NumberOfFieldFlags
int | DoCopyAllOn
int | DoCopyAllOff

## Member Typedef Documentation

typedef vtkObject vtkFieldData::Superclass

| Reimplemented from vtkObject. Reimplemented in vtkCellData, vtkDataSetAttributes, and vtkPointData. Definition at line 75 of file vtkFieldData.h.

## Constructor & Destructor Documentation

vtkFieldData::vtkFieldData | ( |  | ) | `[protected]`

vtkFieldData::~vtkFieldData | ( |  | ) | `[protected]`

## Member Function Documentation

vtkFieldData* vtkFieldData::New | ( |  | ) | `[static]`

| Create an object with Debug turned off, modified time initialized to zero, and reference counting on. Reimplemented from vtkObject. Reimplemented in vtkCellData, vtkDataSetAttributes, and vtkPointData.

virtual const char* vtkFieldData::GetClassName | ( |  | ) | `[virtual]`

| Reimplemented from vtkObject. Reimplemented in vtkCellData, vtkDataSetAttributes, and vtkPointData.

int vtkFieldData::IsTypeOf | ( | const char * | type | ) | `[static]`

| Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkObject. Reimplemented in vtkCellData, vtkDataSetAttributes, and vtkPointData.

virtual int vtkFieldData::IsA | ( | const char * | type | ) | `[virtual]`

| Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkObject. Reimplemented in vtkCellData, vtkDataSetAttributes, and vtkPointData.

vtkFieldData* vtkFieldData::SafeDownCast | ( | vtkObject * | o | ) | `[static]`

| Reimplemented from vtkObject. Reimplemented in vtkCellData, vtkDataSetAttributes, and vtkPointData.

void vtkFieldData::PrintSelf | ( | ostream & | os,
|  | vtkIndent | indent
| ) | `[virtual]`

| Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes. Reimplemented from vtkObject. Reimplemented in vtkCellData, vtkDataSetAttributes, and vtkPointData.

virtual void vtkFieldData::Initialize | ( |  | ) | `[virtual]`

| Release all data but do not delete object. Also, clear the copy flags. Reimplemented in vtkDataSetAttributes.

int vtkFieldData::Allocate | ( | const vtkIdType | sz,
|  | const vtkIdType | ext = 1000
| ) |

| Allocate data for each array. Note that ext is no longer used.

virtual vtkFieldData* vtkFieldData::MakeObject | ( |  | ) | `[virtual]`

| For legacy compatibility. Do not use.

void vtkFieldData::CopyStructure | ( | vtkFieldData * |  | ) |

| Copy data array structure from a given field. The same arrays will exist with the same types, but will contain nothing in the copy.

void vtkFieldData::AllocateArrays | ( | int | num | ) |

| AllocateOfArrays actually sets the number of vtkDataArray pointers in the vtkFieldData object, not the number of used pointers (arrays). Adding more arrays will cause the object to dynamically adjust the number of pointers if it needs to extend. Although AllocateArrays can be used if the number of arrays which will be added is known, it can be omitted with a small computation cost.

void vtkFieldData::SetNumberOfArrays | ( | int | num | ) | `[inline]`

| Definition at line 103 of file vtkFieldData.h.

int vtkFieldData::GetNumberOfArrays | ( |  | ) |

| Get the number of arrays of data available. This does not include NULL array pointers therefore after fd->AllocateArray(n); nArrays = GetNumberOfArrays() nArrays is not necessarily equal to n.

int vtkFieldData::AddArray | ( | vtkDataArray * | array | ) |

| Add an array to the array list. If an array with the same name already exists - then the added array will replace it.

virtual void vtkFieldData::RemoveArray | ( | const char * | name | ) | `[inline, virtual]`

| Remove an array (with the given name) from the list of arrays. Reimplemented in vtkDataSetAttributes. Definition at line 122 of file vtkFieldData.h.

vtkDataArray* vtkFieldData::GetArray | ( | int | i | ) |

| Return the ith array in the field. A NULL is returned if the index i is out of range.

vtkDataArray* vtkFieldData::GetArray | ( | const char * | arrayName,
|  | int & | index
| ) |

| Return the array with the name given. Returns NULL is array not found. Also returns index of array if found, -1 otherwise

vtkDataArray* vtkFieldData::GetArray | ( | const char * | arrayName | ) |

const char* vtkFieldData::GetArrayName | ( | int | i | ) | `[inline]`

| Get the name of ith array. Note that this is equivalent to: GetArray(i)->GetName() if ith array pointer is not NULL Definition at line 144 of file vtkFieldData.h. References vtkDataArray::GetName().

virtual void vtkFieldData::PassData | ( | vtkFieldData * | fd | ) | `[virtual]`

| Pass entire arrays of input data through to output. Obey the "copy" flags. Reimplemented in vtkDataSetAttributes.

void vtkFieldData::CopyFieldOn | ( | const char * | name | ) | `[inline]`

| Turn on/off the copying of the field specified by name. During the copying/passing, the following rules are followed for each array: 1. If the copy flag for an array is set (on or off), it is applied This overrides rule 2. 2. If CopyAllOn is set, copy the array. If CopyAllOff is set, do not copy the array Definition at line 168 of file vtkFieldData.h.

void vtkFieldData::CopyFieldOff | ( | const char * | name | ) | `[inline]`

| Turn on/off the copying of the field specified by name. During the copying/passing, the following rules are followed for each array: 1. If the copy flag for an array is set (on or off), it is applied This overrides rule 2. 2. If CopyAllOn is set, copy the array. If CopyAllOff is set, do not copy the array Definition at line 169 of file vtkFieldData.h.

virtual void vtkFieldData::CopyAllOn | ( |  | ) | `[virtual]`

| Turn on copying of all data. During the copying/passing, the following rules are followed for each array: 1. If the copy flag for an array is set (on or off), it is applied This overrides rule 2. 2. If CopyAllOn is set, copy the array. If CopyAllOff is set, do not copy the array Reimplemented in vtkDataSetAttributes.

virtual void vtkFieldData::CopyAllOff | ( |  | ) | `[virtual]`

| Turn off copying of all data. During the copying/passing, the following rules are followed for each array: 1. If the copy flag for an array is set (on or off), it is applied This overrides rule 2. 2. If CopyAllOn is set, copy the array. If CopyAllOff is set, do not copy the array Reimplemented in vtkDataSetAttributes.

virtual void vtkFieldData::DeepCopy | ( | vtkFieldData * | da | ) | `[virtual]`

| Copy a field by creating new data arrays (i.e., duplicate storage). Reimplemented in vtkDataSetAttributes.

virtual void vtkFieldData::ShallowCopy | ( | vtkFieldData * | da | ) | `[virtual]`

| Copy a field by reference counting the data arrays. Reimplemented in vtkDataSetAttributes.

void vtkFieldData::Squeeze | ( |  | ) |

| Squeezes each data array in the field (Squeeze() reclaims unused memory.)

void vtkFieldData::Reset | ( |  | ) |

| Resets each data array in the field (Reset() does not release memory but it makes the arrays look like they are empty.)

virtual unsigned long vtkFieldData::GetActualMemorySize | ( |  | ) | `[virtual]`

| Return the memory in kilobytes consumed by this field data. Used to support streaming and reading/writing data. The value returned is guaranteed to be greater than or equal to the memory required to actually represent the data represented by this object.

unsigned long int vtkFieldData::GetMTime | ( |  | ) | `[virtual]`

| Check object's components for modified times. Reimplemented from vtkObject.

void vtkFieldData::GetField | ( | vtkIdList * | ptId,
|  | vtkFieldData * | f
| ) |

| Get a field from a list of ids. Supplied field f should have same types and number of data arrays as this one (i.e., like CopyStructure() creates). This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

int vtkFieldData::GetArrayContainingComponent | ( | int | i,
|  | int & | arrayComp
| ) |

| Return the array containing the ith component of the field. The return value is an integer number n 0<=n<this->NumberOfArrays. Also, an integer value is returned indicating the component in the array is returned. Method returns -1 if specified component is not in the field. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

int vtkFieldData::GetNumberOfComponents | ( |  | ) |

| Get the number of components in the field. This is determined by adding up the components in each non-NULL array. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

vtkIdType vtkFieldData::GetNumberOfTuples | ( |  | ) |

| Get the number of tuples in the field. Note: some fields have arrays with different numbers of tuples; this method returns the number of tuples in the first array. Mixed-length arrays may have to be treated specially. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

void vtkFieldData::SetNumberOfTuples | ( | const vtkIdType | number | ) |

| Set the number of tuples for each data array in the field. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

float* vtkFieldData::GetTuple | ( | const vtkIdType | i | ) |

| Return a tuple consisting of a concatenation of all data from all the different arrays. Note that everything is converted to and from float values. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

void vtkFieldData::GetTuple | ( | const vtkIdType | i,
|  | float * | tuple
| ) |

| Copy the ith tuple value into a user provided tuple array. Make sure that you've allocated enough space for the copy. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

void vtkFieldData::SetTuple | ( | const vtkIdType | i,
|  | const float * | tuple
| ) |

| Set the tuple value at the ith location. Set operations mean that no range checking is performed, so they're faster. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

void vtkFieldData::InsertTuple | ( | const vtkIdType | i,
|  | const float * | tuple
| ) |

| Insert the tuple value at the ith location. Range checking is performed and memory allocates as necessary. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

vtkIdType vtkFieldData::InsertNextTuple | ( | const float * | tuple | ) |

| Insert the tuple value at the end of the tuple matrix. Range checking is performed and memory is allocated as necessary. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

float vtkFieldData::GetComponent | ( | const vtkIdType | i,
|  | const int | j
| ) |

| Get the component value at the ith tuple (or row) and jth component (or column). This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

void vtkFieldData::SetComponent | ( | const vtkIdType | i,
|  | const int | j,
|  | const float | c
| ) |

| Set the component value at the ith tuple (or row) and jth component (or column). Range checking is not performed, so set the object up properly before invoking. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

void vtkFieldData::InsertComponent | ( | const vtkIdType | i,
|  | const int | j,
|  | const float | c
| ) |

| Insert the component value at the ith tuple (or row) and jth component (or column). Range checking is performed and memory allocated as necessary o hold data. This method should not be used if the instance is from a subclass of vtkFieldData (vtkPointData or vtkCellData). This is because in those cases, the attribute data is stored with the other fields and will cause the method to behave in an unexpected way.

void vtkFieldData::SetArray | ( | int | i,
|  | vtkDataArray * | array
| ) | `[protected]`

| Set an array to define the field.

virtual void vtkFieldData::RemoveArray | ( | int | index | ) | `[protected, virtual]`

| Reimplemented in vtkDataSetAttributes.

virtual void vtkFieldData::InitializeFields | ( |  | ) | `[protected, virtual]`

| Release all data but do not delete object. Reimplemented in vtkDataSetAttributes.

void vtkFieldData::CopyFieldOnOff | ( | const char * | name,
|  | int | onOff
| ) | `[protected]`

void vtkFieldData::ClearFieldFlags | ( |  | ) | `[protected]`

int vtkFieldData::FindFlag | ( | const char * | field | ) | `[protected]`

int vtkFieldData::GetFlag | ( | const char * | field | ) | `[protected]`

void vtkFieldData::CopyFlags | ( | const vtkFieldData * | source | ) | `[protected]`

## Member Data Documentation

int vtkFieldData::NumberOfArrays`[protected]`

| Definition at line 322 of file vtkFieldData.h.

int vtkFieldData::NumberOfActiveArrays`[protected]`

| Definition at line 323 of file vtkFieldData.h.

vtkDataArray** vtkFieldData::Data`[protected]`

| Definition at line 324 of file vtkFieldData.h.

int vtkFieldData::TupleSize`[protected]`

| Definition at line 326 of file vtkFieldData.h.

float* vtkFieldData::Tuple`[protected]`

| Definition at line 327 of file vtkFieldData.h.

CopyFieldFlag* vtkFieldData::CopyFieldFlags`[protected]`

| Definition at line 345 of file vtkFieldData.h.

int vtkFieldData::NumberOfFieldFlags`[protected]`

| Definition at line 346 of file vtkFieldData.h.

int vtkFieldData::DoCopyAllOn`[protected]`

| Definition at line 352 of file vtkFieldData.h.

int vtkFieldData::DoCopyAllOff`[protected]`

| Definition at line 353 of file vtkFieldData.h.

The documentation for this class was generated from the following file:

- Common/vtkFieldData.h