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
00055 #ifndef __vtkCellTypes_h
00056 #define __vtkCellTypes_h
00057
00058 #include "vtkObject.h"
00059
00060 #include "vtkIntArray.h"
00061 #include "vtkUnsignedCharArray.h"
00062 #include "vtkCellType.h"
00063
00064 class VTK_COMMON_EXPORT vtkCellTypes : public vtkObject
00065 {
00066 public:
00067 static vtkCellTypes *New();
00068 vtkTypeRevisionMacro(vtkCellTypes,vtkObject);
00069
00071 int Allocate(int sz=512, int ext=1000);
00072
00074 void InsertCell(int id, unsigned char type, int loc);
00075
00077 int InsertNextCell(unsigned char type, int loc);
00078
00080 void SetCellTypes(int ncells, vtkUnsignedCharArray *cellTypes, vtkIntArray *cellLocations);
00081
00083 int GetCellLocation(int cellId) { return this->LocationArray->GetValue(cellId);};
00084
00086 void DeleteCell(int cellId) { this->TypeArray->SetValue(cellId, VTK_EMPTY_CELL);};
00087
00089 int GetNumberOfTypes() { return (this->MaxId + 1);};
00090
00092 int IsType(unsigned char type);
00093
00096 int InsertNextType(unsigned char type){return this->InsertNextCell(type,-1);};
00097
00099 unsigned char GetCellType(int cellId) { return this->TypeArray->GetValue(cellId);};
00100
00102 void Squeeze();
00103
00105 void Reset();
00106
00113 unsigned long GetActualMemorySize();
00114
00117 void DeepCopy(vtkCellTypes *src);
00118
00119 protected:
00120 vtkCellTypes();
00121 ~vtkCellTypes();
00122
00123 vtkUnsignedCharArray *TypeArray;
00124 vtkIntArray *LocationArray;
00125 int Size;
00126 int MaxId;
00127 int Extend;
00128 private:
00129 vtkCellTypes(const vtkCellTypes&);
00130 void operator=(const vtkCellTypes&);
00131 };
00132
00133
00134
00135 inline int vtkCellTypes::IsType(unsigned char type)
00136 {
00137 int numTypes=this->GetNumberOfTypes();
00138
00139 for (int i=0; i<numTypes; i++)
00140 {
00141 if ( type == this->GetCellType(i))
00142 {
00143 return 1;
00144 }
00145 }
00146 return 0;
00147 }
00148
00149
00150 #endif