vtkCellTypes.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00048 #ifndef __vtkCellTypes_h
00049 #define __vtkCellTypes_h
00050
00051 #include "vtkObject.h"
00052
00053 #include "vtkIntArray.h"
00054 #include "vtkUnsignedCharArray.h"
00055 #include "vtkCellType.h"
00056
00057 class VTK_FILTERING_EXPORT vtkCellTypes : public vtkObject
00058 {
00059 public:
00060 static vtkCellTypes *New();
00061 vtkTypeRevisionMacro(vtkCellTypes,vtkObject);
00062 void PrintSelf(ostream& os, vtkIndent indent);
00063
00065 int Allocate(int sz=512, int ext=1000);
00066
00068 void InsertCell(int id, unsigned char type, int loc);
00069
00071 int InsertNextCell(unsigned char type, int loc);
00072
00074 void SetCellTypes(int ncells, vtkUnsignedCharArray *cellTypes, vtkIntArray *cellLocations);
00075
00077 int GetCellLocation(int cellId) { return this->LocationArray->GetValue(cellId);};
00078
00080 void DeleteCell(int cellId) { this->TypeArray->SetValue(cellId, VTK_EMPTY_CELL);};
00081
00083 int GetNumberOfTypes() { return (this->MaxId + 1);};
00084
00086 int IsType(unsigned char type);
00087
00090 int InsertNextType(unsigned char type){return this->InsertNextCell(type,-1);};
00091
00093 unsigned char GetCellType(int cellId) { return this->TypeArray->GetValue(cellId);};
00094
00096 void Squeeze();
00097
00099 void Reset();
00100
00107 unsigned long GetActualMemorySize();
00108
00111 void DeepCopy(vtkCellTypes *src);
00112
00113 protected:
00114 vtkCellTypes();
00115 ~vtkCellTypes();
00116
00117 vtkUnsignedCharArray *TypeArray;
00118 vtkIntArray *LocationArray;
00119 int Size;
00120 int MaxId;
00121 int Extend;
00122 private:
00123 vtkCellTypes(const vtkCellTypes&);
00124 void operator=(const vtkCellTypes&);
00125 };
00126
00127
00128
00129 inline int vtkCellTypes::IsType(unsigned char type)
00130 {
00131 int numTypes=this->GetNumberOfTypes();
00132
00133 for (int i=0; i<numTypes; i++)
00134 {
00135 if ( type == this->GetCellType(i))
00136 {
00137 return 1;
00138 }
00139 }
00140 return 0;
00141 }
00142
00143
00144 #endif