VTK  9.5.20251201
vtkCellArray.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
235
236#ifndef vtkCellArray_h
237#define vtkCellArray_h
238
239#include "vtkAbstractCellArray.h"
240#include "vtkCommonDataModelModule.h" // For export macro
241#include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
242
243#include "vtkAffineTypeInt32Array.h" // Needed for inline methods
244#include "vtkAffineTypeInt64Array.h" // Needed for inline methods
245#include "vtkCell.h" // Needed for inline methods
246#include "vtkDataArrayRange.h" // Needed for inline methods
247#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_6_0
248#include "vtkFeatures.h" // for VTK_USE_MEMKIND
249#include "vtkSmartPointer.h" // For vtkSmartPointer
250#include "vtkTypeInt32Array.h" // Needed for inline methods
251#include "vtkTypeInt64Array.h" // Needed for inline methods
252#include "vtkTypeList.h" // Needed for ArrayList definition
253
254#include <cassert> // Needed for assert
255#include <initializer_list> // Needed for API
256#include <type_traits> // Needed for std::is_same
257#include <utility> // Needed for std::forward
258
259VTK_ABI_NAMESPACE_BEGIN
261class vtkIdTypeArray;
262
263class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALMANUAL vtkCellArray : public vtkAbstractCellArray
264{
265public:
266 using ArrayType32 = vtkTypeInt32Array;
267 using ArrayType64 = vtkTypeInt64Array;
268 using AffineArrayType32 = vtkAffineTypeInt32Array;
269 using AffineArrayType64 = vtkAffineTypeInt64Array;
270
272
276 static vtkCellArray* New();
278 void PrintSelf(ostream& os, vtkIndent indent) override;
279 void PrintDebug(ostream& os);
281
283
292 "Use vtkArrayDispatch::StorageOffsetsArrays/StorageConnectivityArrays instead.") =
293 vtkTypeList::Create<ArrayType32, ArrayType64>;
295
297
306 "Use vtkArrayDispatch::InputOffsetsArrays/InputConnectivityArrays instead.") =
310
318 */
319 VTK_DEPRECATED_IN_9_6_0("Use AllocateEstimate or AllocateExact instead.")
320 vtkTypeBool Allocate(vtkIdType sz, vtkIdType vtkNotUsed(ext) = 1000)
321 {
322 return this->AllocateExact(sz, sz) ? 1 : 0;
323 }
324
332 * @sa Squeeze AllocateExact AllocateCopy
333 */
334 bool AllocateEstimate(vtkIdType numCells, vtkIdType maxCellSize)
335 {
336 return this->AllocateExact(numCells, numCells * maxCellSize);
337 }
338
348 bool AllocateExact(vtkIdType numCells, vtkIdType connectivitySize);
349
357 * @sa Squeeze AllocateEstimate AllocateExact
358 */
359 bool AllocateCopy(vtkCellArray* other)
360 {
361 return this->AllocateExact(other->GetNumberOfCells(), other->GetNumberOfConnectivityIds());
362 }
363
373 bool ResizeExact(vtkIdType numCells, vtkIdType connectivitySize);
374
378 void Initialize() override;
379
383 void Reset();
384
390 void Squeeze();
391
402 bool IsValid();
403
407 vtkIdType GetNumberOfCells() const override { return this->Offsets->GetNumberOfValues() - 1; }
408
413 vtkIdType GetNumberOfOffsets() const override { return this->Offsets->GetNumberOfValues(); }
414
416 * Get the offset (into the connectivity) for a specified cell id.
417 */
418 vtkIdType GetOffset(vtkIdType cellId) override
419 {
420 return static_cast<vtkIdType>(this->Offsets->GetComponent(cellId, 0));
421 }
422
424 * Set the offset (into the connectivity) for a specified cell id.
425 */
426 void SetOffset(vtkIdType cellId, vtkIdType offset)
427 {
428 this->Offsets->SetComponent(cellId, 0, static_cast<double>(offset));
429 }
430
432 * Get the size of the connectivity array that stores the point ids.
433 */
435 {
436 return this->Connectivity->GetNumberOfValues();
437 }
438
445
447
458 void SetData(vtkIdTypeArray* offsets, vtkIdTypeArray* connectivity);
463 void SetData(vtkTypeInt32Array* offsets, vtkTypeInt32Array* connectivity);
464 void SetData(vtkTypeInt64Array* offsets, vtkTypeInt64Array* connectivity);
465 void SetData(vtkAffineArray<vtkIdType>* offsets, vtkIdTypeArray* connectivity);
467 void SetData(vtkAffineArray<long>* offsets, vtkAOSDataArrayTemplate<long>* connectivity);
470 void SetData(vtkAffineTypeInt32Array* offsets, vtkTypeInt32Array* connectivity);
471 void SetData(vtkAffineTypeInt64Array* offsets, vtkTypeInt64Array* connectivity);
473
487 bool SetData(vtkDataArray* offsets, vtkDataArray* connectivity);
488
514 Generic,
515 };
516
520 StorageTypes GetStorageType() const noexcept { return this->StorageType; }
521
525 bool IsStorage64Bit() const { return this->StorageType == StorageTypes::Int64; }
526
530 bool IsStorage32Bit() const { return this->StorageType == StorageTypes::Int32; }
531
536
541
543 * @return True if the internal storage is using FixedSize arrays.
544 */
545 bool IsStorageFixedSize() const
546 {
547 return this->IsStorageFixedSize32Bit() || this->IsStorageFixedSize64Bit();
548 }
549
553 bool IsStorageGeneric() const { return this->StorageType == StorageTypes::Generic; }
554
559 * a pointer to vtkIdType can be used.
560 */
561 bool IsStorageShareable() const override
562 {
563 switch (this->StorageType)
564 {
567 return std::is_same_v<vtkTypeInt32, vtkIdType>;
570 return std::is_same_v<vtkTypeInt64, vtkIdType>;
572 default:
573 return false;
574 }
575 }
576
589 void UseFixedSize64BitStorage(vtkIdType cellSize);
592
608 {
609 switch (type)
610 {
612 return this->CanConvertTo32BitStorage();
614 return this->CanConvertTo64BitStorage();
620 default:
621 return true;
622 }
623 }
625
650 {
651 switch (type)
652 {
654 return this->ConvertTo32BitStorage();
656 return this->ConvertTo64BitStorage();
658 return this->ConvertToFixedSize32BitStorage();
660 return this->ConvertToFixedSize64BitStorage();
662 default:
663 return true;
664 }
665 }
667
673 vtkDataArray* GetOffsetsArray() const { return this->Offsets; }
674 ArrayType32* GetOffsetsArray32() const { return ArrayType32::FastDownCast(this->Offsets); }
675 ArrayType64* GetOffsetsArray64() const { return ArrayType64::FastDownCast(this->Offsets); }
676 AffineArrayType32* GetOffsetsAffineArray32()
677 {
678 return AffineArrayType32::FastDownCast(this->Offsets);
679 }
680 AffineArrayType64* GetOffsetsAffineArray64()
681 {
682 return AffineArrayType64::FastDownCast(this->Offsets);
683 }
685
691 */
692 vtkDataArray* GetConnectivityArray() const { return this->Connectivity; }
693 ArrayType32* GetConnectivityArray32() const
694 {
695 return ArrayType32::FastDownCast(this->Connectivity);
696 }
697 ArrayType64* GetConnectivityArray64() const
698 {
699 return ArrayType64::FastDownCast(this->Connectivity);
700 }
702
711 vtkIdType IsHomogeneous() const override;
712
722 void InitTraversal();
723
738 int GetNextCell(vtkIdType& npts, vtkIdType const*& pts) VTK_SIZEHINT(pts, npts);
739
750 int GetNextCell(vtkIdList* pts);
751
762 void GetCellAtId(vtkIdType cellId, vtkIdType& cellSize, vtkIdType const*& cellPoints,
763 vtkIdList* ptIds) VTK_SIZEHINT(cellPoints, cellSize)
764 VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells()) override;
765
771 void GetCellAtId(vtkIdType cellId, vtkIdList* pts)
772 VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells()) override;
773
781 void GetCellAtId(vtkIdType cellId, vtkIdType& cellSize, vtkIdType* cellPoints) VTK_SIZEHINT(
782 cellPoints, cellSize) VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells()) override;
783
787 vtkIdType GetCellPointAtId(vtkIdType cellId, vtkIdType cellPointIndex) const
788 VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells())
789 VTK_EXPECTS(0 <= cellPointIndex && cellPointIndex < this->GetCellSize(cellId));
790
794 vtkIdType GetCellSize(vtkIdType cellId) const override;
795
800
805 vtkIdType InsertNextCell(vtkIdType npts, const vtkIdType* pts) VTK_SIZEHINT(pts, npts);
806
812
818 * `InsertNextCell(int)` overload instead.
819 */
820 vtkIdType InsertNextCell(const std::initializer_list<vtkIdType>& cell)
821 {
822 return this->InsertNextCell(static_cast<vtkIdType>(cell.size()), cell.begin());
823 }
824
831 vtkIdType InsertNextCell(int npts);
832
837 void InsertCellPoint(vtkIdType id);
838
843 void UpdateCellCount(int npts);
844
853 void SetTraversalCellId(vtkIdType cellId);
855
859 void ReverseCellAtId(vtkIdType cellId) VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells());
860
869 void ReplaceCellAtId(vtkIdType cellId, vtkIdList* list);
870 void ReplaceCellAtId(vtkIdType cellId, vtkIdType cellSize, const vtkIdType* cellPoints)
871 VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells()) VTK_SIZEHINT(cellPoints, cellSize);
873
881 void ReplaceCellPointAtId(vtkIdType cellId, vtkIdType cellPointIndex, vtkIdType newPointId);
882
888 * results.
889 */
890 void ReplaceCellAtId(vtkIdType cellId, const std::initializer_list<vtkIdType>& cell)
891 {
892 this->ReplaceCellAtId(cellId, static_cast<vtkIdType>(cell.size()), cell.begin());
893 }
894
899 int GetMaxCellSize() override;
900
904 void DeepCopy(vtkAbstractCellArray* ca) override;
905
909 void ShallowCopy(vtkAbstractCellArray* ca) override;
910
914 void Append(vtkCellArray* src, vtkIdType pointOffset = 0);
915
927
940 void ImportLegacyFormat(const vtkIdType* data, vtkIdType len) VTK_SIZEHINT(data, len);
942
954 void AppendLegacyFormat(vtkIdTypeArray* data, vtkIdType ptOffset = 0);
955 void AppendLegacyFormat(const vtkIdType* data, vtkIdType len, vtkIdType ptOffset = 0)
956 VTK_SIZEHINT(data, len);
958
967 unsigned long GetActualMemorySize() const;
968
969 // The following code is used to support
970
971 // The wrappers get understandably confused by some of the template code below
972#ifndef __VTK_WRAP__
973 /*
974 * Utilities class that every dispatch functor used with Dispatch() must inherit
975 * or optionally use its static methods.
976 */
977 struct DispatchUtilities
979 template <class ArrayT>
982 template <class OffsetsT>
983 vtkIdType GetNumberOfCells(OffsetsT* offsets)
984 {
985 return offsets->GetNumberOfValues() - 1;
986 }
988 template <class ArrayT>
989 static decltype(vtk::DataArrayValueRange<1, vtkIdType>(std::declval<ArrayT>())) GetRange(
990 ArrayT* array)
991 {
993 }
995 template <class OffsetsT>
996 static vtkIdType GetBeginOffset(OffsetsT* offsets, vtkIdType cellId)
997 {
998 return static_cast<vtkIdType>(GetRange(offsets)[cellId]);
999 }
1001 template <class OffsetsT>
1002 static vtkIdType GetEndOffset(OffsetsT* offsets, vtkIdType cellId)
1003 {
1004 return static_cast<vtkIdType>(GetRange(offsets)[cellId + 1]);
1005 }
1007 template <class OffsetsT>
1008 static vtkIdType GetCellSize(OffsetsT* offsets, vtkIdType cellId)
1009 {
1010 auto offsetsRange = GetRange(offsets);
1011 return static_cast<vtkIdType>(offsetsRange[cellId + 1] - offsetsRange[cellId]);
1012 }
1013
1014 template <class OffsetsT, class ConnectivityT>
1015 static decltype(vtk::DataArrayValueRange<1, vtkIdType>(std::declval<ConnectivityT>()))
1016 GetCellRange(OffsetsT* offsets, ConnectivityT* conn, vtkIdType cellId)
1017 {
1018 auto offsetsRange = GetRange(offsets);
1020 conn, offsetsRange[cellId], offsetsRange[cellId + 1]);
1021 }
1022 };
1023
1025
1088 template <typename Functor, typename... Args>
1089 void Dispatch(Functor&& functor, Args&&... args)
1090 {
1091 switch (this->StorageType)
1092 {
1094 functor(static_cast<ArrayType32*>(this->Offsets.Get()),
1095 static_cast<ArrayType32*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1096 break;
1098 functor(static_cast<ArrayType64*>(this->Offsets.Get()),
1099 static_cast<ArrayType64*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1100 break;
1102 functor(static_cast<AffineArrayType32*>(this->Offsets.Get()),
1103 static_cast<ArrayType32*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1104 break;
1106 functor(static_cast<AffineArrayType64*>(this->Offsets.Get()),
1107 static_cast<ArrayType64*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1108 break;
1110 default:
1111 functor(this->Offsets.Get(), this->Connectivity.Get(), std::forward<Args>(args)...);
1112 break;
1113 }
1115 template <typename Functor, typename... Args>
1116 void Dispatch(Functor&& functor, Args&&... args) const
1117 {
1118 switch (this->StorageType)
1119 {
1120 case StorageTypes::Int32:
1121 functor(static_cast<ArrayType32*>(this->Offsets.Get()),
1122 static_cast<ArrayType32*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1123 break;
1124 case StorageTypes::Int64:
1125 functor(static_cast<ArrayType64*>(this->Offsets.Get()),
1126 static_cast<ArrayType64*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1127 break;
1128 case StorageTypes::FixedSizeInt32:
1129 functor(static_cast<AffineArrayType32*>(this->Offsets.Get()),
1130 static_cast<ArrayType32*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1131 break;
1132 case StorageTypes::FixedSizeInt64:
1133 functor(static_cast<AffineArrayType64*>(this->Offsets.Get()),
1134 static_cast<ArrayType64*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1135 break;
1136 case StorageTypes::Generic:
1137 default:
1138 functor(this->Offsets.Get(), this->Connectivity.Get(), std::forward<Args>(args)...);
1139 break;
1140 }
1141 }
1143
1144 // Holds connectivity and offset arrays of the given ArrayType.
1145 // VTK_DEPRECATED_IN_9_6_0("Use DispatchUtilities")
1146 template <typename ArrayT>
1149 using ArrayType = ArrayT;
1150 using ValueType = typename ArrayType::ValueType;
1151 using CellRangeType = decltype(vtk::DataArrayValueRange<1>(std::declval<ArrayType>()));
1152
1153 // We can't just use is_same here, since binary compatible representations
1154 // (e.g. int and long) are distinct types. Instead, ensure that ValueType
1155 // is a signed integer the same size as vtkIdType.
1156 // If this value is true, ValueType pointers may be safely converted to
1157 // vtkIdType pointers via reinterpret cast.
1158 static constexpr bool ValueTypeIsSameAsIdType = std::is_integral<ValueType>::value &&
1159 std::is_signed<ValueType>::value && (sizeof(ValueType) == sizeof(vtkIdType));
1161 ArrayType* GetOffsets() { return this->Offsets; }
1162 const ArrayType* GetOffsets() const { return this->Offsets; }
1164 ArrayType* GetConnectivity() { return this->Connectivity; }
1165 const ArrayType* GetConnectivity() const { return this->Connectivity; }
1166
1167 vtkIdType GetNumberOfCells() const;
1168
1169 vtkIdType GetBeginOffset(vtkIdType cellId) const;
1170
1171 vtkIdType GetEndOffset(vtkIdType cellId) const;
1172
1173 vtkIdType GetCellSize(vtkIdType cellId) const;
1174
1176
1177 friend class vtkCellArray;
1179 protected:
1180 VisitState()
1181 {
1184 this->Offsets->InsertNextValue(0);
1186 {
1187 this->IsInMemkind = true;
1190 ~VisitState() = default;
1191 void* operator new(size_t nSize)
1192 {
1193 void* r;
1194#ifdef VTK_USE_MEMKIND
1196#else
1197 r = malloc(nSize);
1198#endif
1199 return r;
1200 }
1201 void operator delete(void* p)
1202 {
1203#ifdef VTK_USE_MEMKIND
1204 VisitState* a = static_cast<VisitState*>(p);
1205 if (a->IsInMemkind)
1206 {
1208 }
1209 else
1210 {
1211 free(p);
1212 }
1213#else
1214 free(p);
1215#endif
1220
1221 private:
1222 VisitState(const VisitState&) = delete;
1223 VisitState& operator=(const VisitState&) = delete;
1224 bool IsInMemkind = false;
1225 };
1226
1227private: // Helpers that allow Visit to return a value:
1228 template <typename Functor, typename... Args>
1229 using GetReturnType = decltype(std::declval<Functor>()(
1230 std::declval<VisitState<ArrayType32>&>(), std::declval<Args>()...));
1231
1232 template <typename Functor, typename... Args>
1233 struct ReturnsVoid : std::is_same<GetReturnType<Functor, Args...>, void>
1234 {
1235 };
1236
1237public:
1307 template <typename Functor, typename... Args,
1308 typename = typename std::enable_if<ReturnsVoid<Functor, Args...>::value>::type>
1309 VTK_DEPRECATED_IN_9_6_0("Use Dispatch instead")
1310 void Visit(Functor&& functor, Args&&... args)
1311 {
1312 switch (this->StorageType)
1313 {
1315 {
1317 state.Offsets = ArrayType32::FastDownCast(this->Offsets);
1318 state.Connectivity = ArrayType32::FastDownCast(this->Connectivity);
1319 functor(state, std::forward<Args>(args)...);
1320 break;
1321 }
1323 {
1325 state.Offsets = ArrayType64::FastDownCast(this->Offsets);
1326 state.Connectivity = ArrayType64::FastDownCast(this->Connectivity);
1327 functor(state, std::forward<Args>(args)...);
1328 break;
1329 }
1333 default:
1334 {
1335 vtkWarningMacro("Use Dispatch");
1336 break;
1337 }
1338 }
1339 }
1340
1341 template <typename Functor, typename... Args,
1342 typename = typename std::enable_if<ReturnsVoid<Functor, Args...>::value>::type>
1343 VTK_DEPRECATED_IN_9_6_0("Use Dispatch instead")
1344 void Visit(Functor&& functor, Args&&... args) const
1345 {
1346 switch (this->StorageType)
1347 {
1349 {
1351 state.Offsets = ArrayType32::FastDownCast(this->Offsets);
1352 state.Connectivity = ArrayType32::FastDownCast(this->Connectivity);
1353 functor(state, std::forward<Args>(args)...);
1354 break;
1355 }
1357 {
1359 state.Offsets = ArrayType64::FastDownCast(this->Offsets);
1360 state.Connectivity = ArrayType64::FastDownCast(this->Connectivity);
1361 functor(state, std::forward<Args>(args)...);
1362 break;
1363 }
1367 default:
1368 {
1369 vtkWarningMacro("Use Dispatch");
1370 break;
1371 }
1372 }
1373 }
1374
1375 template <typename Functor, typename... Args,
1376 typename = typename std::enable_if<!ReturnsVoid<Functor, Args...>::value>::type>
1377 VTK_DEPRECATED_IN_9_6_0("Use Dispatch instead")
1378 GetReturnType<Functor, Args...> Visit(Functor&& functor, Args&&... args)
1379 {
1380 switch (this->StorageType)
1381 {
1383 {
1385 state.Offsets = ArrayType32::FastDownCast(this->Offsets);
1386 state.Connectivity = ArrayType32::FastDownCast(this->Connectivity);
1387 return functor(state, std::forward<Args>(args)...);
1388 }
1390 {
1392 state.Offsets = ArrayType64::FastDownCast(this->Offsets);
1393 state.Connectivity = ArrayType64::FastDownCast(this->Connectivity);
1394 return functor(state, std::forward<Args>(args)...);
1395 }
1399 default:
1400 {
1401 vtkWarningMacro("Use Dispatch");
1402 return GetReturnType<Functor, Args...>();
1403 }
1404 }
1405 }
1406 template <typename Functor, typename... Args,
1407 typename = typename std::enable_if<!ReturnsVoid<Functor, Args...>::value>::type>
1408 VTK_DEPRECATED_IN_9_6_0("Use Dispatch instead")
1409 GetReturnType<Functor, Args...> Visit(Functor&& functor, Args&&... args) const
1410 {
1411 switch (this->StorageType)
1412 {
1414 {
1416 state.Offsets = ArrayType32::FastDownCast(this->Offsets);
1417 state.Connectivity = ArrayType32::FastDownCast(this->Connectivity);
1418 return functor(state, std::forward<Args>(args)...);
1419 }
1421 {
1423 state.Offsets = ArrayType64::FastDownCast(this->Offsets);
1424 state.Connectivity = ArrayType64::FastDownCast(this->Connectivity);
1425 return functor(state, std::forward<Args>(args)...);
1426 }
1430 default:
1431 {
1432 vtkWarningMacro("Use Dispatch");
1433 return GetReturnType<Functor, Args...>();
1434 }
1435 }
1436 }
1437
1438#endif // __VTK_WRAP__
1439
1441
1449 static void SetDefaultStorageIs64Bit(bool val) { vtkCellArray::DefaultStorageIs64Bit = val; }
1451
1452 //=================== Begin Legacy Methods ===================================
1453 // These should be deprecated at some point as they are confusing or very slow
1454
1461 VTK_DEPRECATED_IN_9_6_0("This call has no effect.")
1462 virtual void SetNumberOfCells(vtkIdType);
1463
1475 VTK_DEPRECATED_IN_9_6_0("Use AllocateEstimate directly instead.")
1476 vtkIdType EstimateSize(vtkIdType numCells, int maxPtsPerCell);
1477
1486 VTK_DEPRECATED_IN_9_6_0("Method incompatible with current internal storage.")
1488
1495 VTK_DEPRECATED_IN_9_6_0("Method incompatible with current internal storage.")
1497
1507 VTK_DEPRECATED_IN_9_6_0("Use GetCellAtId.")
1508 void GetCell(vtkIdType loc, vtkIdType& npts, const vtkIdType*& pts)
1509 VTK_EXPECTS(0 <= loc && loc < GetNumberOfConnectivityEntries()) VTK_SIZEHINT(pts, npts);
1510
1517 VTK_DEPRECATED_IN_9_6_0("Use GetCellAtId.")
1518 void GetCell(vtkIdType loc, vtkIdList* pts)
1519 VTK_EXPECTS(0 <= loc && loc < GetNumberOfConnectivityEntries());
1520
1527 VTK_DEPRECATED_IN_9_6_0("Use GetNumberOfCells.")
1528 vtkIdType GetInsertLocation(int npts);
1529
1537 VTK_DEPRECATED_IN_9_6_0("Use GetTraversalCellId.")
1539 VTK_DEPRECATED_IN_9_6_0("Use GetTraversalCellId.")
1541 VTK_DEPRECATED_IN_9_6_0("Use SetTraversalCellId.")
1544
1552 VTK_DEPRECATED_IN_9_6_0("Use ReverseCellAtId.")
1553 void ReverseCell(vtkIdType loc) VTK_EXPECTS(0 <= loc && loc < GetNumberOfConnectivityEntries());
1554
1566 VTK_DEPRECATED_IN_9_6_0("Use ReplaceCellAtId.")
1567 void ReplaceCell(vtkIdType loc, int npts, const vtkIdType pts[])
1568 VTK_EXPECTS(0 <= loc && loc < GetNumberOfConnectivityEntries()) VTK_SIZEHINT(pts, npts);
1569
1584 VTK_DEPRECATED_IN_9_6_0("Use ImportLegacyFormat or SetData instead.")
1585 void SetCells(vtkIdType ncells, vtkIdTypeArray* cells);
1586
1598 "Use ExportLegacyFormat, or GetOffsetsArray/GetConnectivityArray instead.")
1600
1601 //=================== End Legacy Methods =====================================
1602
1603 friend class vtkCellArrayIterator;
1605protected:
1606 vtkCellArray();
1607 ~vtkCellArray() override;
1613
1615
1616 static bool DefaultStorageIs64Bit;
1617
1618private:
1619 vtkCellArray(const vtkCellArray&) = delete;
1620 void operator=(const vtkCellArray&) = delete;
1621};
1622
1623template <typename ArrayT>
1625{
1626 return this->Offsets->GetNumberOfValues() - 1;
1627}
1628
1629template <typename ArrayT>
1631{
1632 return static_cast<vtkIdType>(this->Offsets->GetValue(cellId));
1633}
1634
1635template <typename ArrayT>
1637{
1638 return static_cast<vtkIdType>(this->Offsets->GetValue(cellId + 1));
1639}
1640
1641template <typename ArrayT>
1643{
1644 return this->GetEndOffset(cellId) - this->GetBeginOffset(cellId);
1645}
1646
1647template <typename ArrayT>
1654VTK_ABI_NAMESPACE_END
1655
1657{
1658VTK_ABI_NAMESPACE_BEGIN
1659
1661{
1662 // Insert full cell
1663 template <class OffsetsT, class ConnectivityT>
1664 void operator()(OffsetsT* offsets, ConnectivityT* conn, const vtkIdType npts,
1665 const vtkIdType pts[], vtkIdType& cellId)
1666 {
1667 using ValueType = GetAPIType<OffsetsT>;
1668 using OffsetsAccessorType = vtkDataArrayAccessor<OffsetsT>;
1669 using ConnectivityAccessorType = vtkDataArrayAccessor<ConnectivityT>;
1670 OffsetsAccessorType offsetsAccesor(offsets);
1671 ConnectivityAccessorType connAccesor(conn);
1672
1673 cellId = offsets->GetNumberOfValues() - 1;
1674
1675 offsetsAccesor.InsertNext(static_cast<ValueType>(conn->GetNumberOfValues() + npts));
1676
1677 for (vtkIdType i = 0; i < npts; ++i)
1678 {
1679 connAccesor.InsertNext(static_cast<ValueType>(pts[i]));
1680 }
1681 }
1682
1683 // Just update offset table (for incremental API)
1684 template <class OffsetsT, class ConnectivityT>
1685 void operator()(OffsetsT* offsets, ConnectivityT* conn, const vtkIdType npts, vtkIdType& cellId)
1686 {
1687 using ValueType = GetAPIType<OffsetsT>;
1688 using AccessorType = vtkDataArrayAccessor<OffsetsT>;
1689 AccessorType offsetsAccesor(offsets);
1690
1691 cellId = offsets->GetNumberOfValues() - 1;
1692
1693 offsetsAccesor.InsertNext(static_cast<ValueType>(conn->GetNumberOfValues() + npts));
1694 }
1695};
1696
1697// for incremental API:
1699{
1700 template <class OffsetsT, class ConnectivityT>
1701 void operator()(OffsetsT* offsets, ConnectivityT* vtkNotUsed(conn), const vtkIdType npts)
1702 {
1703 using ValueType = GetAPIType<OffsetsT>;
1704
1705 auto offsetsRange = GetRange(offsets);
1706 const ValueType cellBegin = offsetsRange[offsets->GetMaxId() - 1];
1707 offsetsRange[offsets->GetMaxId()] = static_cast<ValueType>(cellBegin + npts);
1708 }
1709};
1710
1712{
1713 template <class OffsetsT, class ConnectivityT>
1715 OffsetsT* offsets, ConnectivityT* vtkNotUsed(conn), vtkIdType cellId, vtkIdType& cellSize)
1716 {
1717 cellSize = GetCellSize(offsets, cellId);
1718 }
1719};
1720
1722{
1723 template <class OffsetsT, class ConnectivityT>
1724 void operator()(OffsetsT* offsets, ConnectivityT* conn, const vtkIdType cellId, vtkIdList* ids)
1725 {
1726 auto offsetsRange = GetRange(offsets);
1727 const auto& beginOffset = offsetsRange[cellId];
1728 const auto& endOffset = offsetsRange[cellId + 1];
1729 const vtkIdType cellSize = static_cast<vtkIdType>(endOffset - beginOffset);
1730 const auto cellConnectivity = GetRange(conn).begin() + beginOffset;
1731
1732 // ValueType differs from vtkIdType, so we have to copy into a temporary buffer:
1733 ids->SetNumberOfIds(cellSize);
1734 vtkIdType* idPtr = ids->GetPointer(0);
1735 for (vtkIdType i = 0; i < cellSize; ++i)
1736 {
1737 idPtr[i] = static_cast<vtkIdType>(cellConnectivity[i]);
1738 }
1739 }
1740
1741 template <class OffsetsT, class ConnectivityT>
1742 void operator()(OffsetsT* offsets, ConnectivityT* conn, const vtkIdType cellId,
1743 vtkIdType& cellSize, vtkIdType* cellPoints)
1744 {
1745 auto offsetsRange = GetRange(offsets);
1746 const auto& beginOffset = offsetsRange[cellId];
1747 const auto& endOffset = offsetsRange[cellId + 1];
1748 cellSize = static_cast<vtkIdType>(endOffset - beginOffset);
1749 const auto cellConnectivity = GetRange(conn).begin() + beginOffset;
1750
1751 // ValueType differs from vtkIdType, so we have to copy into a temporary buffer:
1752 for (vtkIdType i = 0; i < cellSize; ++i)
1753 {
1754 cellPoints[i] = static_cast<vtkIdType>(cellConnectivity[i]);
1755 }
1756 }
1757
1758 // SFINAE helper to check if a Functors's connectivity array's memory can be used as a vtkIdType*.
1759 template <typename ConnectivityT>
1761 {
1762 static constexpr bool value =
1763 std::is_base_of_v<vtkAOSDataArrayTemplate<vtkIdType>, ConnectivityT>;
1764 };
1765
1766 template <class OffsetsT, class ConnectivityT>
1767 typename std::enable_if_t<CanShareConnPtr<ConnectivityT>::value, void> operator()(
1768 OffsetsT* offsets, ConnectivityT* conn, const vtkIdType cellId, vtkIdType& cellSize,
1769 vtkIdType const*& cellPoints, vtkIdList* vtkNotUsed(temp))
1770 {
1771 auto offsetsRange = GetRange(offsets);
1772 const auto& beginOffset = offsetsRange[cellId];
1773 const auto& endOffset = offsetsRange[cellId + 1];
1774 cellSize = static_cast<vtkIdType>(endOffset - beginOffset);
1775 // This is safe, see CanShareConnPtr helper above.
1776 cellPoints = conn->GetPointer(beginOffset);
1777 }
1778
1779 template <class OffsetsT, class ConnectivityT>
1780 typename std::enable_if_t<!CanShareConnPtr<ConnectivityT>::value, void> operator()(
1781 OffsetsT* offsets, ConnectivityT* conn, const vtkIdType cellId, vtkIdType& cellSize,
1782 vtkIdType const*& cellPoints, vtkIdList* temp)
1783 {
1784 auto offsetsRange = GetRange(offsets);
1785 const auto& beginOffset = offsetsRange[cellId];
1786 const auto& endOffset = offsetsRange[cellId + 1];
1787 cellSize = static_cast<vtkIdType>(endOffset - beginOffset);
1788 const auto cellConnectivity = GetRange(conn).begin() + beginOffset;
1789
1790 temp->SetNumberOfIds(cellSize);
1791 vtkIdType* tempPtr = temp->GetPointer(0);
1792 for (vtkIdType i = 0; i < cellSize; ++i)
1793 {
1794 tempPtr[i] = static_cast<vtkIdType>(cellConnectivity[i]);
1795 }
1796
1797 cellPoints = tempPtr;
1798 }
1799};
1800
1802{
1803 template <class OffsetsT, class ConnectivityT>
1804 void operator()(OffsetsT* offsets, ConnectivityT* conn, vtkIdType cellId,
1805 vtkIdType cellPointIndex, vtkIdType& pointId)
1806 {
1807 pointId =
1808 static_cast<vtkIdType>(GetRange(conn)[GetBeginOffset(offsets, cellId) + cellPointIndex]);
1809 }
1810};
1811
1813{
1814 template <class OffsetsT, class ConnectivityT>
1815 void operator()(OffsetsT* offsets, ConnectivityT* conn)
1816 {
1817 using ValueType = GetAPIType<OffsetsT>;
1818 using AccessorType = vtkDataArrayAccessor<OffsetsT>;
1819 offsets->Reset();
1820 conn->Reset();
1821 AccessorType accessor(offsets);
1822 ValueType firstOffset = 0;
1823 accessor.InsertNext(firstOffset);
1824 }
1825};
1826
1828{
1829 template <class OffsetsT, class ConnectivityT>
1830 void operator()(OffsetsT* vtkNotUsed(offsets), ConnectivityT* conn, vtkIdType id)
1831 {
1832 using ValueType = GetAPIType<ConnectivityT>;
1833 using AccessorType = vtkDataArrayAccessor<ConnectivityT>;
1834 AccessorType accessor(conn);
1835 accessor.InsertNext(static_cast<ValueType>(id));
1836 }
1837};
1838
1839VTK_ABI_NAMESPACE_END
1840} // end namespace vtkCellArray_detail
1841
1842VTK_ABI_NAMESPACE_BEGIN
1843//----------------------------------------------------------------------------
1845{
1846 this->TraversalCellId = 0;
1847}
1848
1849//----------------------------------------------------------------------------
1850inline int vtkCellArray::GetNextCell(vtkIdType& npts, vtkIdType const*& pts) VTK_SIZEHINT(pts, npts)
1851{
1852 if (this->TraversalCellId < this->GetNumberOfCells())
1853 {
1854 this->GetCellAtId(this->TraversalCellId, npts, pts);
1855 ++this->TraversalCellId;
1856 return 1;
1857 }
1858
1859 npts = 0;
1860 pts = nullptr;
1861 return 0;
1862}
1863
1864//----------------------------------------------------------------------------
1866{
1868 {
1869 this->GetCellAtId(this->TraversalCellId, pts);
1870 ++this->TraversalCellId;
1871 return 1;
1872 }
1873
1874 pts->Reset();
1875 return 0;
1876}
1877//----------------------------------------------------------------------------
1879{
1880 vtkIdType cellSize;
1881 this->Dispatch(vtkCellArray_detail::GetCellSizeImpl{}, cellId, cellSize);
1882 return cellSize;
1883}
1884
1885//----------------------------------------------------------------------------
1886inline void vtkCellArray::GetCellAtId(vtkIdType cellId, vtkIdType& cellSize,
1887 vtkIdType const*& cellPoints, vtkIdList* ptIds) VTK_SIZEHINT(cellPoints, cellSize)
1888{
1889 this->Dispatch(vtkCellArray_detail::GetCellAtIdImpl{}, cellId, cellSize, cellPoints, ptIds);
1890}
1891
1892//----------------------------------------------------------------------------
1894{
1895 this->Dispatch(vtkCellArray_detail::GetCellAtIdImpl{}, cellId, pts);
1896}
1897
1898//----------------------------------------------------------------------------
1899inline void vtkCellArray::GetCellAtId(vtkIdType cellId, vtkIdType& cellSize, vtkIdType* cellPoints)
1900{
1901 this->Dispatch(vtkCellArray_detail::GetCellAtIdImpl{}, cellId, cellSize, cellPoints);
1902}
1903
1904//----------------------------------------------------------------------------
1906{
1907 vtkIdType pointId;
1908 this->Dispatch(vtkCellArray_detail::CellPointAtIdImpl{}, cellId, cellPointIndex, pointId);
1909 return pointId;
1910}
1911
1912//----------------------------------------------------------------------------
1914 VTK_SIZEHINT(pts, npts)
1915{
1916 vtkIdType cellId;
1917 this->Dispatch(vtkCellArray_detail::InsertNextCellImpl{}, npts, pts, cellId);
1918 return cellId;
1919}
1920
1921//----------------------------------------------------------------------------
1923{
1924 vtkIdType cellId;
1926 return cellId;
1927}
1928
1929//----------------------------------------------------------------------------
1934
1935//----------------------------------------------------------------------------
1937{
1939}
1940
1941//----------------------------------------------------------------------------
1943{
1944 vtkIdType cellId;
1945 this->Dispatch(
1947 return cellId;
1948}
1949
1950//----------------------------------------------------------------------------
1952{
1953 vtkIdList* pts = cell->GetPointIds();
1954 vtkIdType cellId;
1955 this->Dispatch(
1957 return cellId;
1958}
1959
1960//----------------------------------------------------------------------------
1962{
1964}
1965
1966VTK_ABI_NAMESPACE_END
1967#endif // vtkCellArray.h
Array-Of-Structs implementation of vtkGenericDataArray.
virtual void Initialize()=0
Free any memory and reset to an empty state.
virtual void DeepCopy(vtkAbstractCellArray *ca)=0
Perform a deep copy (no reference counting) of the given cell array.
virtual bool IsStorageShareable() const =0
virtual int GetMaxCellSize()=0
Returns the size of the largest cell.
virtual vtkIdType IsHomogeneous() const =0
Check if all cells have the same number of vertices.
virtual vtkIdType GetNumberOfCells() const =0
Get the number of cells in the array.
virtual vtkIdType GetOffset(vtkIdType cellId)=0
Get the offset (into the connectivity) for a specified cell id.
void GetCellAtId(vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints)
Return the point ids for the cell at cellId.
virtual vtkIdType GetNumberOfConnectivityIds() const =0
Get the size of the connectivity array that stores the point ids.
virtual void ShallowCopy(vtkAbstractCellArray *ca)=0
Shallow copy ca into this cell array.
virtual vtkIdType GetNumberOfOffsets() const =0
Get the number of elements in the offsets array.
Encapsulate traversal logic for vtkCellArray.
vtkIdType GetCellSize(vtkIdType cellId) const override
Return the size of the cell at cellId.
vtkDataArray * GetOffsetsArray() const
Return the array used to store cell offsets.
int GetNextCell(vtkIdType &npts, vtkIdType const *&pts)
vtkIdTypeArray * GetData()
Return the underlying data as a data array.
void UseFixedSizeDefaultStorage(vtkIdType cellSize)
Initialize internal data structures to use 32- or 64-bit storage.
vtkTypeList::Create< ArrayType32, ArrayType64 > StorageArrayList
List of possible array types used for storage.
vtkIdType GetNumberOfConnectivityEntries()
Return the size of the array that would be returned from ExportLegacyFormat().
void SetData(vtkTypeInt32Array *offsets, vtkTypeInt32Array *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
vtkAffineTypeInt32Array AffineArrayType32
void UseDefaultStorage()
Initialize internal data structures to use 32- or 64-bit storage.
bool AllocateCopy(vtkCellArray *other)
Pre-allocate memory in internal data structures to match the used size of the input vtkCellArray.
void AppendLegacyFormat(vtkIdTypeArray *data, vtkIdType ptOffset=0)
Append an array of data with the legacy vtkCellArray layout, e.g.:
bool IsValid()
Check that internal storage is consistent and in a valid state.
friend class vtkCellArrayIterator
bool CanConvertToFixedSize64BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
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 SetData(vtkAffineTypeInt32Array *offsets, vtkTypeInt32Array *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
vtkIdType GetTraversalCellId()
Get/Set the current cellId for traversal.
void Visit(Functor &&functor, Args &&... args)
vtkTypeInt32Array ArrayType32
vtkIdType GetNumberOfCells() const override
Get the number of cells in the array.
void Reset()
Reuse list.
bool CanConvertToFixedSizeDefaultStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
vtkIdType GetNumberOfConnectivityIds() const override
Get the size of the connectivity array that stores the point ids.
vtkIdType GetTraversalLocation()
Get/Set the current traversal legacy location.
bool CanConvertToStorageType(StorageTypes type) const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
bool ConvertToFixedSize64BitStorage()
Convert internal data structures to use 32- or 64-bit storage.
void SetData(vtkAOSDataArrayTemplate< long long > *offsets, vtkAOSDataArrayTemplate< long long > *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
bool AllocateExact(vtkIdType numCells, vtkIdType connectivitySize)
Pre-allocate memory in internal data structures.
bool ResizeExact(vtkIdType numCells, vtkIdType connectivitySize)
ResizeExact() resizes the internal structures to hold numCells total cell offsets and connectivitySiz...
vtkIdType EstimateSize(vtkIdType numCells, int maxPtsPerCell)
Utility routines help manage memory of cell array.
bool AllocateEstimate(vtkIdType numCells, vtkIdType maxCellSize)
Pre-allocate memory in internal data structures.
void ReverseCell(vtkIdType loc)
Special method inverts ordering of cell at the specified legacy location.
vtkTypeInt64Array ArrayType64
void SetData(vtkAffineArray< long > *offsets, vtkAOSDataArrayTemplate< long > *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
vtkIdType TraversalCellId
void UseFixedSize64BitStorage(vtkIdType cellSize)
Initialize internal data structures to use 32- or 64-bit storage.
void InitTraversal()
bool IsStorageGeneric() const
void Use64BitStorage()
Initialize internal data structures to use 32- or 64-bit storage.
vtkSmartPointer< vtkDataArray > Offsets
vtkDataArray * GetConnectivityArray() const
Return the array used to store the point ids that define the cells' connectivity.
bool ConvertToDefaultStorage()
Convert internal data structures 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.
static bool DefaultStorageIs64Bit
void GetCell(vtkIdType loc, vtkIdType &npts, const vtkIdType *&pts)
Internal method used to retrieve a cell given a legacy offset location.
bool CanConvertTo32BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
void GetCellAtId(vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints, vtkIdList *ptIds) override
Return the point ids for the cell at cellId.
void InsertCellPoint(vtkIdType id)
Used in conjunction with InsertNextCell(npts) to add another point to the list of cells.
unsigned long GetActualMemorySize() const
Return the memory in kibibytes (1024 bytes) consumed by this cell array.
vtkCellArrayIterator * NewIterator()
NewIterator returns a new instance of vtkCellArrayIterator that is initialized to point at the first ...
vtkAffineTypeInt64Array AffineArrayType64
void SetTraversalLocation(vtkIdType loc)
Get/Set the current traversal legacy location.
void ReplaceCellAtId(vtkIdType cellId, vtkIdList *list)
Replaces the point ids for the specified cell with the supplied list.
void UseFixedSize32BitStorage(vtkIdType cellSize)
Initialize internal data structures to use 32- or 64-bit storage.
void ReverseCellAtId(vtkIdType cellId)
Reverses the order of the point ids for the specified cell.
bool IsStorage32Bit() const
void SetData(vtkAffineArray< int > *offsets, vtkAOSDataArrayTemplate< int > *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
void Squeeze()
Reclaim any extra memory while preserving data.
vtkSmartPointer< vtkDataArray > Connectivity
void SetData(vtkIdTypeArray *offsets, vtkIdTypeArray *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
bool IsStorageFixedSize32Bit() const
bool ConvertTo32BitStorage()
Convert internal data structures to use 32- or 64-bit storage.
vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext=1000)
Allocate memory.
bool ConvertToFixedSizeDefaultStorage()
Convert internal data structures to use 32- or 64-bit storage.
bool ConvertToStorageType(StorageTypes type)
Convert internal data structures to use 32- or 64-bit storage.
void SetOffset(vtkIdType cellId, vtkIdType offset)
Set the offset (into the connectivity) for a specified cell id.
bool ConvertToSmallestStorage()
Convert internal data structures to use 32- or 64-bit storage.
void ExportLegacyFormat(vtkIdTypeArray *data)
Fill data with the old-style vtkCellArray data layout, e.g.
bool ConvertTo64BitStorage()
Convert internal data structures to use 32- or 64-bit storage.
bool ConvertToFixedSize32BitStorage()
Convert internal data structures to use 32- or 64-bit storage.
void SetData(vtkAOSDataArrayTemplate< long > *offsets, vtkAOSDataArrayTemplate< long > *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
void SetData(vtkAffineArray< vtkIdType > *offsets, vtkIdTypeArray *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
void ImportLegacyFormat(vtkIdTypeArray *data)
Import an array of data with the legacy vtkCellArray layout, e.g.:
vtkTypeList::Unique< vtkTypeList::Create< vtkAOSDataArrayTemplate< int >, vtkAOSDataArrayTemplate< long >, vtkAOSDataArrayTemplate< long long > > >::Result InputArrayList
List of possible ArrayTypes that are compatible with internal storage.
void Use32BitStorage()
Initialize internal data structures to use 32- or 64-bit storage.
vtkIdType GetCellPointAtId(vtkIdType cellId, vtkIdType cellPointIndex) const
Return the point id at cellPointIndex for the cell at cellId.
void SetTraversalCellId(vtkIdType cellId)
Get/Set the current cellId for traversal.
bool IsStorageFixedSize64Bit() const
static bool GetDefaultStorageIs64Bit()
Control the default internal storage size.
StorageTypes StorageType
vtkIdType InsertNextCell(vtkCell *cell)
Insert a cell object.
void SetData(vtkAffineArray< long long > *offsets, vtkAOSDataArrayTemplate< long long > *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
virtual void SetNumberOfCells(vtkIdType)
Set the number of cells in the array.
vtkNew< vtkIdTypeArray > LegacyData
void Dispatch(Functor &&functor, Args &&... args)
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.
vtkIdType GetInsertLocation(int npts)
Computes the current legacy insertion location within the internal array.
void UpdateCellCount(int npts)
Used in conjunction with InsertNextCell(int npts) and InsertCellPoint() to update the number of point...
bool IsStorageFixedSize() const
void SetCells(vtkIdType ncells, vtkIdTypeArray *cells)
Define multiple cells by providing a connectivity list.
static vtkCellArray * New()
Standard methods for instantiation, type information, and printing.
StorageTypes GetStorageType() const noexcept
void ReplaceCellPointAtId(vtkIdType cellId, vtkIdType cellPointIndex, vtkIdType newPointId)
Replaces the pointId at cellPointIndex of a cell with newPointId.
vtkIdType GetSize()
Get the size of the allocated connectivity array.
bool CanConvertToFixedSize32BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
void Append(vtkCellArray *src, vtkIdType pointOffset=0)
Append cells from src into this.
bool IsStorage64Bit() const
ArrayType32 * GetOffsetsArray32() const
Return the array used to store cell offsets.
bool CanConvertTo64BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
abstract class to specify cell behavior
Definition vtkCell.h:129
vtkIdList * GetPointIds()
Return the list of point ids defining the cell.
Definition vtkCell.h:222
list of point or cell ids
Definition vtkIdList.h:133
void SetNumberOfIds(vtkIdType number)
Specify the number of ids for this object to hold.
vtkIdType GetNumberOfIds() const noexcept
Return the number of id's in the list.
Definition vtkIdList.h:159
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition vtkIdList.h:244
vtkIdType * GetPointer(vtkIdType i)
Get a pointer to a particular data index.
Definition vtkIdList.h:225
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Allocate and hold a VTK object.
Definition vtkNew.h:167
static vtkMallocingFunction GetCurrentMallocFunction()
static vtkFreeingFunction GetAlternateFreeFunction()
static bool GetUsingMemkind()
A global state flag that controls whether vtkObjects are constructed in the usual way (the default) o...
Hold a reference to a vtkObjectBase instance.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
typename detail::GetAPITypeImpl< ArrayType, ForceValueTypeForVtkDataArray >::APIType GetAPIType
VTK_ITER_INLINE auto DataArrayValueRange(const ArrayTypePtr &array, ValueIdType start=-1, ValueIdType end=-1) -> typename detail::SelectValueRange< ArrayTypePtr, TupleSize, ForceValueTypeForVtkDataArray >::type
Generate an stl and for-range compatible range of flat AOS iterators from a vtkDataArray.
vtkIdType GetNumberOfCells(OffsetsT *offsets)
static vtkIdType GetCellSize(OffsetsT *offsets, vtkIdType cellId)
static vtkIdType GetEndOffset(OffsetsT *offsets, vtkIdType cellId)
static decltype(vtk::DataArrayValueRange< 1, vtkIdType >(std::declval< ConnectivityT >())) GetCellRange(OffsetsT *offsets, ConnectivityT *conn, vtkIdType cellId)
static vtkIdType GetBeginOffset(OffsetsT *offsets, vtkIdType cellId)
static decltype(vtk::DataArrayValueRange< 1, vtkIdType >(std::declval< ArrayT >())) GetRange(ArrayT *array)
vtk::GetAPIType< ArrayT, vtkIdType > GetAPIType
vtkIdType GetNumberOfCells() const
vtkIdType GetEndOffset(vtkIdType cellId) const
vtkSmartPointer< ArrayType > Offsets
vtkSmartPointer< ArrayType > Connectivity
static constexpr bool ValueTypeIsSameAsIdType
decltype(vtk::DataArrayValueRange< 1 >(std::declval< ArrayType >())) CellRangeType
CellRangeType GetCellRange(vtkIdType cellId)
vtkIdType GetBeginOffset(vtkIdType cellId) const
vtkIdType GetCellSize(vtkIdType cellId) const
typename ArrayType::ValueType ValueType
ArrayType * GetConnectivity()
void operator()(OffsetsT *offsets, ConnectivityT *conn, vtkIdType cellId, vtkIdType cellPointIndex, vtkIdType &pointId)
void operator()(OffsetsT *offsets, ConnectivityT *conn, const vtkIdType cellId, vtkIdList *ids)
void operator()(OffsetsT *offsets, ConnectivityT *conn, const vtkIdType cellId, vtkIdType &cellSize, vtkIdType *cellPoints)
std::enable_if_t< CanShareConnPtr< ConnectivityT >::value, void > operator()(OffsetsT *offsets, ConnectivityT *conn, const vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints, vtkIdList *temp)
std::enable_if_t<!CanShareConnPtr< ConnectivityT >::value, void > operator()(OffsetsT *offsets, ConnectivityT *conn, const vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints, vtkIdList *temp)
void operator()(OffsetsT *offsets, ConnectivityT *conn, vtkIdType cellId, vtkIdType &cellSize)
void operator()(OffsetsT *offsets, ConnectivityT *conn, vtkIdType id)
void operator()(OffsetsT *offsets, ConnectivityT *conn, const vtkIdType npts, vtkIdType &cellId)
void operator()(OffsetsT *offsets, ConnectivityT *conn, const vtkIdType npts, const vtkIdType pts[], vtkIdType &cellId)
void operator()(OffsetsT *offsets, ConnectivityT *conn)
void operator()(OffsetsT *offsets, ConnectivityT *conn, const vtkIdType npts)
Efficient templated access to vtkDataArray.
Remove all duplicate types from TypeList TList, storing the new list in Result.
int vtkTypeBool
Definition vtkABI.h:64
vtkImplicitArray< vtkAffineImplicitBackend< T >, vtkArrayTypes::VTK_AFFINE_ARRAY > vtkAffineArray
A utility alias for wrapping affine functions in implicit arrays.
#define vtkDataArray
STL-compatible iterable ranges that provide access to vtkDataArray elements.
#define VTK_DEPRECATED_IN_9_6_0(reason)
int vtkIdType
Definition vtkType.h:367
#define VTK_SIZEHINT(...)
#define VTK_EXPECTS(x)
#define VTK_MARSHALMANUAL
#define VTK_NEWINSTANCE