VTK  9.7.20261129
vtkPolyhedronCellArray Class Reference

#include <vtkPolyhedronCellArray.h>

Detailed Description

object to represent the faces of polyhedral cells

vtkPolyhedronCellArray stores the topology of polyhedral cells, e.g., the VTK_POLYHEDRON cells of a vtkUnstructuredGrid, as an explicit table listing the faces that make up each cell, and the point ids that make up each face.

Internally, the table is represented as two vtkCellArray: Faces and FaceLocations.

Faces is a vtkCellArray storing every face as a cell, i.e., the list of its point ids.

FaceLocations is a vtkCellArray storing every polyhedral cell as a cell, i.e., the list of the signed ids of its faces in Faces, see below. A cell that is not polyhedral, e.g., the hexahedron of a vtkUnstructuredGrid that also has polyhedra, has no face.

Thus, for a set of cells consisting of a tetrahedron given by its faces, a hexahedron, and a pyramid given by its faces, the internal arrays will appear as follows:

Topology:
---------
Cell 0: Polyhedron | faces: {0, 1, 2}, {0, 3, 1}, {1, 3, 2}, {2, 3, 0}
Cell 1: Hexahedron | no face
Cell 2: Polyhedron | faces: {4, 7, 6, 5}, {4, 5, 8}, {5, 6, 8}, {6, 7, 8}, {7, 4, 8}
-----------------------
Faces:
Offsets: {0, 3, 6, 9, 12, 16, 19, 22, 25, 28}
Connectivity: {0, 1, 2, 0, 3, 1, 1, 3, 2, 2, 3, 0,
4, 7, 6, 5, 4, 5, 8, 5, 6, 8, 6, 7, 8, 7, 4, 8}
FaceLocations:
Offsets: {0, 4, 4, 9}
Connectivity: {0, 1, 2, 3, 4, 5, 6, 7, 8}

The faces of a cell may also be given by a face stream, as the polyhedra of vtkUnstructuredGrid::InsertNextCell(): the number of points of every face, followed by its point ids, e.g., {3, 0, 1, 2, 3, 0, 3, 1, 3, 1, 3, 2, 3, 2, 3, 0} for the four faces of cell 0 above.

Shared faces

A face used by two cells may be stored once. It is wound for one of them. Another cell lists it in FaceLocations as -(n+1) to traverse face n of Faces in reverse, so that every cell sees its faces with an outward orientation. For example, two tetrahedra sharing a face:

Cell 0: faces: {0, 1, 2}, {0, 3, 1}, {1, 3, 2}, {2, 3, 0}
Cell 1: faces: {0, 2, 1}, {0, 1, 4}, {1, 2, 4}, {2, 0, 4}
Faces:
Offsets: {0, 3, 6, 9, 12, 15, 18, 21}
Connectivity: {0, 1, 2, 0, 3, 1, 1, 3, 2, 2, 3, 0, 0, 1, 4, 1, 2, 4, 2, 0, 4}
FaceLocations:
Offsets: {0, 4, 8}
Connectivity: {0, 1, 2, 3, -1, 4, 5, 6}

Here the first face of cell 1 is face 0 of Faces, reversed, i.e., -1. Use GetFace() or GetFacePoints() to read the faces of a cell with their orientation applied. The ids of FaceLocations must be decoded with DecodeFaceId() before indexing Faces. Sharing is optional and decided face by face, so shared faces and faces copied per cell can be mixed: InsertNextCell() never shares faces, shared faces are given with SetData() by whoever knows them, e.g., a reader, and DuplicateSharedFaces() gives every cell its own copy.

The query methods, e.g., GetCellNumberOfFaces(), GetFaceSize() and GetFacePoints(), dispatch the storage type of the arrays for every call, as vtkCellArray::GetCellAtId(). They are thread-safe if the arrays are not modified, and if every thread gives its own vtkIdList to GetFacePoints(). Whenever many faces are traversed, e.g., in a threaded loop, it is preferable to dispatch the arrays once with Dispatch(), and to read them directly:

struct CountFacePoints : public vtkPolyhedronCellArray::DispatchUtilities
{
template <class FaceOffsetsT, class FaceConnectivityT, class LocationOffsetsT,
class LocationConnectivityT>
vtkIdType operator()(FaceOffsetsT* faceOffsets, FaceConnectivityT*,
LocationOffsetsT* locationOffsets, LocationConnectivityT* locationConnectivity,
vtkIdType cellId)
{
vtkIdType numPoints = 0;
const vtkIdType numFaces = GetCellSize(locationOffsets, cellId);
const auto faceIds = GetCellRange(locationOffsets, locationConnectivity, cellId);
for (int face = 0; face < numFaces; ++face)
{
numPoints += GetFaceSize(faceOffsets, faceIds[face]);
}
return numPoints;
}
};
vtkIdType numPoints = polyhedra->Dispatch(CountFacePoints{}, cellId);
static vtkIdType GetCellSize(OffsetsT *offsets, vtkIdType cellId)
static decltype(vtk::DataArrayValueRange< 1, vtkIdType >(std::declval< ConnectivityT >())) GetCellRange(OffsetsT *offsets, ConnectivityT *conn, vtkIdType cellId)
The utilities of vtkCellArray::DispatchUtilities, and helpers that take the signed face ids of FaceLo...
static vtkIdType GetFaceSize(FaceOffsetsT *faceOffsets, vtkIdType signedFaceId)
The number of points of the face that a signed face id names.
int vtkIdType
Definition vtkType.h:366

