VTK  9.1.0
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
vtkCellArray Class Reference

object to represent cell connectivity More...

#include <vtkCellArray.h>

Inheritance diagram for vtkCellArray:
[legend]
Collaboration diagram for vtkCellArray:
[legend]

Classes

struct  Storage
 
struct  VisitState
 

Public Types

using ArrayType32 = vtkTypeInt32Array
 
using ArrayType64 = vtkTypeInt64Array
 
using StorageArrayList = vtkTypeList::Create< ArrayType32, ArrayType64 >
 List of possible array types used for storage.
 
using InputArrayList = typename vtkTypeList::Unique< vtkTypeList::Create< vtkAOSDataArrayTemplate< int >, vtkAOSDataArrayTemplate< long >, vtkAOSDataArrayTemplate< long long > > >::Result
 List of possible ArrayTypes that are compatible with internal storage.
 

Public Member Functions

vtkTypeBool Allocate (vtkIdType sz, vtkIdType vtkNotUsed(ext)=1000)
 Allocate memory.
 
bool AllocateEstimate (vtkIdType numCells, vtkIdType maxCellSize)
 Pre-allocate memory in internal data structures.
 
bool AllocateExact (vtkIdType numCells, vtkIdType connectivitySize)
 Pre-allocate memory in internal data structures.
 
bool AllocateCopy (vtkCellArray *other)
 Pre-allocate memory in internal data structures to match the used size of the input vtkCellArray.
 
bool ResizeExact (vtkIdType numCells, vtkIdType connectivitySize)
 ResizeExact() resizes the internal structures to hold numCells total cell offsets and connectivitySize total pointIds.
 
void Initialize ()
 Free any memory and reset to an empty state.
 
void Reset ()
 Reuse list.
 
void Squeeze ()
 Reclaim any extra memory while preserving data.
 
bool IsValid ()
 Check that internal storage is consistent and in a valid state.
 
vtkIdType GetNumberOfCells () const
 Get the number of cells in the array.
 
vtkIdType GetNumberOfOffsets () const
 Get the number of elements in the offsets array.
 
vtkIdType GetNumberOfConnectivityIds () const
 Get the size of the connectivity array that stores the point ids.
 
vtkCellArrayIteratorNewIterator ()
 NewIterator returns a new instance of vtkCellArrayIterator that is initialized to point at the first cell's data.
 
bool SetData (vtkDataArray *offsets, vtkDataArray *connectivity)
 Sets the internal arrays to the supplied offsets and connectivity arrays.
 
bool SetData (vtkIdType cellSize, vtkDataArray *connectivity)
 Sets the internal arrays to the supported connectivity array with an offsets array automatically generated given the fixed cells size.
 
bool IsStorage64Bit () const
 
bool IsStorageShareable () const
 
vtkIdType IsHomogeneous ()
 Check if all cells have the same number of vertices.
 
void InitTraversal ()
 
int GetNextCell (vtkIdType &npts, vtkIdType const *&pts)
 
int GetNextCell (vtkIdList *pts)
 
void GetCellAtId (vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints)
 Return the point ids for the cell at cellId.
 
void GetCellAtId (vtkIdType cellId, vtkIdList *pts)
 Return the point ids for the cell at cellId.
 
vtkIdType GetCellSize (const vtkIdType cellId) const
 Return the size of the cell at cellId.
 
vtkIdType InsertNextCell (vtkCell *cell)
 Insert a cell object.
 
vtkIdType InsertNextCell (vtkIdType npts, const vtkIdType *pts)
 Create a cell by specifying the number of points and an array of point id's.
 
vtkIdType InsertNextCell (vtkIdList *pts)
 Create a cell by specifying a list of point ids.
 
vtkIdType InsertNextCell (const std::initializer_list< vtkIdType > &cell)
 Overload that allows InsertNextCell({0, 1, 2}) syntax.
 
vtkIdType InsertNextCell (int npts)
 Create cells by specifying a count of total points to be inserted, and then adding points one at a time using method InsertCellPoint().
 
void InsertCellPoint (vtkIdType id)
 Used in conjunction with InsertNextCell(npts) to add another point to the list of cells.
 
void UpdateCellCount (int npts)
 Used in conjunction with InsertNextCell(int npts) and InsertCellPoint() to update the number of points defining the cell.
 
void ReverseCellAtId (vtkIdType cellId)
 Reverses the order of the point ids for the specified cell.
 
void ReplaceCellAtId (vtkIdType cellId, const std::initializer_list< vtkIdType > &cell)
 Overload that allows ReplaceCellAtId(cellId, {0, 1, 2}) syntax.
 
int GetMaxCellSize ()
 Returns the size of the largest cell.
 
void DeepCopy (vtkCellArray *ca)
 Perform a deep copy (no reference counting) of the given cell array.
 
void ShallowCopy (vtkCellArray *ca)
 Shallow copy ca into this cell array.
 
void Append (vtkCellArray *src, vtkIdType pointOffset=0)
 Append cells from src into this.
 
void ExportLegacyFormat (vtkIdTypeArray *data)
 Fill data with the old-style vtkCellArray data layout, e.g.
 
unsigned long GetActualMemorySize () const
 Return the memory in kibibytes (1024 bytes) consumed by this cell array.
 
virtual void SetNumberOfCells (vtkIdType)
 Set the number of cells in the array.
 
vtkIdType EstimateSize (vtkIdType numCells, int maxPtsPerCell)
 Utility routines help manage memory of cell array.
 
vtkIdType GetSize ()
 Get the size of the allocated connectivity array.
 
vtkIdType GetNumberOfConnectivityEntries ()
 Return the size of the array that would be returned from ExportLegacyFormat().
 
void GetCell (vtkIdType loc, vtkIdType &npts, const vtkIdType *&pts)
 Internal method used to retrieve a cell given a legacy offset location.
 
void GetCell (vtkIdType loc, vtkIdList *pts)
 Internal method used to retrieve a cell given a legacy offset location.
 
vtkIdType GetInsertLocation (int npts)
 Computes the current legacy insertion location within the internal array.
 
void ReverseCell (vtkIdType loc)
 Special method inverts ordering of cell at the specified legacy location.
 
void ReplaceCell (vtkIdType loc, int npts, const vtkIdType pts[])
 Replace the point ids of the cell at the legacy location with a different list of point ids.
 
void SetCells (vtkIdType ncells, vtkIdTypeArray *cells)
 Define multiple cells by providing a connectivity list.
 
vtkIdTypeArrayGetData ()
 Return the underlying data as a data array.
 
void SetData (vtkTypeInt32Array *offsets, vtkTypeInt32Array *connectivity)
 Set the internal data arrays to the supplied offsets and connectivity arrays.
 
void SetData (vtkTypeInt64Array *offsets, vtkTypeInt64Array *connectivity)
 Set the internal data arrays to the supplied offsets and connectivity arrays.
 
void SetData (vtkIdTypeArray *offsets, vtkIdTypeArray *connectivity)
 Set the internal data arrays to the supplied offsets and connectivity arrays.
 
void SetData (vtkAOSDataArrayTemplate< int > *offsets, vtkAOSDataArrayTemplate< int > *connectivity)
 Set the internal data arrays to the supplied offsets and connectivity arrays.
 
