VTK  9.6.1
vtkCellTypes.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
26
27#ifndef vtkCellTypes_h
28#define vtkCellTypes_h
29
30#include "vtkCommonDataModelModule.h" // For export macro
31#include "vtkObject.h"
32
33#include "vtkCellType.h" // Needed for inline methods
34#include "vtkCellTypeUtilities.h" // for backward compatibility
35#include "vtkDeprecation.h" // for deprec macros
36#include "vtkIdTypeArray.h" // Needed for inline methods
37#include "vtkSmartPointer.h" // Needed for internals
38#include "vtkUnsignedCharArray.h" // Needed for inline methods
39
40VTK_ABI_NAMESPACE_BEGIN
41class vtkIntArray;
42
43class VTKCOMMONDATAMODEL_EXPORT vtkCellTypes : public vtkObject
44{
45public:
46 static vtkCellTypes* New();
47 vtkTypeMacro(vtkCellTypes, vtkObject);
48 void PrintSelf(ostream& os, vtkIndent indent) override;
49
53 int Allocate(vtkIdType sz = 512, vtkIdType ext = 1000);
54
56
59 VTK_DEPRECATED_IN_9_6_0("Location is not used anymore, use InsertCell(id, type).")
60 void InsertCell(vtkIdType id, unsigned char type, vtkIdType);
61 void InsertCell(vtkIdType id, unsigned char type);
63
65
68 VTK_DEPRECATED_IN_9_6_0("Location is not used anymore, use InsertCell(id, type).")
69 vtkIdType InsertNextCell(unsigned char type, vtkIdType);
70 vtkIdType InsertNextCell(unsigned char type);
72
77
81 void DeleteCell(vtkIdType cellId) { this->TypeArray->SetValue(cellId, VTK_EMPTY_CELL); }
82
86 vtkIdType GetNumberOfTypes() { return (this->MaxId + 1); }
87
91 int IsType(unsigned char type);
92
96 vtkIdType InsertNextType(unsigned char type) { return this->InsertNextCell(type); }
97
101 unsigned char GetCellType(vtkIdType cellId) { return this->TypeArray->GetValue(cellId); }
102
106 void Squeeze();
107
111 void Reset();
112
121 unsigned long GetActualMemorySize();
122
128
133 VTK_DEPRECATED_IN_9_6_0("Use vtkCellTypeUtilities variant instead.")
134 static const char* GetClassNameFromTypeId(int typeId);
135
140 VTK_DEPRECATED_IN_9_6_0("Use vtkCellTypeUtilities variant instead.")
141 static int GetTypeIdFromClassName(const char* classname);
142
149 VTK_DEPRECATED_IN_9_6_0("Use vtkCellTypeUtilities variant instead.")
150 static int IsLinear(unsigned char type);
151
155 VTK_DEPRECATED_IN_9_6_0("Use vtkCellTypeUtilities variant instead.")
156 static int GetDimension(unsigned char type);
157
159
163 VTK_DEPRECATED_IN_9_6_0("Location is not used anymore.")
166
167protected:
169 ~vtkCellTypes() override = default;
170
172
173 // VTK_DEPRECATED_IN_9_6_0
174 vtkNew<vtkIdTypeArray> LocationArray; // pointer to array of offsets
175
176 vtkIdType MaxId; // maximum index inserted thus far
177
178private:
179 vtkCellTypes(const vtkCellTypes&) = delete;
180 void operator=(const vtkCellTypes&) = delete;
181};
182
183//----------------------------------------------------------------------------
184inline int vtkCellTypes::IsType(unsigned char type)
185{
186 vtkIdType numTypes = this->GetNumberOfTypes();
187
188 for (vtkIdType i = 0; i < numTypes; i++)
189 {
190 if (type == this->GetCellType(i))
191 {
192 return 1;
193 }
194 }
195 return 0;
196}
197
198//-----------------------------------------------------------------------------
199inline int vtkCellTypes::IsLinear(unsigned char type)
200{
202}
203
204VTK_ABI_NAMESPACE_END
205#endif
static int IsLinear(unsigned char type)
This convenience method is a fast check to determine if a cell type represents a linear or nonlinear ...
int Allocate(vtkIdType sz=512, vtkIdType ext=1000)
Allocate memory for this array.
vtkIdType MaxId
void SetCellTypes(vtkIdType ncells, vtkUnsignedCharArray *cellTypes)
Specify a group of cell types.
void Squeeze()
Reclaim any extra memory.
void Reset()
Initialize object without releasing memory.
vtkIdType InsertNextType(unsigned char type)
Add the type specified to the end of the list.
~vtkCellTypes() override=default
static vtkCellTypes * New()
vtkIdType InsertNextCell(unsigned char type, vtkIdType)
Add a cell to the object in the next available slot.
static int IsLinear(unsigned char type)
This convenience method is a fast check to determine if a cell type represents a linear or nonlinear ...
unsigned long GetActualMemorySize()
Return the memory in kibibytes (1024 bytes) consumed by this cell type array.
void InsertCell(vtkIdType id, unsigned char type, vtkIdType)
Add a cell at specified id.
vtkIdType GetNumberOfTypes()
Return the number of types in the list.
vtkSmartPointer< vtkUnsignedCharArray > TypeArray
void DeleteCell(vtkIdType cellId)
Delete cell by setting to nullptr cell type.
static const char * GetClassNameFromTypeId(int typeId)
Given an int (as defined in vtkCellType.h) identifier for a class return it's classname.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static int GetDimension(unsigned char type)
Get the dimension of a cell.
vtkNew< vtkIdTypeArray > LocationArray
int IsType(unsigned char type)
Return 1 if type specified is contained in list; 0 otherwise.
unsigned char GetCellType(vtkIdType cellId)
Return the type of cell.
void DeepCopy(vtkCellTypes *src)
Standard DeepCopy method.
static int GetTypeIdFromClassName(const char *classname)
Given a data object classname, return it's int identified (as defined in vtkCellType....
vtkUnsignedCharArray * GetCellTypesArray()
Methods for obtaining the arrays representing types and locations.
vtkIdTypeArray * GetCellLocationsArray()
Methods for obtaining the arrays representing types and locations.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:29
dynamic, self-adjusting array of int
Definition vtkIntArray.h:35
Allocate and hold a VTK object.
Definition vtkNew.h:58
Hold a reference to a vtkObjectBase instance.
dynamic, self-adjusting array of unsigned char
int GetCellType() override
Implement the vtkCell API.
@ VTK_EMPTY_CELL
Definition vtkCellType.h:36
#define VTK_DEPRECATED_IN_9_6_0(reason)
int vtkIdType
Definition vtkType.h:368