Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkCellTypes.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkCellTypes.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 =========================================================================*/
00038 #ifndef __vtkCellTypes_h
00039 #define __vtkCellTypes_h
00040 
00041 #include "vtkObject.h"
00042 
00043 #include "vtkIntArray.h" // Needed for inline methods
00044 #include "vtkUnsignedCharArray.h" // Needed for inline methods
00045 #include "vtkCellType.h" // Needed for VTK_EMPTY_CELL
00046 
00047 class VTK_FILTERING_EXPORT vtkCellTypes : public vtkObject 
00048 {
00049 public:
00050   static vtkCellTypes *New();
00051   vtkTypeRevisionMacro(vtkCellTypes,vtkObject);
00052   void PrintSelf(ostream& os, vtkIndent indent);
00053 
00055   int Allocate(int sz=512, int ext=1000);
00056 
00058   void InsertCell(int id, unsigned char type, int loc);
00059   
00061   int InsertNextCell(unsigned char type, int loc);
00062 
00064   void SetCellTypes(int ncells, vtkUnsignedCharArray *cellTypes, vtkIntArray *cellLocations);
00065 
00067   int GetCellLocation(int cellId) { return this->LocationArray->GetValue(cellId);};
00068 
00070   void DeleteCell(int cellId) { this->TypeArray->SetValue(cellId, VTK_EMPTY_CELL);};
00071 
00073   int GetNumberOfTypes() { return (this->MaxId + 1);};
00074 
00076   int IsType(unsigned char type);
00077 
00080   int InsertNextType(unsigned char type){return this->InsertNextCell(type,-1);};
00081   
00083   unsigned char GetCellType(int cellId) { return this->TypeArray->GetValue(cellId);};
00084 
00086   void Squeeze();
00087 
00089   void Reset();
00090 
00097   unsigned long GetActualMemorySize();
00098 
00101   void DeepCopy(vtkCellTypes *src);
00102 
00103 protected:
00104   vtkCellTypes();
00105   ~vtkCellTypes();
00106 
00107   vtkUnsignedCharArray *TypeArray; // pointer to types array
00108   vtkIntArray *LocationArray;   // pointer to array of offsets
00109   int Size;            // allocated size of data
00110   int MaxId;           // maximum index inserted thus far
00111   int Extend;          // grow array by this point
00112 private:
00113   vtkCellTypes(const vtkCellTypes&);  // Not implemented.
00114   void operator=(const vtkCellTypes&);    // Not implemented.
00115 };
00116 
00117 
00118 //----------------------------------------------------------------------------
00119 inline int vtkCellTypes::IsType(unsigned char type)
00120 {
00121   int numTypes=this->GetNumberOfTypes();
00122 
00123   for (int i=0; i<numTypes; i++)
00124     {
00125     if ( type == this->GetCellType(i))
00126       {
00127       return 1;
00128       }
00129     }
00130   return 0;
00131 }
00132 
00133 
00134 #endif

Generated on Mon Jan 21 23:07:18 2008 for VTK by  doxygen 1.4.3-20050530