The internal arrays of Faces and FaceLocations may store either 32- or 64-bit values, and may be "fixed size", see vtkCellArray, e.g., the faces of hexahedra converted to polyhedra have 4 points, and their cells 6 faces. The storage type of a vtkPolyhedronCellArray is the storage type of Faces and FaceLocations when they have the same one, otherwise Generic. Methods for managing the storage type are:

See also
vtkCellArray vtkUnstructuredGrid vtkPolyhedron
Tests:
vtkPolyhedronCellArray (Tests)

Definition at line 143 of file vtkPolyhedronCellArray.h.

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

Classes

struct  DispatchUtilities
 The utilities of vtkCellArray::DispatchUtilities, and helpers that take the signed face ids of FaceLocations as they are, so that a functor of Dispatch() reads faces in the order of their cell without decoding ids. More...
struct  OrientedFace
 A face of a cell, with its orientation applied lazily: the points are those stored in Faces, read in reverse if Reversed is true. More...

Public Types

using AOSArray32 = vtkCellArray::AOSArray32
using AOSArray64 = vtkCellArray::AOSArray64
using AffineArray32 = vtkCellArray::AffineArray32
using AffineArray64 = vtkCellArray::AffineArray64
using StorageTypes = vtkCellArray::StorageTypes

Public Member Functions

bool AllocateEstimate (vtkIdType numCells, vtkIdType maxFacesPerCell, vtkIdType maxFacePoints)
 Pre-allocate memory to store numCells cells of at most maxFacesPerCell faces of at most maxFacePoints points, as vtkCellArray::AllocateEstimate(): existing data is NOT preserved.
void Initialize ()
 Free any memory and reset to an empty state.
void Reset ()
 Reuse the list without freeing memory.
void Squeeze ()
 Reclaim any extra memory while preserving data.
unsigned long GetActualMemorySize () const
 Return the size, in kibibytes (1024 bytes), of the memory used by this object.
void DeepCopy (vtkPolyhedronCellArray *other)
 Perform a deep copy (no reference counting) of the given polyhedron cell array.
void ShallowCopy (vtkPolyhedronCellArray *other)
 Shallow copy the given polyhedron cell array: its Faces and FaceLocations are shared.
void SetData (vtkCellArray *faces, vtkCellArray *faceLocations)
 Set the internal data arrays to the supplied faces and face locations, which are referenced, not copied.
vtkMTimeType GetMTime () override
 Return the modification time of this object and of its arrays.
int GetMaxCellNumberOfFaces () const
 Return the number of faces of the cell with the most faces.
int GetMaxFaceSize () const
 Return the size of the largest face, i.e., its number of points.
StorageTypes GetStorageType () const noexcept
 Return the storage type of the arrays: the one of Faces and FaceLocations if they have the same, otherwise Generic, see Dispatch().
bool IsStorageShareable () const
 Return true if the points of the faces are stored as vtkIdType, so that GetFace() and GetFacePoints() may return a pointer to them instead of copying them, see their documentation.
int GetCellNumberOfFaces (vtkIdType cellId) const
 Return the number of faces of the cell cellId.
vtkIdType GetSignedFaceId (vtkIdType cellId, int face) const
 Return the signed id, as listed in FaceLocations, of the face face of the cell cellId.
vtkIdType GetStoredFaceId (vtkIdType cellId, int face) const
 Return the id, in Faces, of the face face of the cell cellId, whatever its orientation.
vtkIdType GetFaceSize (vtkIdType cellId, int face) const
 Return the number of points of the face face of the cell cellId.
vtkIdType GetCellNumberOfFacePoints (vtkIdType cellId) const
 Return the number of points of all the faces of the cell cellId, as listed in its faces: a point of several faces is counted several times.
VTK_WRAPEXCLUDE OrientedFace GetFace (vtkIdType cellId, int face, vtkIdList *tempIds) const
 Return the face face of the cell cellId, without copying its points whenever the storage is shareable, see IsStorageShareable().
