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