00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00041 #ifndef __vtkCellTypes_h
00042 #define __vtkCellTypes_h
00043
00044 #include "vtkObject.h"
00045
00046 #include "vtkIntArray.h"
00047 #include "vtkUnsignedCharArray.h"
00048 #include "vtkCellType.h"
00049
00050 class VTK_FILTERING_EXPORT vtkCellTypes : public vtkObject
00051 {
00052 public:
00053 static vtkCellTypes *New();
00054 vtkTypeMacro(vtkCellTypes,vtkObject);
00055 void PrintSelf(ostream& os, vtkIndent indent);
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(vtkIdType 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
00108 static const char* GetClassNameFromTypeId(int typeId);
00109
00112 static int GetTypeIdFromClassName(const char* classname);
00113
00114 protected:
00115 vtkCellTypes();
00116 ~vtkCellTypes();
00117
00118 vtkUnsignedCharArray *TypeArray;
00119 vtkIntArray *LocationArray;
00120 int Size;
00121 int MaxId;
00122 int Extend;
00123 private:
00124 vtkCellTypes(const vtkCellTypes&);
00125 void operator=(const vtkCellTypes&);
00126 };
00127
00128
00129
00130 inline int vtkCellTypes::IsType(unsigned char type)
00131 {
00132 int numTypes=this->GetNumberOfTypes();
00133
00134 for (int i=0; i<numTypes; i++)
00135 {
00136 if ( type == this->GetCellType(i))
00137 {
00138 return 1;
00139 }
00140 }
00141 return 0;
00142 }
00143
00144
00145 #endif