void SetData (vtkAOSDataArrayTemplate< long > *offsets, vtkAOSDataArrayTemplate< long > *connectivity)
 Set the internal data arrays to the supplied offsets and connectivity arrays.
 
void SetData (vtkAOSDataArrayTemplate< long long > *offsets, vtkAOSDataArrayTemplate< long long > *connectivity)
 Set the internal data arrays to the supplied offsets and connectivity arrays.
 
void Use32BitStorage ()
 Initialize internal data structures to use 32- or 64-bit storage.
 
void Use64BitStorage ()
 Initialize internal data structures to use 32- or 64-bit storage.
 
void UseDefaultStorage ()
 Initialize internal data structures to use 32- or 64-bit storage.
 
bool CanConvertTo32BitStorage () const
 Check if the existing data can safely be converted to use 32- or 64- bit storage.
 
bool CanConvertTo64BitStorage () const
 Check if the existing data can safely be converted to use 32- or 64- bit storage.
 
bool CanConvertToDefaultStorage () const
 Check if the existing data can safely be converted to use 32- or 64- bit storage.
 
bool ConvertTo32BitStorage ()
 Convert internal data structures to use 32- or 64-bit storage.
 
bool ConvertTo64BitStorage ()
 Convert internal data structures to use 32- or 64-bit storage.
 
bool ConvertToDefaultStorage ()
 Convert internal data structures to use 32- or 64-bit storage.
 
bool ConvertToSmallestStorage ()
 Convert internal data structures to use 32- or 64-bit storage.
 
vtkDataArrayGetOffsetsArray ()
 Return the array used to store cell offsets.
 
ArrayType32GetOffsetsArray32 ()
 Return the array used to store cell offsets.
 
ArrayType64GetOffsetsArray64 ()
 Return the array used to store cell offsets.
 
vtkDataArrayGetConnectivityArray ()
 Return the array used to store the point ids that define the cells' connectivity.
 
ArrayType32GetConnectivityArray32 ()
 Return the array used to store the point ids that define the cells' connectivity.
 
ArrayType64GetConnectivityArray64 ()
 Return the array used to store the point ids that define the cells' connectivity.
 
vtkIdType GetTraversalCellId ()
 Get/Set the current cellId for traversal.
 
void SetTraversalCellId (vtkIdType cellId)
 Get/Set the current cellId for traversal.
 
void ReplaceCellAtId (vtkIdType cellId, vtkIdList *list)
 Replaces the point ids for the specified cell with the supplied list.
 
void ReplaceCellAtId (vtkIdType cellId, vtkIdType cellSize, const vtkIdType *cellPoints)
 Replaces the point ids for the specified cell with the supplied list.
 
void ImportLegacyFormat (vtkIdTypeArray *data)
 Import an array of data with the legacy vtkCellArray layout, e.g.:
 
void ImportLegacyFormat (const vtkIdType *data, vtkIdType len)
 Import an array of data with the legacy vtkCellArray layout, e.g.:
 
void AppendLegacyFormat (vtkIdTypeArray *data, vtkIdType ptOffset=0)
 Append an array of data with the legacy vtkCellArray layout, e.g.:
 
void AppendLegacyFormat (const vtkIdType *data, vtkIdType len, vtkIdType ptOffset=0)
 Append an array of data with the legacy vtkCellArray layout, e.g.:
 
template<typename Functor , typename... Args, typename = typename std::enable_if<ReturnsVoid<Functor, Args...>::value>::type>
void Visit (Functor &&functor, Args &&... args)
 
template<typename Functor , typename... Args, typename = typename std::enable_if<ReturnsVoid<Functor, Args...>::value>::type>
void Visit (Functor &&functor, Args &&... args) const
 
template<typename Functor , typename... Args, typename = typename std::enable_if<!ReturnsVoid<Functor, Args...>::value>::type>
GetReturnType< Functor, Args... > Visit (Functor &&functor, Args &&... args)
 
template<typename Functor , typename... Args, typename = typename std::enable_if<!ReturnsVoid<Functor, Args...>::value>::type>
GetReturnType< Functor, Args... > Visit (Functor &&functor, Args &&... args) const
 
vtkIdType GetTraversalLocation ()
 Get/Set the current traversal legacy location.
 
vtkIdType GetTraversalLocation (vtkIdType npts)
 Get/Set the current traversal legacy location.
 
void SetTraversalLocation (vtkIdType loc)
 Get/Set the current traversal legacy location.
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on.
 
virtual void DebugOff ()
 Turn debugging output off.
 
bool GetDebug ()
 Get the value of the debug flag.
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag.
 
