VTK  9.5.20251103
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
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
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
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
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
419 {
420 return static_cast<vtkIdType>(this->Offsets->GetComponent(cellId, 0));
421 }
422
426 void SetOffset(vtkIdType cellId, vtkIdType offset)
427 {
428 this->Offsets->SetComponent(cellId, 0, static_cast<double>(offset));
429 }
430
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);
470 void SetData(vtkAffineTypeInt32Array* offsets, vtkTypeInt32Array* connectivity);
471 void SetData(vtkAffineTypeInt64Array* offsets, vtkTypeInt64Array* connectivity);
473
487 bool SetData(vtkDataArray* offsets, vtkDataArray* connectivity);
488
506 bool SetData(vtkIdType cellSize, vtkDataArray* connectivity);
507
509 {
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
535 bool IsStorageFixedSize64Bit() const { return this->StorageType == StorageTypes::FixedSizeInt64; }
536
540 bool IsStorageFixedSize32Bit() const { return this->StorageType == StorageTypes::FixedSizeInt32; }
541
546 {
547 return this->IsStorageFixedSize32Bit() || this->IsStorageFixedSize64Bit();
548 }
549
553 bool IsStorageGeneric() const { return this->StorageType == StorageTypes::Generic; }
554
561 bool IsStorageShareable() const override
562 {
563 switch (this->StorageType)
564 {
565 case StorageTypes::Int32:
566 case StorageTypes::FixedSizeInt32:
567 return std::is_same_v<vtkTypeInt32, vtkIdType>;
568 case StorageTypes::Int64:
569 case StorageTypes::FixedSizeInt64:
570 return std::is_same_v<vtkTypeInt64, vtkIdType>;
571 case StorageTypes::Generic:
572 default:
573 return false;
574 }
575 }
576
608 {
609 switch (type)
610 {
611 case StorageTypes::Int32:
612 return this->CanConvertTo32BitStorage();
613 case StorageTypes::Int64:
614 return this->CanConvertTo64BitStorage();
615 case StorageTypes::FixedSizeInt32:
616 return this->CanConvertToFixedSize32BitStorage();
617 case StorageTypes::FixedSizeInt64:
618 return this->CanConvertToFixedSize64BitStorage();
619 case StorageTypes::Generic:
620 default:
621 return true;
622 }
623 }
650 {
651 switch (type)
652 {
653 case StorageTypes::Int32:
654 return this->ConvertTo32BitStorage();
655 case StorageTypes::Int64:
656 return this->ConvertTo64BitStorage();
657 case StorageTypes::FixedSizeInt32:
658 return this->ConvertToFixedSize32BitStorage();
659 case StorageTypes::FixedSizeInt64:
660 return this->ConvertToFixedSize64BitStorage();
661 case StorageTypes::Generic:
662 default:
663 return true;
664 }
665 }
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); }
677 {
678 return AffineArrayType32::FastDownCast(this->Offsets);
679 }
681 {
682 return AffineArrayType64::FastDownCast(this->Offsets);
683 }
692 vtkDataArray* GetConnectivityArray() const { return this->Connectivity; }
694 {
695 return ArrayType32::FastDownCast(this->Connectivity);
696 }
698 {
699 return ArrayType64::FastDownCast(this->Connectivity);
700 }
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
799 vtkIdType InsertNextCell(vtkCell* cell);
800
805 vtkIdType InsertNextCell(vtkIdType npts, const vtkIdType* pts) VTK_SIZEHINT(pts, npts);
806
811 vtkIdType InsertNextCell(vtkIdList* pts);
812
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
859 void ReverseCellAtId(vtkIdType cellId) VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells());
860
870 void ReplaceCellAtId(vtkIdType cellId, vtkIdType cellSize, const vtkIdType* cellPoints)
871 VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells()) VTK_SIZEHINT(cellPoints, cellSize);
881 void ReplaceCellPointAtId(vtkIdType cellId, vtkIdType cellPointIndex, vtkIdType newPointId);
882
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
910
914 void Append(vtkCellArray* src, vtkIdType pointOffset = 0);
915
927
940 void ImportLegacyFormat(const vtkIdType* data, vtkIdType len) VTK_SIZEHINT(data, len);
954 void AppendLegacyFormat(vtkIdTypeArray* data, vtkIdType ptOffset = 0);
955 void AppendLegacyFormat(const vtkIdType* data, vtkIdType len, vtkIdType ptOffset = 0)
956 VTK_SIZEHINT(data, len);
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 */
978 {
979 template <class ArrayT>
981
982 template <class OffsetsT>
983 vtkIdType GetNumberOfCells(OffsetsT* offsets)
984 {
985 return offsets->GetNumberOfValues() - 1;
986 }
987
988 template <class ArrayT>
989 static decltype(vtk::DataArrayValueRange<1, vtkIdType>(std::declval<ArrayT>())) GetRange(
990 ArrayT* array)
991 {
992 return vtk::DataArrayValueRange<1, vtkIdType>(array);
993 }
994
995 template <class OffsetsT>
996 static vtkIdType GetBeginOffset(OffsetsT* offsets, vtkIdType cellId)
997 {
998 return static_cast<vtkIdType>(GetRange(offsets)[cellId]);
999 }
1000
1001 template <class OffsetsT>
1002 static vtkIdType GetEndOffset(OffsetsT* offsets, vtkIdType cellId)
1003 {
1004 return static_cast<vtkIdType>(GetRange(offsets)[cellId + 1]);
1005 }
1006
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);
1019 return vtk::DataArrayValueRange<1, vtkIdType>(
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 {
1093 case StorageTypes::Int32:
1094 functor(static_cast<ArrayType32*>(this->Offsets.Get()),
1095 static_cast<ArrayType32*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1096 break;
1097 case StorageTypes::Int64:
1098 functor(static_cast<ArrayType64*>(this->Offsets.Get()),
1099 static_cast<ArrayType64*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1100 break;
1101 case StorageTypes::FixedSizeInt32:
1102 functor(static_cast<AffineArrayType32*>(this->Offsets.Get()),
1103 static_cast<ArrayType32*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1104 break;
1105 case StorageTypes::FixedSizeInt64:
1106 functor(static_cast<AffineArrayType64*>(this->Offsets.Get()),
1107 static_cast<ArrayType64*>(this->Connectivity.Get()), std::forward<Args>(args)...);
1108 break;
1109 case StorageTypes::Generic:
1110 default:
1111 functor(this->Offsets.Get(), this->Connectivity.Get(), std::forward<Args>(args)...);
1112 break;
1113 }
1114 }
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>
1148 {
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));
1160
1161 ArrayType* GetOffsets() { return this->Offsets; }
1162 const ArrayType* GetOffsets() const { return this->Offsets; }
1163
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
1175 CellRangeType GetCellRange(vtkIdType cellId);
1176
1177 friend class vtkCellArray;
1178
1179 protected:
1181 {
1182 this->Connectivity = vtkSmartPointer<ArrayType>::New();
1183 this->Offsets = vtkSmartPointer<ArrayType>::New();
1184 this->Offsets->InsertNextValue(0);
1186 {
1187 this->IsInMemkind = true;
1188 }
1189 }
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
1216 }
1217
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 {
1314 case StorageTypes::Int32:
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 }
1322 case StorageTypes::Int64:
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 }
1330 case StorageTypes::FixedSizeInt32:
1331 case StorageTypes::FixedSizeInt64:
1332 case StorageTypes::Generic:
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 {
1348 case StorageTypes::Int32:
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 }
1356 case StorageTypes::Int64:
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 }
1364 case StorageTypes::FixedSizeInt32:
1365 case StorageTypes::FixedSizeInt64:
1366 case StorageTypes::Generic:
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 {
1382 case StorageTypes::Int32:
1383 {
1385 state.Offsets = ArrayType32::FastDownCast(this->Offsets);
1386 state.Connectivity = ArrayType32::FastDownCast(this->Connectivity);
1387 return functor(state, std::forward<Args>(args)...);
1388 }
1389 case StorageTypes::Int64:
1390 {
1392 state.Offsets = ArrayType64::FastDownCast(this->Offsets);
1393 state.Connectivity = ArrayType64::FastDownCast(this->Connectivity);
1394 return functor(state, std::forward<Args>(args)...);
1395 }
1396 case StorageTypes::FixedSizeInt32:
1397 case StorageTypes::FixedSizeInt64:
1398 case StorageTypes::Generic:
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 {
1413 case StorageTypes::Int32:
1414 {
1416 state.Offsets = ArrayType32::FastDownCast(this->Offsets);
1417 state.Connectivity = ArrayType32::FastDownCast(this->Connectivity);
1418 return functor(state, std::forward<Args>(args)...);
1419 }
1420 case StorageTypes::Int64:
1421 {
1423 state.Offsets = ArrayType64::FastDownCast(this->Offsets);
1424 state.Connectivity = ArrayType64::FastDownCast(this->Connectivity);
1425 return functor(state, std::forward<Args>(args)...);
1426 }
1427 case StorageTypes::FixedSizeInt32:
1428 case StorageTypes::FixedSizeInt64:
1429 case StorageTypes::Generic:
1430 default:
1431 {
1432 vtkWarningMacro("Use Dispatch");
1433 return GetReturnType<Functor, Args...>();
1434 }
1435 }
1436 }
1437
1438#endif // __VTK_WRAP__
1439
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.")
1487 vtkIdType GetSize();
1488
1495 VTK_DEPRECATED_IN_9_6_0("Method incompatible with current internal storage.")
1496 vtkIdType GetNumberOfConnectivityEntries();
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.")
1538 vtkIdType GetTraversalLocation();
1539 VTK_DEPRECATED_IN_9_6_0("Use GetTraversalCellId.")
1540 vtkIdType GetTraversalLocation(vtkIdType npts);
1541 VTK_DEPRECATED_IN_9_6_0("Use SetTraversalCellId.")
1542 void SetTraversalLocation(vtkIdType loc);
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.")
1599 vtkIdTypeArray* GetData();
1600
1601 //=================== End Legacy Methods =====================================
1602
1604
1605protected:
1607 ~vtkCellArray() override;
1608
1611 StorageTypes StorageType;
1612 vtkIdType TraversalCellId{ 0 };
1613
1615
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>
1650{
1651 return vtk::DataArrayValueRange<1>(
1652 this->GetConnectivity(), this->GetBeginOffset(cellId), this->GetEndOffset(cellId));
1653}
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{
1867 if (this->TraversalCellId < this->GetNumberOfCells())
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//----------------------------------------------------------------------------
1931{
1933}
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.
abstract object to represent cell connectivity
virtual vtkIdType GetNumberOfCells() const =0
Get the number of cells in the array.
void GetCellAtId(vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints)
Return the point ids for the cell at cellId.
Encapsulate traversal logic for vtkCellArray.
object to represent cell connectivity
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.
void SetData(vtkAOSDataArrayTemplate< int > *offsets, vtkAOSDataArrayTemplate< int > *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
int GetNextCell(vtkIdType &npts, vtkIdType const *&pts)
void UseFixedSizeDefaultStorage(vtkIdType cellSize)
Initialize internal data structures to use 32- or 64-bit storage.
vtkTypeList::Unique< vtkTypeList::Create< vtkAOSDataArrayTemplate< int >, vtkAOSDataArrayTemplate< long >, vtkAOSDataArrayTemplate< long long > > >::Result InputArrayList
List of possible ArrayTypes that are compatible with internal storage.
vtkIdType GetOffset(vtkIdType cellId) override
Get the offset (into the connectivity) for a specified cell id.
void SetData(vtkTypeInt32Array *offsets, vtkTypeInt32Array *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
AffineArrayType64 * GetOffsetsAffineArray64()
Return the array used to store cell offsets.
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.:
static void SetDefaultStorageIs64Bit(bool val)
Control the default internal storage size.
AffineArrayType32 * GetOffsetsAffineArray32()
Return the array used to store cell offsets.
void DeepCopy(vtkAbstractCellArray *ca) override
Perform a deep copy (no reference counting) of the given cell array.
bool IsValid()
Check that internal storage is consistent and in a valid state.
void AppendLegacyFormat(const vtkIdType *data, vtkIdType len, vtkIdType ptOffset=0)
Append an array of data with the legacy vtkCellArray layout, e.g.:
bool SetData(vtkIdType cellSize, vtkDataArray *connectivity)
Sets the internal arrays to the supported connectivity array with an offsets array automatically gene...
void ShallowCopy(vtkAbstractCellArray *ca) override
Shallow copy ca into this cell array.
vtkIdType GetNumberOfOffsets() const override
Get the number of elements in the offsets array.
bool CanConvertToFixedSize64BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
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.
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.
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...
bool AllocateEstimate(vtkIdType numCells, vtkIdType maxCellSize)
Pre-allocate memory in internal data structures.
vtkTypeInt64Array ArrayType64
void SetData(vtkAffineTypeInt64Array *offsets, vtkTypeInt64Array *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
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 IsStorageShareable() const override
bool IsStorageGeneric() const
void Use64BitStorage()
Initialize internal data structures to use 32- or 64-bit storage.
ArrayType32 * GetConnectivityArray32() const
Return the array used to store the point ids that define the cells' connectivity.
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
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.
vtkCellArrayIterator * NewIterator()
NewIterator returns a new instance of vtkCellArrayIterator that is initialized to point at the first ...
vtkAffineTypeInt64Array AffineArrayType64
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.
bool SetData(vtkDataArray *offsets, vtkDataArray *connectivity)
Sets the internal arrays to the supplied offsets and connectivity arrays.
void Initialize() override
Free any memory and reset to an empty state.
void Squeeze()
Reclaim any extra memory while preserving data.
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.
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 ImportLegacyFormat(const vtkIdType *data, vtkIdType len)
Import an array of data with the legacy vtkCellArray layout, e.g.:
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.:
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.
void SetData(vtkTypeInt64Array *offsets, vtkTypeInt64Array *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
bool IsStorageFixedSize64Bit() const
static bool GetDefaultStorageIs64Bit()
Control the default internal storage size.
int GetMaxCellSize() override
Returns the size of the largest cell.
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.
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 IsHomogeneous() const override
Check if all cells have the same number of vertices.
void UpdateCellCount(int npts)
Used in conjunction with InsertNextCell(int npts) and InsertCellPoint() to update the number of point...
void Dispatch(Functor &&functor, Args &&... args) const
bool IsStorageFixedSize() const
static vtkCellArray * New()
Standard methods for instantiation, type information, and printing.
StorageTypes GetStorageType() const noexcept
ArrayType64 * GetOffsetsArray64() const
Return the array used to store cell offsets.
bool CanConvertToFixedSize32BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
vtkTypeList::Create< ArrayType32, ArrayType64 > StorageArrayList
List of possible array types used for 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.
void ReplaceCellAtId(vtkIdType cellId, vtkIdType cellSize, const vtkIdType *cellPoints)
Replaces the point ids for the specified cell with the supplied list.
ArrayType64 * GetConnectivityArray64() const
Return the array used to store the point ids that define the cells' connectivity.
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
abstract superclass for arrays of numeric data
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 read only array class that wraps an implicit function from integers to any value type supported by ...
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
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
const ArrayType * GetOffsets() const
decltype(vtk::DataArrayValueRange< 1 >(std::declval< ArrayType >())) CellRangeType
CellRangeType GetCellRange(vtkIdType cellId)
vtkIdType GetBeginOffset(vtkIdType cellId) const
vtkIdType GetCellSize(vtkIdType cellId) const
const ArrayType * GetConnectivity() 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
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