00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00065 #ifndef __vtkCellTypes_h
00066 #define __vtkCellTypes_h
00067
00068 #include "vtkObject.h"
00069 #include "vtkCellType.h"
00070 #include "vtkIntArray.h"
00071 #include "vtkUnsignedCharArray.h"
00072
00073
00074 class VTK_COMMON_EXPORT vtkCellTypes : public vtkObject
00075 {
00076 public:
00077 static vtkCellTypes *New();
00078 vtkTypeMacro(vtkCellTypes,vtkObject);
00079
00081 int Allocate(int sz=512, int ext=1000);
00082
00084 void InsertCell(int id, unsigned char type, int loc);
00085
00087 int InsertNextCell(unsigned char type, int loc);
00088
00090 void SetCellTypes(int ncells, vtkUnsignedCharArray *cellTypes, vtkIntArray *cellLocations);
00091
00093 int GetCellLocation(int cellId) { return this->LocationArray->GetValue(cellId);};
00094
00096 void DeleteCell(int cellId) { this->TypeArray->SetValue(cellId, VTK_EMPTY_CELL);};
00097
00099 int GetNumberOfTypes() { return (this->MaxId + 1);};
00100
00102 int IsType(unsigned char type);
00103
00106 int InsertNextType(unsigned char type){return this->InsertNextCell(type,-1);};
00107
00109 unsigned char GetCellType(int cellId) { return this->TypeArray->GetValue(cellId);};
00110
00112 void Squeeze();
00113
00115 void Reset();
00116
00123 unsigned long GetActualMemorySize();
00124
00127 void DeepCopy(vtkCellTypes *src);
00128
00129 protected:
00130 vtkCellTypes();
00131 ~vtkCellTypes();
00132
00133 vtkUnsignedCharArray *TypeArray;
00134 vtkIntArray *LocationArray;
00135 int Size;
00136 int MaxId;
00137 int Extend;
00138 private:
00139 vtkCellTypes(const vtkCellTypes&);
00140 void operator=(const vtkCellTypes&);
00141 };
00142
00143
00144
00145 inline int vtkCellTypes::IsType(unsigned char type)
00146 {
00147 int numTypes=this->GetNumberOfTypes();
00148
00149 for (int i=0; i<numTypes; i++)
00150 {
00151 if ( type == this->GetCellType(i))
00152 {
00153 return 1;
00154 }
00155 }
00156 return 0;
00157 }
00158
00159
00160 #endif