Common/vtkCellTypes.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00042 #ifndef __vtkCellTypes_h
00043 #define __vtkCellTypes_h
00044
00045 #include "vtkObject.h"
00046
00047 #include "vtkIntArray.h"
00048 #include "vtkUnsignedCharArray.h"
00049 #include "vtkCellType.h"
00050
00051 class VTK_COMMON_EXPORT vtkCellTypes : public vtkObject
00052 {
00053 public:
00054 static vtkCellTypes *New();
00055 vtkTypeRevisionMacro(vtkCellTypes,vtkObject);
00056
00058 int Allocate(int sz=512, int ext=1000);
00059
00061 void InsertCell(int id, unsigned char type, int loc);
00062
00064 int InsertNextCell(unsigned char type, int loc);
00065
00067 void SetCellTypes(int ncells, vtkUnsignedCharArray *cellTypes, vtkIntArray *cellLocations);
00068
00070 int GetCellLocation(int cellId) { return this->LocationArray->GetValue(cellId);};
00071
00073 void DeleteCell(int cellId) { this->TypeArray->SetValue(cellId, VTK_EMPTY_CELL);};
00074
00076 int GetNumberOfTypes() { return (this->MaxId + 1);};
00077
00079 int IsType(unsigned char type);
00080
00083 int InsertNextType(unsigned char type){return this->InsertNextCell(type,-1);};
00084
00086 unsigned char GetCellType(int cellId) { return this->TypeArray->GetValue(cellId);};
00087
00089 void Squeeze();
00090
00092 void Reset();
00093
00100 unsigned long GetActualMemorySize();
00101
00104 void DeepCopy(vtkCellTypes *src);
00105
00106 protected:
00107 vtkCellTypes();
00108 ~vtkCellTypes();
00109
00110 vtkUnsignedCharArray *TypeArray;
00111 vtkIntArray *LocationArray;
00112 int Size;
00113 int MaxId;
00114 int Extend;
00115 private:
00116 vtkCellTypes(const vtkCellTypes&);
00117 void operator=(const vtkCellTypes&);
00118 };
00119
00120
00121
00122 inline int vtkCellTypes::IsType(unsigned char type)
00123 {
00124 int numTypes=this->GetNumberOfTypes();
00125
00126 for (int i=0; i<numTypes; i++)
00127 {
00128 if ( type == this->GetCellType(i))
00129 {
00130 return 1;
00131 }
00132 }
00133 return 0;
00134 }
00135
00136
00137 #endif