void GetFacePoints (vtkIdType cellId, int face, vtkIdType &npts, vtkIdType const *&pts, vtkIdList *tempIds) const
 Return the npts point ids pts of the face face of the cell cellId, in the order the cell traverses them, as vtkCellArray::GetCellAtId(): pts points to the internal storage if it is shareable and the face is not reversed, otherwise the point ids are copied into tempIds, which must be given, in which case they are reversed for a reversed face.
void GetFacePoints (vtkIdType cellId, int face, vtkIdList *pts) const
 Copy the point ids of the face face of the cell cellId into pts, in the order the cell traverses them.
void GetFaceStream (vtkIdType cellId, vtkIdList *faceStream) const
 Copy the faces of the cell cellId into faceStream, as a face stream preceded by the number of faces: (numFaces, numFace0Pts, id1, id2, ..., numFace1Pts, id1, id2, ...).
void GetCellFaces (vtkIdType cellId, vtkCellArray *faces) const
 Copy the faces of the cell cellId into faces, one cell per face.
VTK_WRAPEXCLUDE vtkIdType InsertNextCell (vtkIdType numFaces, const vtkIdType *faceStream)
 Insert a cell given by its numFaces faces, as a face stream: (numFace0Pts, id1, id2, ..., numFace1Pts, id1, id2, ...).
vtkIdType InsertNextCell (vtkCellArray *faces)
 Insert a cell given by its faces, one cell of faces per face.
vtkIdType InsertEmptyCells (vtkIdType numCells)
 Insert numCells cells without face, e.g., the cells of a vtkUnstructuredGrid that are not polyhedral.
bool HasSharedFaces () const
 Whether the faces are not one copy per cell, in cell order: a face is used by several cells, traversed in reverse, or listed out of order.
void DuplicateSharedFaces ()
 Give every cell its own copy of its faces, in cell order, a reversed face stored the way its cell traverses it.
void DuplicateSharedFaces (vtkPolyhedronCellArray *source)
 Make this a copy of source in which every cell owns its faces, as DuplicateSharedFaces(), for code or formats that expect the faces of each cell to be its own.
bool Validate () const
 Check the consistency of the arrays, for debugging: every id of FaceLocations refers to a face of Faces, and a face is used by at most two cells.
void Append (vtkPolyhedronCellArray *source, vtkIdType pointOffset=0)
 Append the cells of source into this, as vtkCellArray::Append(): the point ids of its faces are offset by pointOffset, and the ids of its faces by the number of faces of this.
void ExportLegacyFormat (vtkIdTypeArray *faces, vtkIdTypeArray *faceLocations)
 Fill faces and faceLocations with the legacy layout of the faces of the cells, the two vtkIdTypeArray of vtkUnstructuredGrid before VTK 9.4: faces concatenates the face streams of the cells with faces, e.g.
template<typename Functor, typename... Args>
decltype(auto) Dispatch (Functor &&functor, Args &&... args) const
template<typename Functor, typename... Args>
decltype(auto) Dispatch (Functor &&functor, StorageTypes storageType, Args &&... args) const
vtkCellArray * GetFaces () const
 Return the vtkCellArray of the faces, whose cells are the point ids of the faces, and the vtkCellArray of the face locations, whose cells are the signed ids of the faces of the polyhedral cells.
vtkCellArray * GetFaceLocations () const
 Return the vtkCellArray of the faces, whose cells are the point ids of the faces, and the vtkCellArray of the face locations, whose cells are the signed ids of the faces of the polyhedral cells.
vtkIdType GetNumberOfCells () const
 Get the number of cells, and the number of stored faces.
vtkIdType GetNumberOfFaces () const
 Get the number of cells, and the number of stored faces.
bool ConvertTo64BitStorage ()
 Convert the storage of Faces and FaceLocations, see vtkCellArray.
bool ConvertTo32BitStorage ()
 Convert the storage of Faces and FaceLocations, see vtkCellArray.
bool ConvertToDefaultStorage ()
 Convert the storage of Faces and FaceLocations, see vtkCellArray.
bool ConvertToSmallestStorage ()
 Convert the storage of Faces and FaceLocations, see vtkCellArray.
bool ImportLegacyFormat (vtkIdTypeArray *faces, vtkIdTypeArray *faceLocations)
 Import arrays of data with the legacy layout of the faces of the cells, see ExportLegacyFormat(): faces of facesLength values, and faceLocations of one value per cell, numberOfCells values.
bool ImportLegacyFormat (const vtkIdType *faces, vtkIdType facesLength, const vtkIdType *faceLocations, vtkIdType numberOfCells)
 Import arrays of data with the legacy layout of the faces of the cells, see ExportLegacyFormat(): faces of facesLength values, and faceLocations of one value per cell, numberOfCells values.
bool AppendLegacyFormat (vtkIdTypeArray *faces, vtkIdTypeArray *faceLocations, vtkIdType ptOffset=0)
 Append arrays of data with the legacy layout of the faces of the cells, see ExportLegacyFormat() and ImportLegacyFormat().