virtual void Modified ()
 Update the modification time for this object.
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time.
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkCommandGetCommand (unsigned long tag)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObserver (vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObservers (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObservers (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method.
 
int InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
 
int InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string.
 
virtual vtkTypeBool IsA (const char *name)
 Return 1 if this class is the same type of (or a subclass of) the named class.
 
virtual vtkIdType GetNumberOfGenerationsFromBase (const char *name)
 Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
 
virtual void Delete ()
 Delete a VTK object.
 
virtual void FastDelete ()
 Delete a reference to this object.
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream.
 
virtual void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object).
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object).
 
int GetReferenceCount ()
 Return the current reference count of this object.
 
void SetReferenceCount (int)
 Sets the reference count.
 
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space.
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 

Protected Member Functions

 vtkCellArray ()
 
 ~vtkCellArray () override
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events.
 
void InternalReleaseFocus ()
 These methods allow a command to exclusively grab all events.
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void RegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

Storage Storage
 
vtkNew< vtkIdListTempCell
 
vtkIdType TraversalCellId { 0 }
 
vtkNew< vtkIdTypeArrayLegacyData
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Friends

class vtkCellArrayIterator
 
typedef vtkObject Superclass
 Standard methods for instantiation, type information, and printing.
 
static vtkCellArrayNew ()
 Standard methods for instantiation, type information, and printing.
 
static vtkTypeBool IsTypeOf (const char *type)
 Standard methods for instantiation, type information, and printing.
 
static vtkCellArraySafeDownCast (vtkObjectBase *o)
 Standard methods for instantiation, type information, and printing.
 
virtual vtkTypeBool IsA (const char *type)
 Standard methods for instantiation, type information, and printing.
 
vtkCellArrayNewInstance () const
 Standard methods for instantiation, type information, and printing.
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Standard methods for instantiation, type information, and printing.
 
void PrintDebug (ostream &os)
 Standard methods for instantiation, type information, and printing.
 
virtual vtkObjectBaseNewInstanceInternal () const
 Standard methods for instantiation, type information, and printing.
 

Additional Inherited Members

- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes.
 
static void SetGlobalWarningDisplay (int val)
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static void GlobalWarningDisplayOn ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static void GlobalWarningDisplayOff ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static int GetGlobalWarningDisplay ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class.
 
static vtkIdType GetNumberOfGenerationsFromBaseType (const char *name)
 Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
 
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within.
 
static bool GetUsingMemkind ()
 A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space.
 
- Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
 
static vtkReallocingFunction GetCurrentReallocFunction ()
 
static vtkFreeingFunction GetCurrentFreeFunction ()
 
static vtkFreeingFunction GetAlternateFreeFunction ()
 

Detailed Description

object to represent cell connectivity

vtkCellArray stores dataset topologies as an explicit connectivity table listing the point ids that make up each cell.

Internally, the connectivity table is represented as two arrays: Offsets and Connectivity.

Offsets is an array of [numCells+1] values indicating the index in the Connectivity array where each cell's points start. The last value is always the length of the Connectivity array.

The Connectivity array stores the lists of point ids for each cell.

Thus, for a dataset consisting of 2 triangles, a quad, and a line, the internal arrays will appear as follows:

Topology:
---------
Cell 0: Triangle | point ids: {0, 1, 2}
Cell 1: Triangle | point ids: {5, 7, 2}
Cell 2: Quad | point ids: {3, 4, 6, 7}
Cell 4: Line | point ids: {5, 8}
vtkCellArray (current):
-----------------------
Offsets: {0, 3, 6, 10, 12}
Connectivity: {0, 1, 2, 5, 7, 2, 3, 4, 6, 7, 5, 8}
@ point
Definition: vtkX3D.h:242

While this class provides traversal methods (the legacy InitTraversal(), GetNextCell() methods, and the newer method GetCellAtId()) these are in general not thread-safe. Whenever possible it is preferrable to use a local thread-safe, vtkCellArrayIterator object, which can be obtained via:

auto iter = vtk::TakeSmartPointer(cellArray->NewIterator());
for (iter->GoToFirstCell(); !iter->IsDoneWithTraversal(); iter->GoToNextCell())
{
// do work with iter
}
vtkSmartPointer< T > TakeSmartPointer(T *obj)
Construct a vtkSmartPointer<T> containing obj.

(Note however that depending on the type and structure of internal storage, a cell array iterator may be significantly slower than direct traversal over the cell array due to extra data copying. Factors of 3-4X are not uncommon. See vtkCellArrayIterator for more information. Also note that an iterator may become invalid if the internal vtkCellArray storage is modified.)

Other methods are also available for allocation and memory-related management; insertion of new cells into the vtkCellArray; and limited editing operations such as replacing one cell with a new cell of the same size.

The internal arrays may store either 32- or 64-bit values, though most of the API will prefer to use vtkIdType to refer to items in these arrays. This enables significant memory savings when vtkIdType is 64-bit, but 32 bits are sufficient to store all of the values in the connectivity table. Using 64-bit storage with a 32-bit vtkIdType is permitted, but values too large to fit in a 32-bit signed integer will be truncated when accessed through the API. (The particular internal storage type has implications on performance depending on vtkIdType. If the internal storage is equivalent to vtkIdType, then methods that return pointers to arrays of point ids can share the internal storage; otherwise a copy of internal memory must be performed.)

Methods for managing the storage type are:

Note that some legacy methods are still available that reflect the previous storage format of this data, which embedded the cell sizes into the Connectivity array:

vtkCellArray (legacy):
----------------------
Connectivity: {3, 0, 1, 2, 3, 5, 7, 2, 4, 3, 4, 6, 7, 2, 5, 8}
|--Cell 0--||--Cell 1--||----Cell 2---||--C3-|

The methods require an external lookup table to allow random access, which was historically stored in the vtkCellTypes object. The following methods in vtkCellArray still support this style of indexing for compatibility purposes, but these are slow as they must perform some complex computations to convert the old "location" into the new "offset" and should be avoided. These methods (and their modern equivalents) are:

Some other legacy methods were completely removed, such as GetPointer() / WritePointer(), since they are cannot be effectively emulated under the current design. If external code needs to support both the old and new version of the vtkCellArray API, the VTK_CELL_ARRAY_V2 preprocessor definition may be used to detect which API is being compiled against.

See also
vtkCellTypes vtkCellLinks
Online Examples:

Definition at line 289 of file vtkCellArray.h.

Member Typedef Documentation

◆ ArrayType32

using vtkCellArray::ArrayType32 = vtkTypeInt32Array

Definition at line 292 of file vtkCellArray.h.

◆ ArrayType64

using vtkCellArray::ArrayType64 = vtkTypeInt64Array

Definition at line 293 of file vtkCellArray.h.

◆ Superclass

Standard methods for instantiation, type information, and printing.

Definition at line 301 of file vtkCellArray.h.

◆ StorageArrayList

List of possible array types used for storage.

May be used with vtkArrayDispatch::Dispatch[2]ByArray to process internal arrays. Both the Connectivity and Offset arrays are guaranteed to have the same type.

See also
vtkCellArray::Visit() for a simpler mechanism.

Definition at line 314 of file vtkCellArray.h.

◆ InputArrayList

using vtkCellArray::InputArrayList = typename vtkTypeList::Unique<vtkTypeList::Create<vtkAOSDataArrayTemplate<int>, vtkAOSDataArrayTemplate<long>, vtkAOSDataArrayTemplate<long long> >>::Result

List of possible ArrayTypes that are compatible with internal storage.

Single component AOS-layout arrays holding one of these types may be passed to the method SetData to setup the cell array state.

This can be used with vtkArrayDispatch::DispatchByArray, etc to check input arrays before assigning them to a cell array.

Definition at line 324 of file vtkCellArray.h.

Constructor & Destructor Documentation

◆ vtkCellArray()

vtkCellArray::vtkCellArray ( )
protected

◆ ~vtkCellArray()

vtkCellArray::~vtkCellArray ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkCellArray * vtkCellArray::New ( )
static

Standard methods for instantiation, type information, and printing.

◆ IsTypeOf()

static vtkTypeBool vtkCellArray::IsTypeOf ( const char *  type)
static

Standard methods for instantiation, type information, and printing.

◆ IsA()

virtual vtkTypeBool vtkCellArray::IsA ( const char *  type)
virtual

Standard methods for instantiation, type information, and printing.

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

static vtkCellArray * vtkCellArray::SafeDownCast ( vtkObjectBase o)
static

Standard methods for instantiation, type information, and printing.

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkCellArray::NewInstanceInternal ( ) const
protectedvirtual

Standard methods for instantiation, type information, and printing.

◆ NewInstance()

vtkCellArray * vtkCellArray::NewInstance ( ) const

Standard methods for instantiation, type information, and printing.

◆ PrintSelf()

void vtkCellArray::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Standard methods for instantiation, type information, and printing.

Reimplemented from vtkObject.

◆ PrintDebug()

void vtkCellArray::PrintDebug ( ostream &  os)

Standard methods for instantiation, type information, and printing.

◆ Allocate()

vtkTypeBool vtkCellArray::Allocate ( vtkIdType  sz,
vtkIdType   vtkNotUsedext = 1000 
)
inline

Allocate memory.

This currently allocates both the offsets and connectivity arrays to sz.

Note
It is preferrable to use AllocateEstimate(numCells, maxCellSize) or AllocateExact(numCells, connectivitySize) instead.

Definition at line 336 of file vtkCellArray.h.

◆ AllocateEstimate()

bool vtkCellArray::AllocateEstimate ( vtkIdType  numCells,
vtkIdType  maxCellSize 
)
inline

Pre-allocate memory in internal data structures.

Does not change the number of cells, only the array capacities. Existing data is NOT preserved.

Parameters
numCellsThe number of expected cells in the dataset.
maxCellSizeThe number of points per cell to allocate memory for.
Returns
True if allocation succeeds.
See also
Squeeze AllocateExact AllocateCopy

Definition at line 350 of file vtkCellArray.h.

◆ AllocateExact()

bool vtkCellArray::AllocateExact ( vtkIdType  numCells,
vtkIdType  connectivitySize 
)

Pre-allocate memory in internal data structures.

Does not change the number of cells, only the array capacities. Existing data is NOT preserved.

Parameters
numCellsThe number of expected cells in the dataset.
connectivitySizeThe total number of pointIds stored for all cells.
Returns
True if allocation succeeds.
See also
Squeeze AllocateEstimate AllocateCopy

◆ AllocateCopy()

bool vtkCellArray::AllocateCopy ( vtkCellArray other)
inline

Pre-allocate memory in internal data structures to match the used size of the input vtkCellArray.

Does not change the number of cells, only the array capacities. Existing data is NOT preserved.

Parameters
otherThe vtkCellArray to use as a reference.
Returns
True if allocation succeeds.
See also
Squeeze AllocateEstimate AllocateExact

Definition at line 375 of file vtkCellArray.h.

◆ ResizeExact()

bool vtkCellArray::ResizeExact ( vtkIdType  numCells,
vtkIdType  connectivitySize 
)

ResizeExact() resizes the internal structures to hold numCells total cell offsets and connectivitySize total pointIds.

Old data is preserved, and newly-available memory is not initialized.

Warning
For advanced use only. You probably want an Allocate method.
Returns
True if allocation succeeds.

◆ Initialize()

void vtkCellArray::Initialize ( )

Free any memory and reset to an empty state.

◆ Reset()

void vtkCellArray::Reset ( )
inline

Reuse list.

Reset to initial state without freeing memory.

Definition at line 1702 of file vtkCellArray.h.

◆ Squeeze()

void vtkCellArray::Squeeze ( )

Reclaim any extra memory while preserving data.

See also
ConvertToSmallestStorage

◆ IsValid()

bool vtkCellArray::IsValid ( )

Check that internal storage is consistent and in a valid state.

Specifically, this function returns true if and only if:

  • The offset and connectivity arrays have exactly one component.
  • The offset array has at least one value and starts at 0.
  • The offset array values never decrease.
  • The connectivity array has as many entries as the last value in the offset array.

◆ GetNumberOfCells()

vtkIdType vtkCellArray::GetNumberOfCells ( ) const
inline

Get the number of cells in the array.

Definition at line 423 of file vtkCellArray.h.

◆ GetNumberOfOffsets()

vtkIdType vtkCellArray::GetNumberOfOffsets ( ) const
inline

Get the number of elements in the offsets array.

This will be the number of cells + 1.

Definition at line 439 of file vtkCellArray.h.

◆ GetNumberOfConnectivityIds()

vtkIdType vtkCellArray::GetNumberOfConnectivityIds ( ) const
inline

Get the size of the connectivity array that stores the point ids.

Note
Do not confuse this with the deprecated GetNumberOfConnectivityEntries(), which refers to the legacy memory layout.

Definition at line 457 of file vtkCellArray.h.

◆ NewIterator()

vtkCellArrayIterator * vtkCellArray::NewIterator ( )

NewIterator returns a new instance of vtkCellArrayIterator that is initialized to point at the first cell's data.

The caller is responsible for Delete()'ing the object.

◆ SetData() [1/8]

void vtkCellArray::SetData ( vtkTypeInt32Array *  offsets,
vtkTypeInt32Array *  connectivity 
)

Set the internal data arrays to the supplied offsets and connectivity arrays.

Note that the input arrays may be copied and not used directly. To avoid copying, use vtkIdTypeArray, vtkCellArray::ArrayType32, or vtkCellArray::ArrayType64.

◆ SetData() [2/8]

void vtkCellArray::SetData ( vtkTypeInt64Array *  offsets,
vtkTypeInt64Array *  connectivity 
)

Set the internal data arrays to the supplied offsets and connectivity arrays.

Note that the input arrays may be copied and not used directly. To avoid copying, use vtkIdTypeArray, vtkCellArray::ArrayType32, or vtkCellArray::ArrayType64.

◆ SetData() [3/8]

void vtkCellArray::SetData ( vtkIdTypeArray offsets,
vtkIdTypeArray connectivity 
)

Set the internal data arrays to the supplied offsets and connectivity arrays.

Note that the input arrays may be copied and not used directly. To avoid copying, use vtkIdTypeArray, vtkCellArray::ArrayType32, or vtkCellArray::ArrayType64.

◆ SetData() [4/8]

void vtkCellArray::SetData ( vtkAOSDataArrayTemplate< int > *  offsets,
vtkAOSDataArrayTemplate< int > *  connectivity 
)

Set the internal data arrays to the supplied offsets and connectivity arrays.

Note that the input arrays may be copied and not used directly. To avoid copying, use vtkIdTypeArray, vtkCellArray::ArrayType32, or vtkCellArray::ArrayType64.

◆ SetData() [5/8]

void vtkCellArray::SetData ( vtkAOSDataArrayTemplate< long > *  offsets,
vtkAOSDataArrayTemplate< long > *  connectivity 
)

Set the internal data arrays to the supplied offsets and connectivity arrays.

Note that the input arrays may be copied and not used directly. To avoid copying, use vtkIdTypeArray, vtkCellArray::ArrayType32, or vtkCellArray::ArrayType64.

◆ SetData() [6/8]

void vtkCellArray::SetData ( vtkAOSDataArrayTemplate< long long > *  offsets,
vtkAOSDataArrayTemplate< long long > *  connectivity 
)

Set the internal data arrays to the supplied offsets and connectivity arrays.

Note that the input arrays may be copied and not used directly. To avoid copying, use vtkIdTypeArray, vtkCellArray::ArrayType32, or vtkCellArray::ArrayType64.

◆ SetData() [7/8]

bool vtkCellArray::SetData ( vtkDataArray offsets,
vtkDataArray connectivity 
)

Sets the internal arrays to the supplied offsets and connectivity arrays.

This is a convenience method, and may fail if the following conditions are not met:

  • Both arrays must be of the same type.
  • The array type must be one of the types in InputArrayList.

If invalid arrays are passed in, an error is logged and the function will return false.

◆ SetData() [8/8]

bool vtkCellArray::SetData ( vtkIdType  cellSize,
vtkDataArray connectivity 
)

Sets the internal arrays to the supported connectivity array with an offsets array automatically generated given the fixed cells size.

This is a convenience method, and may fail if the following conditions are not met:

  • The connectivity array must be one of the types in InputArrayList.
  • The connectivity array size must be a multiple of cellSize.

If invalid arrays are passed in, an error is logged and the function will return false.

◆ IsStorage64Bit()

bool vtkCellArray::IsStorage64Bit ( ) const
inline
Returns
True if the internal storage is using 64 bit arrays. If false, the storage is using 32 bit arrays.

Definition at line 530 of file vtkCellArray.h.

◆ IsStorageShareable()

bool vtkCellArray::IsStorageShareable ( ) const
inline
Returns
True if the internal storage can be shared as a pointer to vtkIdType, i.e., the type and organization of internal storage is such that copying of data can be avoided, and instead a pointer to vtkIdType can be used.

Definition at line 538 of file vtkCellArray.h.

◆ Use32BitStorage()

void vtkCellArray::Use32BitStorage ( )

Initialize internal data structures to use 32- or 64-bit storage.

If selecting default storage, the storage depends on the VTK_USE_64BIT_IDS setting.

All existing data is erased.

◆ Use64BitStorage()

void vtkCellArray::Use64BitStorage ( )

Initialize internal data structures to use 32- or 64-bit storage.

If selecting default storage, the storage depends on the VTK_USE_64BIT_IDS setting.

All existing data is erased.

◆ UseDefaultStorage()

void vtkCellArray::UseDefaultStorage ( )

Initialize internal data structures to use 32- or 64-bit storage.

If selecting default storage, the storage depends on the VTK_USE_64BIT_IDS setting.

All existing data is erased.

◆ CanConvertTo32BitStorage()

bool vtkCellArray::CanConvertTo32BitStorage ( ) const

Check if the existing data can safely be converted to use 32- or 64- bit storage.

Ensures that all values can be converted to the target storage without truncating. If selecting default storage, the storage depends on the VTK_USE_64BIT_IDS setting.

◆ CanConvertTo64BitStorage()

bool vtkCellArray::CanConvertTo64BitStorage ( ) const

Check if the existing data can safely be converted to use 32- or 64- bit storage.

Ensures that all values can be converted to the target storage without truncating. If selecting default storage, the storage depends on the VTK_USE_64BIT_IDS setting.

◆ CanConvertToDefaultStorage()

bool vtkCellArray::CanConvertToDefaultStorage ( ) const

Check if the existing data can safely be converted to use 32- or 64- bit storage.

Ensures that all values can be converted to the target storage without truncating. If selecting default storage, the storage depends on the VTK_USE_64BIT_IDS setting.

◆ ConvertTo32BitStorage()

bool vtkCellArray::ConvertTo32BitStorage ( )

Convert internal data structures to use 32- or 64-bit storage.

If selecting default storage, the storage depends on the VTK_USE_64BIT_IDS setting.

If selecting smallest storage, the data is checked to see what the smallest safe storage for the existing data is, and then converts to it.

Existing data is preserved.

Returns
True on success, false on failure. If this algorithm fails, the cell array will be in an unspecified state.

◆ ConvertTo64BitStorage()

bool vtkCellArray::ConvertTo64BitStorage ( )

Convert internal data structures to use 32- or 64-bit storage.

If selecting default storage, the storage depends on the VTK_USE_64BIT_IDS setting.

If selecting smallest storage, the data is checked to see what the smallest safe storage for the existing data is, and then converts to it.

Existing data is preserved.

Returns
True on success, false on failure. If this algorithm fails, the cell array will be in an unspecified state.

◆ ConvertToDefaultStorage()

bool vtkCellArray::ConvertToDefaultStorage ( )

Convert internal data structures to use 32- or 64-bit storage.

If selecting default storage, the storage depends on the VTK_USE_64BIT_IDS setting.

If selecting smallest storage, the data is checked to see what the smallest safe storage for the existing data is, and then converts to it.

Existing data is preserved.

Returns
True on success, false on failure. If this algorithm fails, the cell array will be in an unspecified state.

◆ ConvertToSmallestStorage()

bool vtkCellArray::ConvertToSmallestStorage ( )

Convert internal data structures to use 32- or 64-bit storage.

If selecting default storage, the storage depends on the VTK_USE_64BIT_IDS setting.

If selecting smallest storage, the data is checked to see what the smallest safe storage for the existing data is, and then converts to it.

Existing data is preserved.

Returns
True on success, false on failure. If this algorithm fails, the cell array will be in an unspecified state.

◆ GetOffsetsArray()

vtkDataArray * vtkCellArray::GetOffsetsArray ( )
inline

Return the array used to store cell offsets.

The 32/64 variants are only valid when IsStorage64Bit() returns the appropriate value.

Definition at line 603 of file vtkCellArray.h.

◆ GetOffsetsArray32()

ArrayType32 * vtkCellArray::GetOffsetsArray32 ( )
inline

Return the array used to store cell offsets.

The 32/64 variants are only valid when IsStorage64Bit() returns the appropriate value.

Definition at line 614 of file vtkCellArray.h.

◆ GetOffsetsArray64()

ArrayType64 * vtkCellArray::GetOffsetsArray64 ( )
inline

Return the array used to store cell offsets.

The 32/64 variants are only valid when IsStorage64Bit() returns the appropriate value.

Definition at line 615 of file vtkCellArray.h.

◆ GetConnectivityArray()

vtkDataArray * vtkCellArray::GetConnectivityArray ( )
inline

Return the array used to store the point ids that define the cells' connectivity.

The 32/64 variants are only valid when IsStorage64Bit() returns the appropriate value.

Definition at line 624 of file vtkCellArray.h.

◆ GetConnectivityArray32()

ArrayType32 * vtkCellArray::GetConnectivityArray32 ( )
inline

Return the array used to store the point ids that define the cells' connectivity.

The 32/64 variants are only valid when IsStorage64Bit() returns the appropriate value.

Definition at line 635 of file vtkCellArray.h.

◆ GetConnectivityArray64()

ArrayType64 * vtkCellArray::GetConnectivityArray64 ( )
inline

Return the array used to store the point ids that define the cells' connectivity.

The 32/64 variants are only valid when IsStorage64Bit() returns the appropriate value.

Definition at line 636 of file vtkCellArray.h.

◆ IsHomogeneous()

vtkIdType vtkCellArray::IsHomogeneous ( )

Check if all cells have the same number of vertices.

The return value is coded as:

  • -1 = heterogeneous
  • 0 = Cell array empty
  • n (positive integer) = homogeneous array of cell size n

◆ InitTraversal()

void vtkCellArray::InitTraversal ( )
inline
Warning
This method is not thread-safe. Consider using the NewIterator() iterator instead.

InitTraversal() initializes the traversal of the list of cells.

Note
This method is not thread-safe and has tricky syntax to use correctly. Prefer the use of vtkCellArrayIterator (see NewIterator()).

Definition at line 1600 of file vtkCellArray.h.

◆ GetNextCell() [1/2]

int vtkCellArray::GetNextCell ( vtkIdType npts,
vtkIdType const *&  pts 
)
inline
Warning
This method is not thread-safe. Consider using the NewIterator() iterator instead.

GetNextCell() gets the next cell in the list. If end of list is encountered, 0 is returned. A value of 1 is returned whenever npts and pts have been updated without error.

Do not modify the returned pts pointer, as it may point to shared memory.

Note
This method is not thread-safe and has tricky syntax to use correctly. Prefer the use of vtkCellArrayIterator (see NewIterator()).

Definition at line 1606 of file vtkCellArray.h.

◆ GetNextCell() [2/2]

int vtkCellArray::GetNextCell ( vtkIdList pts)
inline
Warning
This method is not thread-safe. Consider using the NewIterator() iterator instead.

GetNextCell() gets the next cell in the list. If end of list is encountered, 0 is returned.

Note
This method is not thread-safe and has tricky syntax to use correctly. Prefer the use of vtkCellArrayIterator (see NewIterator()).

Definition at line 1621 of file vtkCellArray.h.

◆ GetCellAtId() [1/2]

void vtkCellArray::GetCellAtId ( vtkIdType  cellId,
vtkIdType cellSize,
vtkIdType const *&  cellPoints 
)
inline

Return the point ids for the cell at cellId.

Warning
Subsequent calls to this method may invalidate previous call results if the internal storage type is not the same as vtkIdType and cannot be shared through the cellPoints pointer. In other words, the method may not be thread safe. Check if shareable (using IsStorageShareable()), or use a vtkCellArrayIterator to guarantee thread safety.

Definition at line 1640 of file vtkCellArray.h.

◆ GetCellAtId() [2/2]

void vtkCellArray::GetCellAtId ( vtkIdType  cellId,
vtkIdList pts 
)
inline

Return the point ids for the cell at cellId.

This always copies the cell ids (i.e., the list of points pts into the supplied vtkIdList). This method is thread safe.

Definition at line 1647 of file vtkCellArray.h.

◆ GetCellSize()

vtkIdType vtkCellArray::GetCellSize ( const vtkIdType  cellId) const
inline

Return the size of the cell at cellId.

Definition at line 1634 of file vtkCellArray.h.

◆ InsertNextCell() [1/5]

vtkIdType vtkCellArray::InsertNextCell ( vtkCell cell)
inline

Insert a cell object.

Return the cell id of the cell.

Definition at line 1694 of file vtkCellArray.h.

◆ InsertNextCell() [2/5]

vtkIdType vtkCellArray::InsertNextCell ( vtkIdType  npts,
const vtkIdType pts 
)
inline

Create a cell by specifying the number of points and an array of point id's.

Return the cell id of the cell.

Definition at line 1653 of file vtkCellArray.h.

◆ InsertNextCell() [3/5]

vtkIdType vtkCellArray::InsertNextCell ( vtkIdList pts)
inline

Create a cell by specifying a list of point ids.

Return the cell id of the cell.

Definition at line 1687 of file vtkCellArray.h.

◆ InsertNextCell() [4/5]

vtkIdType vtkCellArray::InsertNextCell ( const std::initializer_list< vtkIdType > &  cell)
inline

Overload that allows InsertNextCell({0, 1, 2}) syntax.

Warning
This approach is useful for testing, but beware that trying to pass a single value (eg. InsertNextCell({3})) will call the InsertNextCell(int) overload instead.

Definition at line 738 of file vtkCellArray.h.

◆ InsertNextCell() [5/5]

vtkIdType vtkCellArray::InsertNextCell ( int  npts)
inline

Create cells by specifying a count of total points to be inserted, and then adding points one at a time using method InsertCellPoint().

If you don't know the count initially, use the method UpdateCellCount() to complete the cell. Return the cell id of the cell.

Definition at line 1660 of file vtkCellArray.h.

◆ InsertCellPoint()

void vtkCellArray::InsertCellPoint ( vtkIdType  id)
inline

Used in conjunction with InsertNextCell(npts) to add another point to the list of cells.

Definition at line 1666 of file vtkCellArray.h.

◆ UpdateCellCount()

void vtkCellArray::UpdateCellCount ( int  npts)
inline

Used in conjunction with InsertNextCell(int npts) and InsertCellPoint() to update the number of points defining the cell.

Definition at line 1681 of file vtkCellArray.h.

◆ GetTraversalCellId()

vtkIdType vtkCellArray::GetTraversalCellId ( )

Get/Set the current cellId for traversal.

Note
This method is not thread-safe and has tricky syntax to use correctly. Prefer the use of vtkCellArrayIterator (see NewIterator()).

◆ SetTraversalCellId()

void vtkCellArray::SetTraversalCellId ( vtkIdType  cellId)

Get/Set the current cellId for traversal.

Note
This method is not thread-safe and has tricky syntax to use correctly. Prefer the use of vtkCellArrayIterator (see NewIterator()).

◆ ReverseCellAtId()

void vtkCellArray::ReverseCellAtId ( vtkIdType  cellId)

Reverses the order of the point ids for the specified cell.

◆ ReplaceCellAtId() [1/3]

void vtkCellArray::ReplaceCellAtId ( vtkIdType  cellId,
vtkIdList list 
)

Replaces the point ids for the specified cell with the supplied list.

Warning
This can ONLY replace the cell if the size does not change. Attempting to change cell size through this method will have undefined results.

◆ ReplaceCellAtId() [2/3]

void vtkCellArray::ReplaceCellAtId ( vtkIdType  cellId,
vtkIdType  cellSize,
const vtkIdType cellPoints 
)

Replaces the point ids for the specified cell with the supplied list.

Warning
This can ONLY replace the cell if the size does not change. Attempting to change cell size through this method will have undefined results.

◆ ReplaceCellAtId() [3/3]

void vtkCellArray::ReplaceCellAtId ( vtkIdType  cellId,
const std::initializer_list< vtkIdType > &  cell 
)
inline

Overload that allows ReplaceCellAtId(cellId, {0, 1, 2}) syntax.

Warning
This can ONLY replace the cell if the size does not change. Attempting to change cell size through this method will have undefined results.

Definition at line 799 of file vtkCellArray.h.

◆ GetMaxCellSize()

int vtkCellArray::GetMaxCellSize ( )

Returns the size of the largest cell.

The size is the number of points defining the cell.

◆ DeepCopy()

void vtkCellArray::DeepCopy ( vtkCellArray ca)

Perform a deep copy (no reference counting) of the given cell array.

◆ ShallowCopy()

void vtkCellArray::ShallowCopy ( vtkCellArray ca)

Shallow copy ca into this cell array.

◆ Append()

void vtkCellArray::Append ( vtkCellArray src,
vtkIdType  pointOffset = 0 
)

Append cells from src into this.

Point ids are offset by pointOffset.

◆ ExportLegacyFormat()

void vtkCellArray::ExportLegacyFormat ( vtkIdTypeArray data)

Fill data with the old-style vtkCellArray data layout, e.g.

{ n0, p0_0, p0_1, ..., p0_n, n1, p1_0, p1_1, ..., p1_n, ... }

where n0 is the number of points in cell 0, and pX_Y is the Y'th point in cell X.

◆ ImportLegacyFormat() [1/2]

void vtkCellArray::ImportLegacyFormat ( vtkIdTypeArray data)

Import an array of data with the legacy vtkCellArray layout, e.g.:

{ n0, p0_0, p0_1, ..., p0_n, n1, p1_0, p1_1, ..., p1_n, ... }

where n0 is the number of points in cell 0, and pX_Y is the Y'th point in cell X.

◆ ImportLegacyFormat() [2/2]

void vtkCellArray::ImportLegacyFormat ( const vtkIdType data,
vtkIdType  len 
)

Import an array of data with the legacy vtkCellArray layout, e.g.:

{ n0, p0_0, p0_1, ..., p0_n, n1, p1_0, p1_1, ..., p1_n, ... }

where n0 is the number of points in cell 0, and pX_Y is the Y'th point in cell X.

◆ AppendLegacyFormat() [1/2]

void vtkCellArray::AppendLegacyFormat ( vtkIdTypeArray data,
vtkIdType  ptOffset = 0 
)

Append an array of data with the legacy vtkCellArray layout, e.g.:

{ n0, p0_0, p0_1, ..., p0_n, n1, p1_0, p1_1, ..., p1_n, ... }

where n0 is the number of points in cell 0, and pX_Y is the Y'th point in cell X.

◆ AppendLegacyFormat() [2/2]

void vtkCellArray::AppendLegacyFormat ( const vtkIdType data,
vtkIdType  len,
vtkIdType  ptOffset = 0 
)

Append an array of data with the legacy vtkCellArray layout, e.g.:

{ n0, p0_0, p0_1, ..., p0_n, n1, p1_0, p1_1, ..., p1_n, ... }

where n0 is the number of points in cell 0, and pX_Y is the Y'th point in cell X.

◆ GetActualMemorySize()

unsigned long vtkCellArray::GetActualMemorySize ( ) const

Return the memory in kibibytes (1024 bytes) consumed by this cell array.

Used to support streaming and reading/writing data. The value returned is guaranteed to be greater than or equal to the memory required to actually represent the data represented by this object. The information returned is valid only after the pipeline has been updated.

◆ Visit() [1/4]

template<typename Functor , typename... Args, typename = typename std::enable_if<ReturnsVoid<Functor, Args...>::value>::type>
void vtkCellArray::Visit ( Functor &&  functor,
Args &&...  args 
)
inline
Warning
Advanced use only.

The Visit methods allow efficient bulk modification of the vtkCellArray internal arrays by dispatching a functor with the current storage arrays. The simplest functor is of the form:

// Functor definition:
struct Worker
{
template <typename CellStateT>
void operator()(CellStateT &state)
{
// Do work on state object
}
};
// Functor usage:
vtkCellArray *cellArray = ...;
cellArray->Visit(Worker{});
object to represent cell connectivity
Definition: vtkCellArray.h:290
void Visit(Functor &&functor, Args &&... args)

where state is an instance of the vtkCellArray::VisitState<ArrayT> class, instantiated for the current storage type of the cell array. See that class for usage details.

The functor may also:

  • Return a value from operator()
  • Pass additional arguments to operator()
  • Hold state.

A more advanced functor that does these things is shown below, along with its usage. This functor scans a range of cells and returns the largest cell's id:

struct FindLargestCellInRange
{
template <typename CellStateT>
vtkIdType operator()(CellStateT &state,
vtkIdType rangeBegin,
vtkIdType rangeEnd)
{
vtkIdType largest = rangeBegin;
vtkIdType largestSize = state.GetCellSize(rangeBegin);
++rangeBegin;
for (; rangeBegin < rangeEnd; ++rangeBegin)
{
const vtkIdType curSize = state.GetCellSize(rangeBegin);
if (curSize > largestSize)
{
largest = rangeBegin;
largestSize = curSize;
}
}
return largest;
}
};
// Usage:
// Scan cells in range [128, 1024) and return the id of the largest.
vtkCellArray cellArray = ...;
vtkIdType largest = cellArray->Visit(FindLargestCellInRange{},
128, 1024);
int vtkIdType
Definition: vtkType.h:332

Definition at line 1047 of file vtkCellArray.h.

◆ Visit() [2/4]

template<typename Functor , typename... Args, typename = typename std::enable_if<ReturnsVoid<Functor, Args...>::value>::type>
void vtkCellArray::Visit ( Functor &&  functor,
Args &&...  args 
) const
inline
Warning
Advanced use only.

The Visit methods allow efficient bulk modification of the vtkCellArray internal arrays by dispatching a functor with the current storage arrays. The simplest functor is of the form:

// Functor definition:
struct Worker
{
template <typename CellStateT>
void operator()(CellStateT &state)
{
// Do work on state object
}
};
// Functor usage:
vtkCellArray *cellArray = ...;
cellArray->Visit(Worker{});

where state is an instance of the vtkCellArray::VisitState<ArrayT> class, instantiated for the current storage type of the cell array. See that class for usage details.

The functor may also:

  • Return a value from operator()
  • Pass additional arguments to operator()
  • Hold state.

A more advanced functor that does these things is shown below, along with its usage. This functor scans a range of cells and returns the largest cell's id:

struct FindLargestCellInRange
{
template <typename CellStateT>
vtkIdType operator()(CellStateT &state,
vtkIdType rangeBegin,
vtkIdType rangeEnd)
{
vtkIdType largest = rangeBegin;
vtkIdType largestSize = state.GetCellSize(rangeBegin);
++rangeBegin;
for (; rangeBegin < rangeEnd; ++rangeBegin)
{
const vtkIdType curSize = state.GetCellSize(rangeBegin);
if (curSize > largestSize)
{
largest = rangeBegin;
largestSize = curSize;
}
}
return largest;
}
};
// Usage:
// Scan cells in range [128, 1024) and return the id of the largest.
vtkCellArray cellArray = ...;
vtkIdType largest = cellArray->Visit(FindLargestCellInRange{},
128, 1024);

Definition at line 1067 of file vtkCellArray.h.

◆ Visit() [3/4]

template<typename Functor , typename... Args, typename = typename std::enable_if<!ReturnsVoid<Functor, Args...>::value>::type>
GetReturnType< Functor, Args... > vtkCellArray::Visit ( Functor &&  functor,
Args &&...  args 
)
inline
Warning
Advanced use only.

The Visit methods allow efficient bulk modification of the vtkCellArray internal arrays by dispatching a functor with the current storage arrays. The simplest functor is of the form:

// Functor definition:
struct Worker
{
template <typename CellStateT>
void operator()(CellStateT &state)
{
// Do work on state object
}
};
// Functor usage:
vtkCellArray *cellArray = ...;
cellArray->Visit(Worker{});

where state is an instance of the vtkCellArray::VisitState<ArrayT> class, instantiated for the current storage type of the cell array. See that class for usage details.

The functor may also:

  • Return a value from operator()
  • Pass additional arguments to operator()
  • Hold state.

A more advanced functor that does these things is shown below, along with its usage. This functor scans a range of cells and returns the largest cell's id:

struct FindLargestCellInRange
{
template <typename CellStateT>
vtkIdType operator()(CellStateT &state,
vtkIdType rangeBegin,
vtkIdType rangeEnd)
{
vtkIdType largest = rangeBegin;
vtkIdType largestSize = state.GetCellSize(rangeBegin);
++rangeBegin;
for (; rangeBegin < rangeEnd; ++rangeBegin)
{
const vtkIdType curSize = state.GetCellSize(rangeBegin);
if (curSize > largestSize)
{
largest = rangeBegin;
largestSize = curSize;
}
}
return largest;
}
};
// Usage:
// Scan cells in range [128, 1024) and return the id of the largest.
vtkCellArray cellArray = ...;
vtkIdType largest = cellArray->Visit(FindLargestCellInRange{},
128, 1024);

Definition at line 1087 of file vtkCellArray.h.

◆ Visit() [4/4]

template<typename Functor , typename... Args, typename = typename std::enable_if<!ReturnsVoid<Functor, Args...>::value>::type>
GetReturnType< Functor, Args... > vtkCellArray::Visit ( Functor &&  functor,
Args &&...  args 
) const
inline
Warning
Advanced use only.

The Visit methods allow efficient bulk modification of the vtkCellArray internal arrays by dispatching a functor with the current storage arrays. The simplest functor is of the form:

// Functor definition:
struct Worker
{
template <typename CellStateT>
void operator()(CellStateT &state)
{
// Do work on state object
}
};
// Functor usage:
vtkCellArray *cellArray = ...;
cellArray->Visit(Worker{});

where state is an instance of the vtkCellArray::VisitState<ArrayT> class, instantiated for the current storage type of the cell array. See that class for usage details.

The functor may also:

  • Return a value from operator()
  • Pass additional arguments to operator()
  • Hold state.

A more advanced functor that does these things is shown below, along with its usage. This functor scans a range of cells and returns the largest cell's id:

struct FindLargestCellInRange
{
template <typename CellStateT>
vtkIdType operator()(CellStateT &state,
vtkIdType rangeBegin,
vtkIdType rangeEnd)
{
vtkIdType largest = rangeBegin;
vtkIdType largestSize = state.GetCellSize(rangeBegin);
++rangeBegin;
for (; rangeBegin < rangeEnd; ++rangeBegin)
{
const vtkIdType curSize = state.GetCellSize(rangeBegin);
if (curSize > largestSize)
{
largest = rangeBegin;
largestSize = curSize;
}
}
return largest;
}
};
// Usage:
// Scan cells in range [128, 1024) and return the id of the largest.
vtkCellArray cellArray = ...;
vtkIdType largest = cellArray->Visit(FindLargestCellInRange{},
128, 1024);

Definition at line 1106 of file vtkCellArray.h.

◆ SetNumberOfCells()

virtual void vtkCellArray::SetNumberOfCells ( vtkIdType  )
virtual

Set the number of cells in the array.

DO NOT do any kind of allocation, advanced use only.

Note
This call has no effect.

◆ EstimateSize()

vtkIdType vtkCellArray::EstimateSize ( vtkIdType  numCells,
int  maxPtsPerCell 
)

Utility routines help manage memory of cell array.

EstimateSize() returns a value used to initialize and allocate memory for array based on number of cells and maximum number of points making up cell. If every cell is the same size (in terms of number of points), then the memory estimate is guaranteed exact. (If not exact, use Squeeze() to reclaim any extra memory.)

Note
This method was often misused (e.g. called alone and then discarding the result). Use AllocateEstimate directly instead.

◆ GetSize()

vtkIdType vtkCellArray::GetSize ( )

Get the size of the allocated connectivity array.

Warning
This returns the allocated capacity of the internal arrays as a number of elements, NOT the number of elements in use.
Note
Method incompatible with current internal storage.

◆ GetNumberOfConnectivityEntries()

vtkIdType vtkCellArray::GetNumberOfConnectivityEntries ( )

Return the size of the array that would be returned from ExportLegacyFormat().

Note
Method incompatible with current internal storage.

◆ GetCell() [1/2]

void vtkCellArray::GetCell ( vtkIdType  loc,
vtkIdType npts,
const vtkIdType *&  pts 
)

Internal method used to retrieve a cell given a legacy offset location.

Warning
Subsequent calls to this method may invalidate previous call results.
Note
The location-based API is now a super-slow compatibility layer. Prefer GetCellAtId.

◆ GetCell() [2/2]

void vtkCellArray::GetCell ( vtkIdType  loc,
vtkIdList pts 
)

Internal method used to retrieve a cell given a legacy offset location.

Note
The location-based API is now a super-slow compatibility layer. Prefer GetCellAtId.

◆ GetInsertLocation()

vtkIdType vtkCellArray::GetInsertLocation ( int  npts)

Computes the current legacy insertion location within the internal array.

Used in conjunction with GetCell(int loc,...).

Note
The location-based API is now a super-slow compatibility layer.

◆ GetTraversalLocation() [1/2]

vtkIdType vtkCellArray::GetTraversalLocation ( )

Get/Set the current traversal legacy location.

Note
The location-based API is now a super-slow compatibility layer. Prefer Get/SetTraversalCellId.

◆ GetTraversalLocation() [2/2]

vtkIdType vtkCellArray::GetTraversalLocation ( vtkIdType  npts)

Get/Set the current traversal legacy location.

Note
The location-based API is now a super-slow compatibility layer. Prefer Get/SetTraversalCellId.

◆ SetTraversalLocation()

void vtkCellArray::SetTraversalLocation ( vtkIdType  loc)

Get/Set the current traversal legacy location.

Note
The location-based API is now a super-slow compatibility layer. Prefer Get/SetTraversalCellId.

◆ ReverseCell()

void vtkCellArray::ReverseCell ( vtkIdType  loc)

Special method inverts ordering of cell at the specified legacy location.

Must be called carefully or the cell topology may be corrupted.

Note
The location-based API is now a super-slow compatibility layer. Prefer ReverseCellAtId;

◆ ReplaceCell()

void vtkCellArray::ReplaceCell ( vtkIdType  loc,
int  npts,
const vtkIdType  pts[] 
)

Replace the point ids of the cell at the legacy location with a different list of point ids.

Calling this method does not mark the vtkCellArray as modified. This is the responsibility of the caller and may be done after multiple calls to ReplaceCell. This call does not support changing the number of points in the cell – the caller must ensure that the target cell has npts points.

Note
The location-based API is now a super-slow compatibility layer. Prefer ReplaceCellAtId.

◆ SetCells()

void vtkCellArray::SetCells ( vtkIdType  ncells,
vtkIdTypeArray cells 
)

Define multiple cells by providing a connectivity list.

The list is in the form (npts,p0,p1,...p(npts-1), repeated for each cell). Be careful using this method because it discards the old cells, and anything referring these cells becomes invalid (for example, if BuildCells() has been called see vtkPolyData). The traversal location is reset to the beginning of the list; the insertion location is set to the end of the list.

Warning
The vtkCellArray will not hold a reference to cells. This function merely calls ImportLegacyFormat.
Note
Use ImportLegacyFormat or SetData instead.

◆ GetData()

vtkIdTypeArray * vtkCellArray::GetData ( )

Return the underlying data as a data array.

Warning
The returned array is not the actual internal representation used by vtkCellArray. Modifications to the returned array will not change the vtkCellArray's topology.
Note
Use ExportLegacyFormat, or GetOffsetsArray/GetConnectivityArray instead.

Friends And Related Function Documentation

◆ vtkCellArrayIterator

friend class vtkCellArrayIterator
friend

Definition at line 1264 of file vtkCellArray.h.

Member Data Documentation

◆ Storage

Definition at line 1410 of file vtkCellArray.h.

◆ TempCell

vtkNew<vtkIdList> vtkCellArray::TempCell
protected

Definition at line 1411 of file vtkCellArray.h.

◆ TraversalCellId

vtkIdType vtkCellArray::TraversalCellId { 0 }
protected

Definition at line 1412 of file vtkCellArray.h.

◆ LegacyData

vtkNew<vtkIdTypeArray> vtkCellArray::LegacyData
protected

Definition at line 1414 of file vtkCellArray.h.


The documentation for this class was generated from the following file: