VTK  9.5.20251009
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
116#ifndef vtkCellTypes_h
117#define vtkCellTypes_h
118
119#include "vtkCommonDataModelModule.h" // For export macro
120#include "vtkObject.h"
121
122#include "vtkCellType.h" // Needed for inline methods
123#include "vtkCellTypeUtilities.h" // for backward compatibility
124#include "vtkDeprecation.h" // for deprec macros
125#include "vtkIdTypeArray.h" // Needed for inline methods
126#include "vtkSmartPointer.h" // Needed for internals
127#include "vtkUnsignedCharArray.h" // Needed for inline methods
128
129VTK_ABI_NAMESPACE_BEGIN
130class vtkIntArray;
131
132class VTKCOMMONDATAMODEL_EXPORT vtkCellTypes : public vtkObject
133{
134public:
135 static vtkCellTypes* New();
136 vtkTypeMacro(vtkCellTypes, vtkObject);
137 void PrintSelf(ostream& os, vtkIndent indent) override;
138
142 int Allocate(vtkIdType sz = 512, vtkIdType ext = 1000);
143
145
148 VTK_DEPRECATED_IN_9_6_0("Location is not used anymore, use InsertCell(id, type).")
149 void InsertCell(vtkIdType id, unsigned char type, vtkIdType);
150 void InsertCell(vtkIdType id, unsigned char type);
152
154
157 VTK_DEPRECATED_IN_9_6_0("Location is not used anymore, use InsertCell(id, type).")
158 vtkIdType InsertNextCell(unsigned char type, vtkIdType);
159 vtkIdType InsertNextCell(unsigned char type);
161
165 void SetCellTypes(vtkIdType ncells, vtkUnsignedCharArray* cellTypes);
166
170 void DeleteCell(vtkIdType cellId) { this->TypeArray->SetValue(cellId, VTK_EMPTY_CELL); }
171
175 vtkIdType GetNumberOfTypes() { return (this->MaxId + 1); }
176
180 int IsType(unsigned char type);
181
185 vtkIdType InsertNextType(unsigned char type) { return this->InsertNextCell(type); }
186
190 unsigned char GetCellType(vtkIdType cellId) { return this->TypeArray->GetValue(cellId); }
191
195 void Squeeze();
196
200 void Reset();
201
210 unsigned long GetActualMemorySize();
211
217
222 VTK_DEPRECATED_IN_9_6_0("Use vtkCellTypeUtilities variant instead.")
223 static const char* GetClassNameFromTypeId(int typeId);
224
229 VTK_DEPRECATED_IN_9_6_0("Use vtkCellTypeUtilities variant instead.")
230 static int GetTypeIdFromClassName(const char* classname);
231
238 VTK_DEPRECATED_IN_9_6_0("Use vtkCellTypeUtilities variant instead.")
239 static int IsLinear(unsigned char type);
240
244 VTK_DEPRECATED_IN_9_6_0("Use vtkCellTypeUtilities variant instead.")
245 static int GetDimension(unsigned char type);
246
248
251 vtkUnsignedCharArray* GetCellTypesArray() { return this->TypeArray; }
252 VTK_DEPRECATED_IN_9_6_0("Location is not used anymore.")
253 vtkIdTypeArray* GetCellLocationsArray() { return this->LocationArray; }
255
256protected:
258 ~vtkCellTypes() override = default;
259
261
262 // VTK_DEPRECATED_IN_9_6_0
263 vtkNew<vtkIdTypeArray> LocationArray; // pointer to array of offsets
264
265 vtkIdType MaxId; // maximum index inserted thus far
266
267private:
268 vtkCellTypes(const vtkCellTypes&) = delete;
269 void operator=(const vtkCellTypes&) = delete;
270};
271
272//----------------------------------------------------------------------------
273inline int vtkCellTypes::IsType(unsigned char type)
274{
275 vtkIdType numTypes = this->GetNumberOfTypes();
276
277 for (vtkIdType i = 0; i < numTypes; i++)
278 {
279 if (type == this->GetCellType(i))
280 {
281 return 1;
282 }
283 }
284 return 0;
285}
286
287//-----------------------------------------------------------------------------
288inline int vtkCellTypes::IsLinear(unsigned char type)
289{
291}
292
293VTK_ABI_NAMESPACE_END
294#endif
vtkCellTypeUtilities is a collection of methods for cell type lookup.
static int IsLinear(unsigned char type)
This convenience method is a fast check to determine if a cell type represents a linear or nonlinear ...
object provides direct access to cells in vtkCellArray and type information
int Allocate(vtkIdType sz=512, vtkIdType ext=1000)
Allocate memory for this array.
vtkIdType MaxId
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()
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.
vtkIdType GetNumberOfTypes()
Return the number of types in the list.
vtkSmartPointer< vtkUnsignedCharArray > TypeArray
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
dynamic, self-adjusting array of int
Allocate and hold a VTK object.
Definition vtkNew.h:167
abstract base class for most VTK objects
Definition vtkObject.h:162
Hold a reference to a vtkObjectBase instance.
dynamic, self-adjusting array of unsigned char
@ VTK_EMPTY_CELL
Definition vtkCellType.h:36
#define VTK_DEPRECATED_IN_9_6_0(reason)
int vtkIdType
Definition vtkType.h:367