bool AppendLegacyFormat (const vtkIdType *faces, vtkIdType facesLength, const vtkIdType *faceLocations, vtkIdType numberOfCells, vtkIdType ptOffset=0)
 Append arrays of data with the legacy layout of the faces of the cells, see ExportLegacyFormat() and ImportLegacyFormat().
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.
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)
vtkTypeBool InvokeEvent (unsigned long event)
vtkTypeBool InvokeEvent (const char *event)
std::string GetObjectDescription () const override
 The object description printed in messages and PrintSelf output.
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.
vtkCommand * GetCommand (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.
vtkTypeBool InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
vtkTypeBool InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
virtual void SetObjectName (const std::string &objectName)
 Set/get the name of this object for reporting purposes.
virtual std::string GetObjectName () const
 Set/get the name of this object for reporting purposes.
Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string.
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.
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.
virtual bool UsesGarbageCollector () const
 Indicate whether the class uses vtkGarbageCollector or not.

Static Public Member Functions

static vtkIdType DecodeFaceId (vtkIdType signedFaceId)
 Decode a signed face id of FaceLocations: the id of the face in Faces, and whether the cell traverses it in reverse.
static bool IsReversedFaceId (vtkIdType signedFaceId)
 Decode a signed face id of FaceLocations: the id of the face in Faces, and whether the cell traverses it in reverse.
static vtkIdType EncodeFaceId (vtkIdType storedFaceId, bool reversed)
 Decode a signed face id of FaceLocations: the id of the face in Faces, and whether the cell traverses it in reverse.
Static Public Member Functions inherited from vtkObject
static vtkObject * New ()
 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 (vtkTypeBool 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 vtkTypeBool 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 vtkObjectBase * New ()
 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.

Protected Member Functions

 vtkPolyhedronCellArray ()
 ~vtkPolyhedronCellArray () 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 ReportReferences (vtkGarbageCollector *)
 vtkObjectBase (const vtkObjectBase &)
void operator= (const vtkObjectBase &)
typedef vtkObject Superclass
 Standard methods for instantiation, type information, and printing.
static vtkPolyhedronCellArray * New ()
 Standard methods for instantiation, type information, and printing.
static vtkTypeBool IsTypeOf (const char *type)
 Standard methods for instantiation, type information, and printing.
static vtkPolyhedronCellArray * SafeDownCast (vtkObjectBase *o)
 Standard methods for instantiation, type information, and printing.
virtual vtkTypeBool IsA (const char *type)
 Standard methods for instantiation, type information, and printing.
vtkPolyhedronCellArray * NewInstance () const
 Standard methods for instantiation, type information, and printing.
void PrintSelf (ostream &os, vtkIndent indent) override
 Standard methods for instantiation, type information, and printing.
virtual vtkObjectBase * NewInstanceInternal () const
 Standard methods for instantiation, type information, and printing.

Additional Inherited Members

Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
static vtkReallocingFunction GetCurrentReallocFunction ()
static vtkFreeingFunction GetCurrentFreeFunction ()
static vtkFreeingFunction GetAlternateFreeFunction ()
Protected Attributes inherited from vtkObject
bool Debug
vtkTimeStamp MTime
vtkSubjectHelper * SubjectHelper
std::string ObjectName
Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
vtkWeakPointerBase ** WeakPointers

Member Typedef Documentation

◆ AOSArray32

◆ AOSArray64

◆ AffineArray32

◆ AffineArray64

◆ StorageTypes

◆ Superclass

Standard methods for instantiation, type information, and printing.

Definition at line 226 of file vtkPolyhedronCellArray.h.

Constructor & Destructor Documentation

◆ vtkPolyhedronCellArray()

vtkPolyhedronCellArray::vtkPolyhedronCellArray ( )
protected

◆ ~vtkPolyhedronCellArray()

vtkPolyhedronCellArray::~vtkPolyhedronCellArray ( )
overrideprotected

Member Function Documentation

◆ New()

vtkPolyhedronCellArray * vtkPolyhedronCellArray::New ( )
static

Standard methods for instantiation, type information, and printing.

◆ IsTypeOf()

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

Standard methods for instantiation, type information, and printing.

◆ IsA()

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

Standard methods for instantiation, type information, and printing.

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

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

Standard methods for instantiation, type information, and printing.

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkPolyhedronCellArray::NewInstanceInternal ( ) const
protectedvirtual

Standard methods for instantiation, type information, and printing.

◆ NewInstance()

vtkPolyhedronCellArray * vtkPolyhedronCellArray::NewInstance ( ) const

Standard methods for instantiation, type information, and printing.

◆ PrintSelf()

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

Standard methods for instantiation, type information, and printing.

Reimplemented from vtkObject.

◆ AllocateEstimate()

bool vtkPolyhedronCellArray::AllocateEstimate ( vtkIdType numCells,
vtkIdType maxFacesPerCell,
vtkIdType maxFacePoints )

Pre-allocate memory to store numCells cells of at most maxFacesPerCell faces of at most maxFacePoints points, as vtkCellArray::AllocateEstimate(): existing data is NOT preserved.

Returns true if allocation succeeds.

◆ Initialize()

void vtkPolyhedronCellArray::Initialize ( )

Free any memory and reset to an empty state.

◆ Reset()

void vtkPolyhedronCellArray::Reset ( )

Reuse the list without freeing memory.

◆ Squeeze()

void vtkPolyhedronCellArray::Squeeze ( )

Reclaim any extra memory while preserving data.

◆ GetActualMemorySize()

unsigned long vtkPolyhedronCellArray::GetActualMemorySize ( ) const

Return the size, in kibibytes (1024 bytes), of the memory used by this object.

◆ DeepCopy()

void vtkPolyhedronCellArray::DeepCopy ( vtkPolyhedronCellArray * other)

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

◆ ShallowCopy()

void vtkPolyhedronCellArray::ShallowCopy ( vtkPolyhedronCellArray * other)

Shallow copy the given polyhedron cell array: its Faces and FaceLocations are shared.

◆ SetData()

void vtkPolyhedronCellArray::SetData ( vtkCellArray * faces,
vtkCellArray * faceLocations )

Set the internal data arrays to the supplied faces and face locations, which are referenced, not copied.

Both must be non-null. The ids of faceLocations may be signed, see the class documentation.

◆ GetFaces()

vtkCellArray * vtkPolyhedronCellArray::GetFaces ( ) const
inline

Return the vtkCellArray of the faces, whose cells are the point ids of the faces, and the vtkCellArray of the face locations, whose cells are the signed ids of the faces of the polyhedral cells.

The ids of the face locations must be decoded with DecodeFaceId() to index the faces, or read through the helpers of DispatchUtilities in a functor of Dispatch().

Definition at line 285 of file vtkPolyhedronCellArray.h.

◆ GetFaceLocations()

vtkCellArray * vtkPolyhedronCellArray::GetFaceLocations ( ) const
inline

Return the vtkCellArray of the faces, whose cells are the point ids of the faces, and the vtkCellArray of the face locations, whose cells are the signed ids of the faces of the polyhedral cells.

The ids of the face locations must be decoded with DecodeFaceId() to index the faces, or read through the helpers of DispatchUtilities in a functor of Dispatch().

Definition at line 286 of file vtkPolyhedronCellArray.h.

◆ GetMTime()

vtkMTimeType vtkPolyhedronCellArray::GetMTime ( )
overridevirtual

Return the modification time of this object and of its arrays.

Reimplemented from vtkObject.

◆ GetNumberOfCells()

vtkIdType vtkPolyhedronCellArray::GetNumberOfCells ( ) const
inline

Get the number of cells, and the number of stored faces.

A face shared by several cells is counted once.

Definition at line 299 of file vtkPolyhedronCellArray.h.

◆ GetNumberOfFaces()

vtkIdType vtkPolyhedronCellArray::GetNumberOfFaces ( ) const
inline

Get the number of cells, and the number of stored faces.

A face shared by several cells is counted once.

Definition at line 300 of file vtkPolyhedronCellArray.h.

◆ GetMaxCellNumberOfFaces()

int vtkPolyhedronCellArray::GetMaxCellNumberOfFaces ( ) const
inline

Return the number of faces of the cell with the most faces.

Definition at line 306 of file vtkPolyhedronCellArray.h.

◆ GetMaxFaceSize()

int vtkPolyhedronCellArray::GetMaxFaceSize ( ) const
inline

Return the size of the largest face, i.e., its number of points.

Definition at line 311 of file vtkPolyhedronCellArray.h.

◆ GetStorageType()

StorageTypes vtkPolyhedronCellArray::GetStorageType ( ) const
inlinenoexcept

Return the storage type of the arrays: the one of Faces and FaceLocations if they have the same, otherwise Generic, see Dispatch().

Definition at line 317 of file vtkPolyhedronCellArray.h.

◆ IsStorageShareable()

bool vtkPolyhedronCellArray::IsStorageShareable ( ) const
inline

Return true if the points of the faces are stored as vtkIdType, so that GetFace() and GetFacePoints() may return a pointer to them instead of copying them, see their documentation.

Definition at line 329 of file vtkPolyhedronCellArray.h.

◆ ConvertTo64BitStorage()

bool vtkPolyhedronCellArray::ConvertTo64BitStorage ( )

Convert the storage of Faces and FaceLocations, see vtkCellArray.

Returns true if both are converted. ConvertToSmallestStorage() gives both the same storage type: fixed size only if both can be, and 64-bit if either must be. The signed ids of FaceLocations are taken into account.

◆ ConvertTo32BitStorage()

bool vtkPolyhedronCellArray::ConvertTo32BitStorage ( )

Convert the storage of Faces and FaceLocations, see vtkCellArray.

Returns true if both are converted. ConvertToSmallestStorage() gives both the same storage type: fixed size only if both can be, and 64-bit if either must be. The signed ids of FaceLocations are taken into account.

◆ ConvertToDefaultStorage()

bool vtkPolyhedronCellArray::ConvertToDefaultStorage ( )

Convert the storage of Faces and FaceLocations, see vtkCellArray.

Returns true if both are converted. ConvertToSmallestStorage() gives both the same storage type: fixed size only if both can be, and 64-bit if either must be. The signed ids of FaceLocations are taken into account.

◆ ConvertToSmallestStorage()

bool vtkPolyhedronCellArray::ConvertToSmallestStorage ( )

Convert the storage of Faces and FaceLocations, see vtkCellArray.

Returns true if both are converted. ConvertToSmallestStorage() gives both the same storage type: fixed size only if both can be, and 64-bit if either must be. The signed ids of FaceLocations are taken into account.

◆ DecodeFaceId()

vtkIdType vtkPolyhedronCellArray::DecodeFaceId ( vtkIdType signedFaceId)
inlinestatic

Decode a signed face id of FaceLocations: the id of the face in Faces, and whether the cell traverses it in reverse.

EncodeFaceId() is the inverse, with -(n+1) for the reverse of face n.

Definition at line 350 of file vtkPolyhedronCellArray.h.

◆ IsReversedFaceId()

bool vtkPolyhedronCellArray::IsReversedFaceId ( vtkIdType signedFaceId)
inlinestatic

Decode a signed face id of FaceLocations: the id of the face in Faces, and whether the cell traverses it in reverse.

EncodeFaceId() is the inverse, with -(n+1) for the reverse of face n.

Definition at line 354 of file vtkPolyhedronCellArray.h.

◆ EncodeFaceId()

vtkIdType vtkPolyhedronCellArray::EncodeFaceId ( vtkIdType storedFaceId,
bool reversed )
inlinestatic

Decode a signed face id of FaceLocations: the id of the face in Faces, and whether the cell traverses it in reverse.

EncodeFaceId() is the inverse, with -(n+1) for the reverse of face n.

Definition at line 355 of file vtkPolyhedronCellArray.h.

◆ GetCellNumberOfFaces()

int vtkPolyhedronCellArray::GetCellNumberOfFaces ( vtkIdType cellId) const
inline

Return the number of faces of the cell cellId.

Definition at line 754 of file vtkPolyhedronCellArray.h.

◆ GetSignedFaceId()

vtkIdType vtkPolyhedronCellArray::GetSignedFaceId ( vtkIdType cellId,
int face ) const
inline

Return the signed id, as listed in FaceLocations, of the face face of the cell cellId.

It is negative if the cell traverses the stored face in reverse, see DecodeFaceId(). It must not be used to index Faces directly.

Definition at line 760 of file vtkPolyhedronCellArray.h.

◆ GetStoredFaceId()

vtkIdType vtkPolyhedronCellArray::GetStoredFaceId ( vtkIdType cellId,
int face ) const
inline

Return the id, in Faces, of the face face of the cell cellId, whatever its orientation.

Definition at line 379 of file vtkPolyhedronCellArray.h.

◆ GetFaceSize()

vtkIdType vtkPolyhedronCellArray::GetFaceSize ( vtkIdType cellId,
int face ) const
inline

Return the number of points of the face face of the cell cellId.

Definition at line 766 of file vtkPolyhedronCellArray.h.

◆ GetCellNumberOfFacePoints()

vtkIdType vtkPolyhedronCellArray::GetCellNumberOfFacePoints ( vtkIdType cellId) const

Return the number of points of all the faces of the cell cellId, as listed in its faces: a point of several faces is counted several times.

◆ GetFace()

vtkPolyhedronCellArray::OrientedFace vtkPolyhedronCellArray::GetFace ( vtkIdType cellId,
int face,
vtkIdList * tempIds ) const
inline

Return the face face of the cell cellId, without copying its points whenever the storage is shareable, see IsStorageShareable().

The points are not reversed: OrientedFace::Reversed tells whether to read them in reverse, which operator[] does. tempIds is only used, and must be given, if the storage is not shareable, in which case the points are copied into it, in the order of Faces.

Definition at line 772 of file vtkPolyhedronCellArray.h.

◆ GetFacePoints() [1/2]

void vtkPolyhedronCellArray::GetFacePoints ( vtkIdType cellId,
int face,
vtkIdType & npts,
vtkIdType const *& pts,
vtkIdList * tempIds ) const
inline

Return the npts point ids pts of the face face of the cell cellId, in the order the cell traverses them, as vtkCellArray::GetCellAtId(): pts points to the internal storage if it is shareable and the face is not reversed, otherwise the point ids are copied into tempIds, which must be given, in which case they are reversed for a reversed face.

pts is only valid until the faces, or tempIds, are modified. Prefer GetFace() to avoid the copy of reversed faces.

Definition at line 779 of file vtkPolyhedronCellArray.h.

◆ GetFacePoints() [2/2]

void vtkPolyhedronCellArray::GetFacePoints ( vtkIdType cellId,
int face,
vtkIdList * pts ) const

Copy the point ids of the face face of the cell cellId into pts, in the order the cell traverses them.

◆ GetFaceStream()

void vtkPolyhedronCellArray::GetFaceStream ( vtkIdType cellId,
vtkIdList * faceStream ) const

Copy the faces of the cell cellId into faceStream, as a face stream preceded by the number of faces: (numFaces, numFace0Pts, id1, id2, ..., numFace1Pts, id1, id2, ...).

The faces are oriented for the cell. It is empty if the cell has no face.

◆ GetCellFaces()

void vtkPolyhedronCellArray::GetCellFaces ( vtkIdType cellId,
vtkCellArray * faces ) const

Copy the faces of the cell cellId into faces, one cell per face.

The faces are oriented for the cell.

◆ InsertNextCell() [1/2]

VTK_WRAPEXCLUDE vtkIdType vtkPolyhedronCellArray::InsertNextCell ( vtkIdType numFaces,
const vtkIdType * faceStream )

Insert a cell given by its numFaces faces, as a face stream: (numFace0Pts, id1, id2, ..., numFace1Pts, id1, id2, ...).

The faces are copied, never shared with those of other cells. Returns the id of the cell.

◆ InsertNextCell() [2/2]

vtkIdType vtkPolyhedronCellArray::InsertNextCell ( vtkCellArray * faces)

Insert a cell given by its faces, one cell of faces per face.

The faces are copied, never shared with those of other cells. Returns the id of the cell.

◆ InsertEmptyCells()

vtkIdType vtkPolyhedronCellArray::InsertEmptyCells ( vtkIdType numCells)

Insert numCells cells without face, e.g., the cells of a vtkUnstructuredGrid that are not polyhedral.

Returns the id of the last one, or -1 if numCells is 0.

◆ HasSharedFaces()

bool vtkPolyhedronCellArray::HasSharedFaces ( ) const

Whether the faces are not one copy per cell, in cell order: a face is used by several cells, traversed in reverse, or listed out of order.

The result is cached until this or its vtkCellArrays are modified (call Modified() on a vtkCellArray after writing to its data arrays), so call it once before a threaded loop. When false, every face is read forward, and the points of the faces can be shared without a copy.

◆ DuplicateSharedFaces() [1/2]

void vtkPolyhedronCellArray::DuplicateSharedFaces ( )

Give every cell its own copy of its faces, in cell order, a reversed face stored the way its cell traverses it.

For code that expects the faces of each cell to be its own.

◆ DuplicateSharedFaces() [2/2]

void vtkPolyhedronCellArray::DuplicateSharedFaces ( vtkPolyhedronCellArray * source)

Make this a copy of source in which every cell owns its faces, as DuplicateSharedFaces(), for code or formats that expect the faces of each cell to be its own.

If source has no shared faces, its arrays are shared with this, as by ShallowCopy().

◆ Validate()

bool vtkPolyhedronCellArray::Validate ( ) const

Check the consistency of the arrays, for debugging: every id of FaceLocations refers to a face of Faces, and a face is used by at most two cells.

Returns true if valid, otherwise prints the first error.

◆ Append()

void vtkPolyhedronCellArray::Append ( vtkPolyhedronCellArray * source,
vtkIdType pointOffset = 0 )

Append the cells of source into this, as vtkCellArray::Append(): the point ids of its faces are offset by pointOffset, and the ids of its faces by the number of faces of this.

The orientation of the faces of source is preserved: the signed ids are decoded, offset, and encoded again.

◆ ExportLegacyFormat()

void vtkPolyhedronCellArray::ExportLegacyFormat ( vtkIdTypeArray * faces,
vtkIdTypeArray * faceLocations )

Fill faces and faceLocations with the legacy layout of the faces of the cells, the two vtkIdTypeArray of vtkUnstructuredGrid before VTK 9.4: faces concatenates the face streams of the cells with faces, e.g.

{ f0, n0_0, p0_0_0, ..., n0_1, p0_1_0, ..., f2, n2_0, p2_0_0, ... }

where f0 is the number of faces of cell 0, n0_Y the number of points of its face Y, and p0_Y_Z the Z'th point of face Y, and faceLocations has one value per cell, the index in faces of its face stream, or -1 for a cell without face. For the cells of the class documentation, the face stream of cell 0 has 17 values, and faceLocations is { 0, -1, 17 }. The faces are oriented for their cell, so shared faces are duplicated.

◆ ImportLegacyFormat() [1/2]

bool vtkPolyhedronCellArray::ImportLegacyFormat ( vtkIdTypeArray * faces,
vtkIdTypeArray * faceLocations )

Import arrays of data with the legacy layout of the faces of the cells, see ExportLegacyFormat(): faces of facesLength values, and faceLocations of one value per cell, numberOfCells values.

The faces are not shared.

Returns false if the data is corrupt (for example a face location or f0 being too large for the actual buffer), in which case this is left unchanged. Returns true upon successful conversion.

◆ ImportLegacyFormat() [2/2]

bool vtkPolyhedronCellArray::ImportLegacyFormat ( const vtkIdType * faces,
vtkIdType facesLength,
const vtkIdType * faceLocations,
vtkIdType numberOfCells )

Import arrays of data with the legacy layout of the faces of the cells, see ExportLegacyFormat(): faces of facesLength values, and faceLocations of one value per cell, numberOfCells values.

The faces are not shared.

Returns false if the data is corrupt (for example a face location or f0 being too large for the actual buffer), in which case this is left unchanged. Returns true upon successful conversion.

◆ AppendLegacyFormat() [1/2]

bool vtkPolyhedronCellArray::AppendLegacyFormat ( vtkIdTypeArray * faces,
vtkIdTypeArray * faceLocations,
vtkIdType ptOffset = 0 )

Append arrays of data with the legacy layout of the faces of the cells, see ExportLegacyFormat() and ImportLegacyFormat().

Point ids are offset by ptOffset.

Returns false if the data is corrupt (for example a face location or f0 being too large for the actual buffer), in which case this is left unchanged. Returns true upon successful conversion.

◆ AppendLegacyFormat() [2/2]

bool vtkPolyhedronCellArray::AppendLegacyFormat ( const vtkIdType * faces,
vtkIdType facesLength,
const vtkIdType * faceLocations,
vtkIdType numberOfCells,
vtkIdType ptOffset = 0 )

Append arrays of data with the legacy layout of the faces of the cells, see ExportLegacyFormat() and ImportLegacyFormat().

Point ids are offset by ptOffset.

Returns false if the data is corrupt (for example a face location or f0 being too large for the actual buffer), in which case this is left unchanged. Returns true upon successful conversion.

◆ Dispatch() [1/2]

template<typename Functor, typename... Args>
decltype(auto) vtkPolyhedronCellArray::Dispatch ( Functor && functor,
Args &&... args ) const
inline
Warning
Advanced use only.

The Dispatch method allows efficient traversal of the vtkPolyhedronCellArray internal arrays by dispatching a functor with the actual arrays, as vtkCellArray::Dispatch(): the offsets and the connectivity of Faces, then of FaceLocations, as vtkCellArray::AOSArray32, vtkCellArray::AOSArray64, the vtkCellArray::AffineArray32 and vtkCellArray::AffineArray64 offsets of fixed size storage, or vtkDataArray for Generic storage, see GetStorageType(). The ids read from the connectivity of FaceLocations are signed: pass them to GetFaceSize() and GetOrientedFaceRange() of DispatchUtilities, or decode them with DecodeFaceId() before indexing Faces. The functor may also return a value, and receive additional arguments:

{
template <class FaceOffsetsT, class FaceConnectivityT, class LocationOffsetsT,
class LocationConnectivityT>
vtkIdType operator()(FaceOffsetsT* faceOffsets, FaceConnectivityT* faceConnectivity,
LocationOffsetsT* locationOffsets, LocationConnectivityT* locationConnectivity,
vtkIdType cellId)
{
// Do work with the arrays
}
};
vtkIdType result = polyhedra->Dispatch(Worker{}, cellId);

The returned type is deduced, so every storage type instantiation of the functor must return the same type.

The second overload takes the storage type, which must be the one of GetStorageType(), so that a caller that dispatches many times, e.g., once per cell, gets it only once. Thus, the first additional argument of the first overload can not be a StorageTypes.

const vtkPolyhedronCellArray::StorageTypes storageType = polyhedra->GetStorageType();
for (vtkIdType cellId = 0; cellId < numCells; ++cellId)
{
vtkIdType result = polyhedra->Dispatch(Worker{}, storageType, cellId);
}
vtkCellArray::StorageTypes StorageTypes

Definition at line 604 of file vtkPolyhedronCellArray.h.

◆ Dispatch() [2/2]

template<typename Functor, typename... Args>
decltype(auto) vtkPolyhedronCellArray::Dispatch ( Functor && functor,
StorageTypes storageType,
Args &&... args ) const
inline

Definition at line 610 of file vtkPolyhedronCellArray.h.


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