/usr/include/vtk-6.3/vtkRearrangeFields.h is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkRearrangeFields.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkRearrangeFields - Move/copy fields between field data, point data and cell data
// .SECTION Description
// vtkRearrangeFields is used to copy/move fields (vtkDataArrays) between
// data object's field data, point data and cell data. To specify which
// fields are copied/moved, the user adds operations. There are two types
// of operations: 1. the type which copies/moves an attribute's data
// (i.e. the field will be copied but will not be an attribute in the
// target), 2. the type which copies/moves fields by name. For example:
// @verbatim
// rf->AddOperation(vtkRearrangeFields::COPY, "foo",
// vtkRearrangeFields::DATA_OBJECT,
// vtkRearrangeFields::POINT_DATA);
// @endverbatim
// adds an operation which copies a field (data array) called foo from
// the data object's field data to point data.
// From Tcl, the same operation can be added as follows:
// @verbatim
// rf AddOperation COPY foo DATA_OBJECT POINT_DATA
// @endverbatim
// The same can be done using Python and Java bindings by passing
// strings as arguments.
// @verbatim
// Operation types: COPY, MOVE
// AttributeTypes: SCALARS, VECTORS, NORMALS, TCOORDS, TENSORS
// Field data locations: DATA_OBJECT, POINT_DATA, CELL_DATA
// @endverbatim
// .SECTION Caveats
// When using Tcl, Java, Python or Visual Basic bindings, the array name
// can not be one of the AttributeTypes when calling AddOperation() which
// takes strings as arguments. The Tcl (Java etc.) command will
// always assume the string corresponds to an attribute type when
// the argument is one of the AttributeTypes. In this situation,
// use the AddOperation() which takes enums.
// .SECTION See Also
// vtkFieldData vtkDataSet vtkDataObjectToDataSetFilter
// vtkDataSetAttributes vtkDataArray vtkAssignAttribute
// vtkSplitField vtkMergeFields
#ifndef vtkRearrangeFields_h
#define vtkRearrangeFields_h
#include "vtkFiltersCoreModule.h" // For export macro
#include "vtkDataSetAlgorithm.h"
#include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES
class vtkFieldData;
class VTKFILTERSCORE_EXPORT vtkRearrangeFields : public vtkDataSetAlgorithm
{
public:
vtkTypeMacro(vtkRearrangeFields,vtkDataSetAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Create a new vtkRearrangeFields with an empty operation list.
static vtkRearrangeFields *New();
//BTX
enum OperationType
{
COPY=0,
MOVE=1
};
enum FieldLocation
{
DATA_OBJECT=0,
POINT_DATA=1,
CELL_DATA=2
};
//ETX
// Description:
// Add an operation which copies an attribute's field (data array) from
// one field data to another. Returns an operation id which can later
// be used to remove the operation.
int AddOperation(int operationType, int attributeType, int fromFieldLoc,
int toFieldLoc);
// Description:
// Add an operation which copies a field (data array) from one field
// data to another. Returns an operation id which can later
// be used to remove the operation.
int AddOperation(int operationType, const char* name, int fromFieldLoc,
int toFieldLoc);
// Description:
// Helper method used by other language bindings. Allows the caller to
// specify arguments as strings instead of enums.Returns an operation id
// which can later be used to remove the operation.
int AddOperation(const char* operationType, const char* attributeType,
const char* fromFieldLoc, const char* toFieldLoc);
// Description:
// Remove an operation with the given id.
int RemoveOperation(int operationId);
// Description:
// Remove an operation with the given signature. See AddOperation
// for details.
int RemoveOperation(int operationType, int attributeType, int fromFieldLoc,
int toFieldLoc);
// Description:
// Remove an operation with the given signature. See AddOperation
// for details.
int RemoveOperation(int operationType, const char* name, int fromFieldLoc,
int toFieldLoc);
// Description:
// Remove an operation with the given signature. See AddOperation
// for details.
int RemoveOperation(const char* operationType, const char* attributeType,
const char* fromFieldLoc, const char* toFieldLoc);
// Description:
// Remove all operations.
void RemoveAllOperations()
{
this->Modified();
this->LastId = 0;
this->DeleteAllOperations();
}
//BTX
enum FieldType
{
NAME,
ATTRIBUTE
};
struct Operation
{
int OperationType; // COPY or MOVE
int FieldType; // NAME or ATTRIBUTE
char* FieldName;
int AttributeType;
int FromFieldLoc; // fd, pd or do
int ToFieldLoc; // fd, pd or do
int Id; // assigned during creation
Operation* Next; // linked list
Operation() { FieldName = 0; }
~Operation() { delete[] FieldName; }
};
//ETX
protected:
vtkRearrangeFields();
virtual ~vtkRearrangeFields();
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
// Operations are stored as a linked list.
Operation* Head;
Operation* Tail;
// This is incremented whenever a new operation is created.
// It is not decremented when an operation is deleted.
int LastId;
// Methods to browse/modify the linked list.
Operation* GetNextOperation(Operation* op)
{ return op->Next; }
Operation* GetFirst()
{ return this->Head; }
void AddOperation(Operation* op);
void DeleteOperation(Operation* op, Operation* before);
Operation* FindOperation(int id, Operation*& before);
Operation* FindOperation(const char* name, Operation*& before);
Operation* FindOperation(int operationType, const char* name,
int fromFieldLoc, int toFieldLoc,
Operation*& before);
Operation* FindOperation(int operationType, int attributeType,
int fromFieldLoc, int toFieldLoc,
Operation*& before);
// Used when finding/deleting an operation given a signature.
int CompareOperationsByType(const Operation* op1, const Operation* op2);
int CompareOperationsByName(const Operation* op1, const Operation* op2);
void DeleteAllOperations();
void ApplyOperation(Operation* op, vtkDataSet* input, vtkDataSet* output);
// Given location (DATA_OBJECT, CELL_DATA, POINT_DATA) return the
// pointer to the corresponding field data.
vtkFieldData* GetFieldDataFromLocation(vtkDataSet* ds, int fieldLoc);
// Used by AddOperation() and RemoveOperation() designed to be used
// from other language bindings.
static char OperationTypeNames[2][5];
static char FieldLocationNames[3][12];
static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
void PrintAllOperations(ostream& os, vtkIndent indent);
void PrintOperation(Operation* op, ostream& os, vtkIndent indent);
private:
vtkRearrangeFields(const vtkRearrangeFields&); // Not implemented.
void operator=(const vtkRearrangeFields&); // Not implemented.
};
#endif
|