• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Filtering/vtkDataSetAttributes.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDataSetAttributes.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00046 #ifndef __vtkDataSetAttributes_h
00047 #define __vtkDataSetAttributes_h
00048 
00049 #include "vtkFieldData.h"
00050 
00051 class vtkLookupTable;
00052 
00053 class VTK_FILTERING_EXPORT vtkDataSetAttributes : public vtkFieldData
00054 {
00055 public:
00057   static vtkDataSetAttributes *New();
00058   
00059   vtkTypeRevisionMacro(vtkDataSetAttributes,vtkFieldData);
00060   void PrintSelf(ostream& os, vtkIndent indent);
00061 
00064   virtual void Initialize();
00065 
00068   virtual void Update() {}
00069 
00070   // -- shallow and deep copy -----------------------------------------------
00071 
00074   virtual void DeepCopy(vtkFieldData *pd);
00075 
00078   virtual void ShallowCopy(vtkFieldData *pd);
00079 
00080   // -- attribute types -----------------------------------------------------
00081 //BTX
00082   // Always keep NUM_ATTRIBUTES as the last entry
00083   enum AttributeTypes 
00084   {
00085     SCALARS=0,
00086     VECTORS=1,
00087     NORMALS=2,
00088     TCOORDS=3,
00089     TENSORS=4,
00090     GLOBALIDS=5,
00091     PEDIGREEIDS=6,
00092     NUM_ATTRIBUTES
00093   };
00094 
00095   enum AttributeLimitTypes 
00096   {
00097     MAX, 
00098     EXACT, 
00099     NOLIMIT
00100   };
00101 //ETX
00102 
00104 
00105   int SetScalars(vtkDataArray* da);
00106   int SetActiveScalars(const char* name);
00107   vtkDataArray* GetScalars();
00109 
00111 
00112   int SetVectors(vtkDataArray* da);
00113   int SetActiveVectors(const char* name);
00114   vtkDataArray* GetVectors();
00116 
00118 
00119   int SetNormals(vtkDataArray* da);
00120   int SetActiveNormals(const char* name);
00121   vtkDataArray* GetNormals();
00123 
00125 
00126   int SetTCoords(vtkDataArray* da);
00127   int SetActiveTCoords(const char* name);
00128   vtkDataArray* GetTCoords();
00130 
00132 
00133   int SetTensors(vtkDataArray* da);
00134   int SetActiveTensors(const char* name);
00135   vtkDataArray* GetTensors();
00137 
00139 
00140   int SetGlobalIds(vtkDataArray* da);
00141   int SetActiveGlobalIds(const char* name);
00142   vtkDataArray* GetGlobalIds();
00144 
00146 
00147   int SetPedigreeIds(vtkAbstractArray* da);
00148   int SetActivePedigreeIds(const char* name);
00149   vtkAbstractArray* GetPedigreeIds();
00151 
00153 
00156   vtkDataArray* GetScalars(const char* name);
00157   vtkDataArray* GetVectors(const char* name);
00158   vtkDataArray* GetNormals(const char* name);
00159   vtkDataArray* GetTCoords(const char* name);
00160   vtkDataArray* GetTensors(const char* name);
00161   vtkDataArray* GetGlobalIds(const char* name);
00162   vtkAbstractArray* GetPedigreeIds(const char* name);
00164 
00172   int SetActiveAttribute(const char* name, int attributeType);
00173 
00175   int SetActiveAttribute(int index, int attributeType);
00176 
00179   void GetAttributeIndices(int* indexArray);
00180 
00185   int IsArrayAnAttribute(int idx);
00186 
00191   vtkDataArray* GetAttribute(int attributeType);
00192 
00198   vtkAbstractArray* GetAbstractAttribute(int attributeType);
00199 
00201   virtual void RemoveArray(const char *name);
00202 
00204 
00206   static const char* GetAttributeTypeAsString(int attributeType);
00207   static const char* GetLongAttributeTypeAsString(int attributeType);
00209 
00210   // -- attribute copy properties ------------------------------------------
00211 
00212 //BTX
00213   enum AttributeCopyOperations
00214   {
00215     COPYTUPLE=0,
00216     INTERPOLATE=1,
00217     PASSDATA=2,
00218     ALLCOPY  //all of the above
00219   };
00220 //ETX
00221 
00226   void SetCopyAttribute (int index, int value, int ctype=ALLCOPY);
00227 
00229 
00240   void SetCopyScalars(int i, int ctype=ALLCOPY);
00241   int GetCopyScalars(int ctype=ALLCOPY);
00242   vtkBooleanMacro(CopyScalars, int);
00244 
00246 
00257   void SetCopyVectors(int i, int ctype=ALLCOPY);
00258   int GetCopyVectors(int ctype=ALLCOPY);
00259   vtkBooleanMacro(CopyVectors, int);
00261 
00263 
00274   void SetCopyNormals(int i, int ctype=ALLCOPY);
00275   int GetCopyNormals(int ctype=ALLCOPY);
00276   vtkBooleanMacro(CopyNormals, int);
00278 
00280 
00291   void SetCopyTCoords(int i, int ctype=ALLCOPY);
00292   int GetCopyTCoords(int ctype=ALLCOPY);
00293   vtkBooleanMacro(CopyTCoords, int);
00295 
00297 
00308   void SetCopyTensors(int i, int ctype=ALLCOPY);
00309   int GetCopyTensors(int ctype=ALLCOPY);
00310   vtkBooleanMacro(CopyTensors, int);
00312 
00314 
00325   void SetCopyGlobalIds(int i, int ctype=ALLCOPY);
00326   int GetCopyGlobalIds(int ctype=ALLCOPY);
00327   vtkBooleanMacro(CopyGlobalIds, int);
00329 
00331 
00342   void SetCopyPedigreeIds(int i, int ctype=ALLCOPY);
00343   int GetCopyPedigreeIds(int ctype=ALLCOPY);
00344   vtkBooleanMacro(CopyPedigreeIds, int);
00346 
00358   virtual void CopyAllOn(int ctype=ALLCOPY);
00359 
00371   virtual void CopyAllOff(int ctype=ALLCOPY);
00372 
00373   // -- passthrough operations ----------------------------------------------
00374 
00382   virtual void PassData(vtkFieldData* fd);
00383 
00384   // -- copytuple operations ------------------------------------------------
00385 
00387 
00395   void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00396                     vtkIdType ext=1000)
00397     {
00398       this->CopyAllocate(pd, sze, ext, 0);
00399     }
00400   void CopyAllocate(vtkDataSetAttributes* pd, vtkIdType sze,
00401                     vtkIdType ext, int shallowCopyArrays);
00403 
00405 
00407   void CopyStructuredData(vtkDataSetAttributes *inDsa,
00408                           const int *inExt, const int *outExt);
00410 
00418   void CopyData(vtkDataSetAttributes *fromPd, vtkIdType fromId, vtkIdType toId);
00419 
00420 
00422 
00426   void CopyTuple(vtkAbstractArray *fromData, vtkAbstractArray *toData, 
00427                  vtkIdType fromId, vtkIdType toId);
00429 
00430 
00431   // -- interpolate operations ----------------------------------------------
00432 
00434 
00439   void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze=0,
00440                            vtkIdType ext=1000)
00441     {
00442       this->InterpolateAllocate(pd, sze, ext, 0);
00443     }
00444   void InterpolateAllocate(vtkDataSetAttributes* pd, vtkIdType sze,
00445                            vtkIdType ext, int shallowCopyArrays);
00447   
00449 
00454   void InterpolatePoint(vtkDataSetAttributes *fromPd, vtkIdType toId, 
00455                         vtkIdList *ids, double *weights);
00457   
00459 
00466   void InterpolateEdge(vtkDataSetAttributes *fromPd, vtkIdType toId,
00467                        vtkIdType p1, vtkIdType p2, double t);
00469 
00471 
00481   void InterpolateTime(vtkDataSetAttributes *from1, 
00482                        vtkDataSetAttributes *from2,
00483                        vtkIdType id, double t);
00485 
00486 //BTX
00487   class FieldList;
00488 
00489   // field list copy operations ------------------------------------------
00490 
00492 
00494   void CopyAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0, 
00495                     vtkIdType ext=1000);
00497 
00499 
00503   void CopyData(vtkDataSetAttributes::FieldList& list, 
00504                 vtkDataSetAttributes* dsa, int idx, vtkIdType fromId,
00505                 vtkIdType toId);
00507 
00509 
00514   void InterpolateAllocate(vtkDataSetAttributes::FieldList& list, vtkIdType sze=0, 
00515                     vtkIdType ext=1000);
00517 
00519 
00523   void InterpolatePoint(
00524     vtkDataSetAttributes::FieldList& list,
00525     vtkDataSetAttributes *fromPd,
00526     int idx, vtkIdType toId, 
00527     vtkIdList *ids, double *weights);
00529 
00530   friend class vtkDataSetAttributes::FieldList;
00531 //ETX
00532 
00533 //BTX
00534 protected:
00535   vtkDataSetAttributes();
00536   ~vtkDataSetAttributes();
00537 
00538   void InternalCopyAllocate(vtkDataSetAttributes* pd, 
00539                             int ctype,
00540                             vtkIdType sze=0,
00541                             vtkIdType ext=1000,
00542                             int shallowCopyArrays=0);
00543 
00544   void InternalCopyAllocate(
00545     vtkDataSetAttributes::FieldList& list,
00546     int ctype,
00547     vtkIdType sze, vtkIdType ext);
00548 
00550   virtual void InitializeFields();
00551 
00552   int AttributeIndices[NUM_ATTRIBUTES]; //index to attribute array in field data
00553   int CopyAttributeFlags[ALLCOPY][NUM_ATTRIBUTES]; //copy flag for attribute data
00554 
00555   vtkFieldData::BasicIterator RequiredArrays;
00556 
00557   int* TargetIndices;
00558 
00559   virtual void RemoveArray(int index);
00560 
00561   static const int NumberOfAttributeComponents[NUM_ATTRIBUTES];
00562   static const int AttributeLimits[NUM_ATTRIBUTES];
00563   static const char AttributeNames[NUM_ATTRIBUTES][12];
00564   static const char LongAttributeNames[NUM_ATTRIBUTES][35];
00565 
00566 private:
00567   int SetAttribute(vtkAbstractArray* da, int attributeType);
00568   static int CheckNumberOfComponents(vtkAbstractArray* da, int attributeType);
00569 
00570   vtkFieldData::BasicIterator  ComputeRequiredArrays(vtkDataSetAttributes* pd, int ctype);
00571 
00572 private:
00573   vtkDataSetAttributes(const vtkDataSetAttributes&);  // Not implemented.
00574   void operator=(const vtkDataSetAttributes&);  // Not implemented.
00575 
00576 public:
00577   // This public class is used to perform set operations, other misc. 
00578   // operations on fields. For example, vtkAppendFilter uses it to 
00579   // determine which attributes the input datasets share in common.
00580   class VTK_FILTERING_EXPORT FieldList
00581   {
00582   public:
00583     FieldList(int numInputs);
00584     ~FieldList();
00585     void PrintSelf(ostream &os, vtkIndent indent);
00586 
00587     void InitializeFieldList(vtkDataSetAttributes* dsa);
00588     void IntersectFieldList(vtkDataSetAttributes* dsa);
00589 
00590     //Determine whether data is available
00591     int IsAttributePresent(int attrType); //true/false attributes specified
00592     
00593     // Accessor methods.
00594     int GetNumberOfFields() { return this->NumberOfFields; }
00595     int GetFieldIndex(int i) { return this->FieldIndices[i]; }
00596     int GetDSAIndex(int index, int i) { return this->DSAIndices[index][i]; }
00597     
00598     friend class vtkDataSetAttributes;
00599 
00600   protected:
00601     FieldList(const FieldList&) {} //prevent these methods from being used
00602     void operator=(const FieldList&) {}
00603 
00604   private:
00605     void SetField(int index, vtkAbstractArray *da);
00606     void RemoveField(const char *name);
00607     void ClearFields();
00608 
00609     int NumberOfFields; //the number of fields (including five named attributes)
00610     // These keep track of what is common across datasets. The first
00611     // five items are always named attributes.
00612     char** Fields;                     // the names of the fields
00613     int *FieldTypes;                   // the types of the fields
00614     int *FieldComponents;              // the number of components in field
00615     int *FieldIndices;                 // output data array index
00616     vtkLookupTable **LUT;              // luts associated with each array
00617     vtkInformation **FieldInformation; // Information map associated with each array
00618 
00619     vtkIdType NumberOfTuples; // a running total of values
00620 
00621     //For every vtkDataSetAttributes that are processed, keep track of the 
00622     //indices into various things. The indices are organized so that the
00623     //first NUM_ATTRIBUTES refer to attributes, the next refer to the 
00624     //non-attribute fields, for a total of NUM_ATTRIBUTES + NumberOfFields.
00625     //CurrentInput is the current input being processed.
00626     int **DSAIndices;
00627     int NumberOfDSAIndices;
00628     int CurrentInput;
00629   };
00630 
00631 //ETX
00632 };
00633 
00634 #endif
00635 
00636 

Generated by  doxygen 1.7.1