23 #include <initializer_list>
26 #include <type_traits>
31 [[noreturn]]
void ThrowAssertError(
const std::string& msg)
34 throw std::runtime_error(msg);
37 #define TEST_ASSERT(cond) \
40 std::cout << "=> Check " << #cond << " ... "; \
43 std::cout << "false" << std::endl; \
44 ThrowAssertError(vtkQuoteMacro(__FILE__) ":" vtkQuoteMacro( \
45 __LINE__) ": test assertion failed: (" #cond ")"); \
47 std::cout << "true" << std::endl; \
51 struct CellArrayFactory
57 struct CellArrayFactory<
vtkCellArray::StorageTypes::Int32>
62 cellArray->Use32BitStorage();
63 TEST_ASSERT(cellArray->GetStorageType() == vtkCellArray::StorageTypes::Int32);
69 struct CellArrayFactory<
vtkCellArray::StorageTypes::Int64>
74 cellArray->Use64BitStorage();
75 TEST_ASSERT(cellArray->GetStorageType() == vtkCellArray::StorageTypes::Int64);
81 struct CellArrayFactory<
vtkCellArray::StorageTypes::FixedSizeInt32>
86 cellArray->UseFixedSize32BitStorage(3);
87 TEST_ASSERT(cellArray->GetStorageType() == vtkCellArray::StorageTypes::FixedSizeInt32);
93 struct CellArrayFactory<
vtkCellArray::StorageTypes::FixedSizeInt64>
98 cellArray->UseFixedSize64BitStorage(3);
99 TEST_ASSERT(cellArray->GetStorageType() == vtkCellArray::StorageTypes::FixedSizeInt64);
106 template <
typename OffsetsT,
typename ConnectivityT>
107 [[maybe_unused]]
void operator()(OffsetsT*, ConnectivityT*)
113 template <
typename ConnectivityArrayT,
typename OffsetsArrayT>
114 struct CellArrayFactory<
vtkCellArray::StorageTypes::Generic, ConnectivityArrayT, OffsetsArrayT>
118 using OffsetsValueT =
typename OffsetsArrayT::ValueType;
126 countingOffsets->ConstructBackend(3, 0);
129 placeholderOffsets->InsertNextValue(0);
130 cellArray->SetData(placeholderOffsets, placeholderConn);
136 if (!Dispatcher::Execute(
137 cellArray->GetOffsetsArray(), cellArray->GetConnectivityArray(), worker))
139 TEST_ASSERT(cellArray->GetStorageType() == vtkCellArray::StorageTypes::Generic);
143 TEST_ASSERT(cellArray->GetStorageType() != vtkCellArray::StorageTypes::Generic);
149 template <
bool FixedSize>
157 ids->InsertNextId(0);
158 ids->InsertNextId(1);
159 ids->InsertNextId(2);
161 else if (cellId == 1)
163 ids->InsertNextId(3);
164 ids->InsertNextId(4);
165 ids->InsertNextId(5);
167 else if (cellId == 2)
169 ids->InsertNextId(7);
170 ids->InsertNextId(8);
171 ids->InsertNextId(9);
175 throw std::runtime_error(
"Invalid cellId");
182 ids->InsertNextId(0);
183 ids->InsertNextId(1);
184 ids->InsertNextId(2);
185 ids->InsertNextId(3);
186 ids->InsertNextId(4);
188 else if (cellId == 1)
190 ids->InsertNextId(3);
191 ids->InsertNextId(4);
192 ids->InsertNextId(5);
194 else if (cellId == 2)
196 ids->InsertNextId(7);
197 ids->InsertNextId(8);
198 ids->InsertNextId(9);
199 ids->InsertNextId(4);
200 ids->InsertNextId(2);
201 ids->InsertNextId(1);
205 throw std::runtime_error(
"Invalid cellId");
210 std::reverse(ids->begin(), ids->end());
214 for (
vtkIdType i = 0; i < ids->GetNumberOfIds(); ++i)
216 ids->SetId(i, ids->GetId(i) +
offset);
222 template <
bool FixedSize>
223 void FillCellArray(
vtkCellArray* cellArray,
bool reverse =
false)
230 template <
bool FixedSize>
234 auto ids = GetCellIds<FixedSize>(cellId, reverse,
offset);
239 equal &= pts[i] == ids->GetId(i);
244 template <
bool FixedSize>
252 for (
int i = 0; i < 3; ++i)
255 it->GetCurrentCell(npts, pts);
301 template <
bool FixedSize>
309 FillCellArray<FixedSize>(cellArray);
319 ValidateCellArray<FixedSize>(cellArray);
335 template <
bool FixedSize>
341 FillCellArray<FixedSize>(cellArray);
358 template <
bool FixedSize>
364 FillCellArray<FixedSize>(cellArray);
375 template <
bool FixedSize>
386 FillCellArray<FixedSize>(cellArray);
395 template <
bool FixedSize>
406 FillCellArray<FixedSize>(cellArray);
415 template <
bool FixedSize>
426 FillCellArray<FixedSize>(cellArray);
435 template <
bool FixedSize>
443 iter->GoToFirstCell();
452 iter->GoToFirstCell();
456 FillCellArray<FixedSize>(cellArray);
458 ValidateCellArray<FixedSize>(cellArray);
465 iter->GoToFirstCell();
470 template <
typename OffsetsArrayType,
typename ConnectivityArrayType>
474 using OffsetsValueType =
typename OffsetsArrayType::ValueType;
475 using ConnectivityValueType =
typename ConnectivityArrayType::ValueType;
476 constexpr
bool FixedSize = std::is_base_of_v<vtkAffineArray<OffsetsValueType>, OffsetsArrayType>;
483 countingOffsets->ConstructBackend(GetCellIds<FixedSize>(0)->GetNumberOfIds(), 0);
486 offsets->InsertNextValue(0);
489 auto ids = GetCellIds<FixedSize>(i);
490 offsets->InsertNextValue(offsets->GetValue(i) + ids->GetNumberOfIds());
491 for (
vtkIdType j = 0; j < ids->GetNumberOfIds(); ++j)
493 conn->InsertNextValue(ids->GetId(j));
496 auto offsetsMTtime = offsets->GetMTime();
497 auto connMTtime = conn->GetMTime();
506 std::is_same_v<OffsetsValueType, ConnectivityValueType>)
508 if constexpr (std::is_same_v<OffsetsValueType, vtkTypeInt32>)
516 else if constexpr (std::is_same_v<OffsetsValueType, vtkTypeInt64>)
535 std::is_same_v<OffsetsValueType, ConnectivityValueType>)
537 if constexpr (std::is_same_v<OffsetsValueType, vtkTypeInt32>)
545 else if constexpr (std::is_same_v<OffsetsValueType, vtkTypeInt64>)
575 ValidateCellArray<FixedSize>(test);
583 TestSetDataImpl<vtkCellArray::AOSArray32, vtkCellArray::AOSArray32>(cellArray);
584 TestSetDataImpl<vtkCellArray::AOSArray64, vtkCellArray::AOSArray64>(cellArray);
585 TestSetDataImpl<vtkIdTypeArray, vtkIdTypeArray>(cellArray);
586 TestSetDataImpl<vtkCellArray::AffineArray32, vtkCellArray::AOSArray32>(cellArray);
587 TestSetDataImpl<vtkCellArray::AffineArray64, vtkCellArray::AOSArray64>(cellArray);
588 TestSetDataImpl<vtkAffineArray<vtkIdType>,
vtkIdTypeArray>(cellArray);
589 TestSetDataImpl<vtkTypeInt32Array, vtkTypeInt32Array>(cellArray);
590 TestSetDataImpl<vtkTypeInt64Array, vtkTypeInt64Array>(cellArray);
591 TestSetDataImpl<vtkIntArray, vtkIntArray>(cellArray);
592 TestSetDataImpl<vtkLongArray, vtkLongArray>(cellArray);
593 TestSetDataImpl<vtkLongLongArray, vtkLongLongArray>(cellArray);
594 TestSetDataImpl<vtkAffineArray<vtkTypeInt32>, vtkTypeInt32Array>(cellArray);
595 TestSetDataImpl<vtkAffineArray<vtkTypeInt64>, vtkTypeInt64Array>(cellArray);
596 TestSetDataImpl<vtkAffineArray<int>,
vtkIntArray>(cellArray);
597 TestSetDataImpl<vtkAffineArray<long>,
vtkLongArray>(cellArray);
656 template <
class OffsetsT,
class ConnectivityT>
657 void operator()(OffsetsT*, ConnectivityT*,
bool expect64Bit)
const
659 using ValueType = GetAPIType<OffsetsT>;
661 constexpr
bool is64Bit =
sizeof(ValueType) == 8 &&
678 template <
class OffsetsT,
class ConnectivityT>
679 void operator()(OffsetsT*, ConnectivityT*,
bool expect32Bit)
const
681 using ValueType = GetAPIType<OffsetsT>;
683 constexpr
bool is32Bit =
sizeof(ValueType) == 4 &&
700 template <
class OffsetsT,
class ConnectivityT>
701 void operator()(OffsetsT*, ConnectivityT*,
bool expectFixedSize64Bit)
const
703 using ValueType = GetAPIType<OffsetsT>;
705 constexpr
bool isFixedSize64Bit =
sizeof(ValueType) == 8 &&
709 TEST_ASSERT(isFixedSize64Bit == expectFixedSize64Bit);
722 template <
class OffsetsT,
class ConnectivityT>
723 void operator()(OffsetsT*, ConnectivityT*,
bool expectFixedSize32Bit)
const
725 using ValueType = GetAPIType<OffsetsT>;
727 constexpr
bool isFixedSize32Bit =
sizeof(ValueType) == 4 &&
731 TEST_ASSERT(isFixedSize32Bit == expectFixedSize32Bit);
744 template <
class OffsetsT,
class ConnectivityT>
745 void operator()(OffsetsT*, ConnectivityT*,
bool expectGeneric)
const
747 using ValueType = GetAPIType<OffsetsT>;
749 constexpr
bool isGeneric = !std::is_base_of_v<vtkAffineArray<ValueType>, OffsetsT> &&
750 !std::is_base_of_v<vtkAOSDataArrayTemplate<ValueType>, OffsetsT> &&
751 !std::is_base_of_v<vtkAOSDataArrayTemplate<ValueType>, ConnectivityT> &&
752 std::is_base_of_v<vtkDataArray, OffsetsT> && std::is_base_of_v<vtkDataArray, ConnectivityT>;
770 FillCellArray<true>(cellArray);
783 FillCellArray<true>(cellArray);
796 FillCellArray<true>(cellArray);
809 FillCellArray<true>(cellArray);
822 FillCellArray<true>(cellArray);
835 FillCellArray<true>(cellArray);
854 #ifdef VTK_USE_64BIT_IDS
855 cellArray->
InsertNextCell({ 0, 1,
static_cast<vtkTypeInt64
>(VTK_TYPE_INT32_MAX) + 1 });
857 #endif // VTK_USE_64BIT_IDS
869 #ifdef VTK_USE_64BIT_IDS
870 cellArray->
InsertNextCell({ 0, 1,
static_cast<vtkTypeInt64
>(VTK_TYPE_INT32_MAX) + 1 });
872 #endif // VTK_USE_64BIT_IDS
892 #ifdef VTK_USE_64BIT_IDS
893 cellArray->
InsertNextCell({ 0, 1,
static_cast<vtkTypeInt64
>(VTK_TYPE_INT32_MAX) + 1 });
897 #endif // VTK_USE_64BIT_IDS
909 #ifdef VTK_USE_64BIT_IDS
910 cellArray->
InsertNextCell({ 0, 1,
static_cast<vtkTypeInt64
>(VTK_TYPE_INT32_MAX) + 1 });
914 #endif // VTK_USE_64BIT_IDS
934 #ifdef VTK_USE_64BIT_IDS
935 cellArray->
InsertNextCell({ 0, 1,
static_cast<vtkTypeInt64
>(VTK_TYPE_INT32_MAX) + 1 });
937 #endif // VTK_USE_64BIT_IDS
949 #ifdef VTK_USE_64BIT_IDS
950 cellArray->
InsertNextCell({ 0, 1,
static_cast<vtkTypeInt64
>(VTK_TYPE_INT32_MAX) + 1 });
952 #endif // VTK_USE_64BIT_IDS
972 #ifdef VTK_USE_64BIT_IDS
973 cellArray->
InsertNextCell({ 0, 1,
static_cast<vtkTypeInt64
>(VTK_TYPE_INT32_MAX) + 1 });
977 #endif // VTK_USE_64BIT_IDS
989 #ifdef VTK_USE_64BIT_IDS
990 cellArray->
InsertNextCell({ 0, 1,
static_cast<vtkTypeInt64
>(VTK_TYPE_INT32_MAX) + 1 });
994 #endif // VTK_USE_64BIT_IDS
1003 template <
bool FixedSize>
1008 FillCellArray<FixedSize>(cellArray);
1014 ValidateCellArray<FixedSize>(cellArray);
1017 template <
bool FixedSize>
1022 FillCellArray<FixedSize>(cellArray);
1028 ValidateCellArray<FixedSize>(cellArray);
1035 FillCellArray<true>(cellArray);
1041 ValidateCellArray<true>(cellArray);
1048 FillCellArray<true>(cellArray);
1054 ValidateCellArray<true>(cellArray);
1107 template <
bool FixedSize>
1116 FillCellArray<true>(cellArray);
1119 FillCellArray<true>(cellArray);
1132 template <
bool FixedSize>
1137 FillCellArray<FixedSize>(cellArray);
1145 TEST_ASSERT(ValidateCell<FixedSize>(0, npts, pts));
1148 TEST_ASSERT(ValidateCell<FixedSize>(1, npts, pts));
1151 TEST_ASSERT(ValidateCell<FixedSize>(2, npts, pts));
1156 TEST_ASSERT(ValidateCell<FixedSize>(1, npts, pts));
1159 TEST_ASSERT(ValidateCell<FixedSize>(2, npts, pts));
1164 template <
bool FixedSize>
1169 FillCellArray<FixedSize>(cellArray);
1174 TEST_ASSERT(ValidateCell<FixedSize>(0, ids->GetNumberOfIds(), ids->GetPointer(0)));
1176 TEST_ASSERT(ValidateCell<FixedSize>(1, ids->GetNumberOfIds(), ids->GetPointer(0)));
1178 TEST_ASSERT(ValidateCell<FixedSize>(2, ids->GetNumberOfIds(), ids->GetPointer(0)));
1183 template <
bool FixedSize>
1188 FillCellArray<FixedSize>(cellArray);
1190 auto validate = [&](
const vtkIdType cellId)
1195 TEST_ASSERT(ValidateCell<FixedSize>(cellId, npts, pts));
1207 template <
bool FixedSize>
1212 FillCellArray<FixedSize>(cellArray);
1219 template <
bool FixedSize>
1226 auto ids0 = GetCellIds<FixedSize>(0);
1233 auto ids2 = GetCellIds<FixedSize>(2);
1249 TEST_ASSERT(ValidateCell<FixedSize>(0, npts, pts));
1251 TEST_ASSERT(ValidateCell<FixedSize>(1, npts, pts));
1253 TEST_ASSERT(ValidateCell<FixedSize>(2, npts, pts));
1261 template <
bool FixedSize>
1266 auto ids0 = GetCellIds<FixedSize>(0);
1268 for (
vtkIdType i = 0; i < ids0->GetNumberOfIds(); ++i)
1272 auto ids1 = GetCellIds<FixedSize>(1);
1274 for (
vtkIdType i = 0; i < ids1->GetNumberOfIds(); ++i)
1278 auto ids2 = GetCellIds<FixedSize>(2);
1282 for (
vtkIdType i = 1; i < ids2->GetNumberOfIds(); ++i)
1287 ValidateCellArray<FixedSize>(cellArray);
1290 template <
bool FixedSize>
1295 FillCellArray<FixedSize>(cellArray);
1297 auto validate = [&](
const vtkIdType cellId,
bool reverse)
1302 TEST_ASSERT(ValidateCell<FixedSize>(cellId, npts, pts, reverse));
1322 template <
bool FixedSize>
1327 FillCellArray<FixedSize>(cellArray);
1329 auto validate = [&](
const vtkIdType cellId,
bool reverse)
1334 TEST_ASSERT(ValidateCell<FixedSize>(cellId, npts, pts, reverse));
1342 auto id2Reverse = GetCellIds<FixedSize>(2,
true);
1351 auto id0 = GetCellIds<FixedSize>(0,
true);
1352 cellArray->
ReplaceCellAtId(0, id0->GetNumberOfIds(), id0->GetPointer(0));
1366 template <
bool FixedSize>
1371 auto ids0 = GetCellIds<FixedSize>(0);
1372 auto ids1 = GetCellIds<FixedSize>(1);
1373 auto ids2 = GetCellIds<FixedSize>(2);
1384 template <
bool FixedSize>
1389 FillCellArray<FixedSize>(cellArray);
1395 ValidateCellArray<FixedSize>(other);
1401 template <
bool FixedSize>
1406 FillCellArray<FixedSize>(cellArray);
1412 ValidateCellArray<FixedSize>(other);
1420 template <
bool FixedSize>
1423 FillCellArray<FixedSize>(first,
false);
1425 FillCellArray<FixedSize>(second,
true);
1429 concat->Append(second, 10);
1436 concat->GetCellAtId(cellId, npts, pts);
1437 vtkIdType cellIdQuery = cellId < 3 ? cellId : cellId % 3;
1441 validate(0,
false, 0);
1442 validate(1,
false, 0);
1443 validate(2,
false, 0);
1445 validate(3,
true, 10);
1446 validate(4,
true, 10);
1447 validate(5,
true, 10);
1450 template <
bool FixedSize>
1454 TestAppendImpl<FixedSize>(cellArray, CellArrayFactory<vtkCellArray::Int32>::New());
1457 template <
bool FixedSize>
1461 TestAppendImpl<FixedSize>(cellArray, CellArrayFactory<vtkCellArray::Int64>::New());
1464 template <
bool FixedSize>
1469 FillCellArray<FixedSize>(cellArray);
1475 std::vector<vtkIdType> expected;
1476 for (
int i = 0; i < 3; ++i)
1478 auto ids = GetCellIds<FixedSize>(i);
1482 expected.push_back(ids->
GetId(j));
1485 auto legacyRange = vtk::DataArrayValueRange<1>(legacy);
1486 TEST_ASSERT(std::equal(expected.cbegin(), expected.cend(), legacyRange.cbegin()));
1497 vtkIdType cellIdQuery = cellId < 3 ? cellId : cellId % 3;
1498 TEST_ASSERT(ValidateCell<FixedSize>(cellIdQuery, npts, pts,
false, offset));
1525 cellArray->
AppendLegacyFormat(legacy->GetPointer(0), legacy->GetNumberOfTuples(), 20);
1541 switch (storageType)
1548 return "FixedSizeInt64";
1550 return "FixedSizeInt32";
1560 vtkLogScopeF(INFO,
"Testing %s storage.", StorageTypeToString(StorageType));
1562 TestAllocate(CellArrayFactory<StorageType, ArrayTypes...>::New());
1563 TestResize(CellArrayFactory<StorageType, ArrayTypes...>::New());
1564 TestInitialize(CellArrayFactory<StorageType, ArrayTypes...>::New());
1565 TestReset(CellArrayFactory<StorageType, ArrayTypes...>::New());
1569 TestSqueeze<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1571 TestIsValidOffsets<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1573 TestIsValidConnectivity<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1575 TestGetNumberOfCells<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1576 TestGetNumberOfOffsets<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1577 TestGetNumberOfConnectivityIds<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1579 TestNewIterator<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1580 TestSetData(CellArrayFactory<StorageType, ArrayTypes...>::New());
1582 TestIsStorage64Bit(CellArrayFactory<StorageType, ArrayTypes...>::New());
1583 TestIsStorage32Bit(CellArrayFactory<StorageType, ArrayTypes...>::New());
1584 TestIsStorageFixedSize64Bit(CellArrayFactory<StorageType, ArrayTypes...>::New());
1585 TestIsStorageFixedSize32Bit(CellArrayFactory<StorageType, ArrayTypes...>::New());
1586 TestIsStorageGeneric(CellArrayFactory<StorageType, ArrayTypes...>::New());
1588 TestUse32BitStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1589 TestUse64BitStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1590 TestUseDefaultStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1591 TestUseFixedSize32BitStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1592 TestUseFixedSize64BitStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1593 TestUseFixedSizeDefaultStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1595 TestCanConvertTo32BitStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1596 TestCanConvertTo64BitStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1597 TestCanConvertToFixedSize32BitStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1598 TestCanConvertToFixedSize64BitStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1600 TestConvertTo32BitStorage<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1601 TestConvertTo64BitStorage<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1602 TestConvertToFixedSize32BitStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1603 TestConvertToFixedSize64BitStorage(CellArrayFactory<StorageType, ArrayTypes...>::New());
1605 TestGetOffsetsArray(CellArrayFactory<StorageType, ArrayTypes...>::New());
1606 TestGetConnectivityArray(CellArrayFactory<StorageType, ArrayTypes...>::New());
1608 TestIsHomogeneous<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1610 TestTraversalSizePointer<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1611 TestTraversalIdList<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1613 TestGetCellAtId<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1614 TestGetCellSize<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1616 TestInsertNextCell<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1617 TestIncrementalCellInsertion<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1619 TestReverseCellAtId<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1620 TestReplaceCellAtId<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1622 TestGetMaxCellSize<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1624 TestDeepCopy<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1625 TestShallowCopy<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1627 TestAppend32<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1628 TestAppend64<FixedSize>(CellArrayFactory<StorageType, ArrayTypes...>::New());
1630 TestLegacyFormatImportExportAppend<FixedSize>(
1631 CellArrayFactory<StorageType, ArrayTypes...>::New());
void UseFixedSize32BitStorage(vtkIdType cellSize)
Initialize internal data structures to use 32- or 64-bit storage.
AffineArray32 * GetOffsetsAffineArray32() const
Return the array used to store cell offsets.
void SetTraversalCellId(vtkIdType cellId)
Get/Set the current cellId for traversal.
vtkIdType GetNumberOfOffsets() const override
Get the number of elements in the offsets array.
This class is used in some unit tests to setup a mock data array which derives vtkGenericDataArray.
AOSArray64 * GetConnectivityAOSArray64() const
Return the array used to store the point ids that define the cells' connectivity. ...
void GetCellAtId(vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints, vtkIdList *ptIds) override
Return the point ids for the cell at cellId.
int GetMaxCellSize() override
Returns the size of the largest cell.
vtkIdType GetNumberOfCells() const override
Get the number of cells in the array.
void DeepCopy(vtkAbstractCellArray *ca) override
Perform a deep copy (no reference counting) of the given cell array.
void UseFixedSizeDefaultStorage(vtkIdType cellSize)
Initialize internal data structures to use 32- or 64-bit storage.
vtkIdType GetTraversalCellId()
Get/Set the current cellId for traversal.
vtkDataArray * GetOffsetsArray() const
Return the array used to store cell offsets.
void InsertCellPoint(vtkIdType id)
Used in conjunction with InsertNextCell(npts) to add another point to the list of cells...
dynamic, self-adjusting array of long long
void UseFixedSize64BitStorage(vtkIdType cellSize)
Initialize internal data structures to use 32- or 64-bit storage.
dynamic, self-adjusting array of long
void ShallowCopy(vtkAbstractCellArray *ca) override
Shallow copy ca into this cell array.
AOSArray32 * GetOffsetsAOSArray32() const
Return the array used to store cell offsets.
Dispatch two arrays, restricting the valid code paths to use only array types specified in the ArrayL...
vtkTypeList::Create< vtkAOSDataArrayTemplate< vtkTypeInt32 >, vtkAOSDataArrayTemplate< vtkTypeInt64 >> ConnectivityArrays
List of possible array types used for storage of vtkCellArray.
AOSArray32 * GetConnectivityAOSArray32() const
Return the array used to store the point ids that define the cells' connectivity. ...
vtkIdType GetCellSize(vtkIdType cellId) const override
Return the size of the cell at cellId.
dynamic, self-adjusting array of vtkIdType
void ExportLegacyFormat(vtkIdTypeArray *data)
Fill data with the old-style vtkCellArray data layout, e.g.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
bool CanConvertToFixedSize32BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage. ...
StorageTypes GetStorageType() const noexcept
bool IsStorageFixedSize64Bit() const
vtkIdType GetNumberOfConnectivityIds() const override
Get the size of the connectivity array that stores the point ids.
#define vtkLogScopeFunction(verbosity_name)
void Squeeze()
Reclaim any extra memory while preserving data.
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
vtkTypeList::Create< vtkAOSDataArrayTemplate< vtkTypeInt32 >, vtkAOSDataArrayTemplate< vtkTypeInt64 >, vtkAffineArray< vtkTypeInt32 >, vtkAffineArray< vtkTypeInt64 >> OffsetsArrays
List of possible array types used for storage of vtkCellArray.
virtual void SetComponent(vtkIdType tupleIdx, int compIdx, double value)
Set the data component at the location specified by tupleIdx and compIdx to value.
dynamic, self-adjusting array of int
void UseDefaultStorage()
Initialize internal data structures to use 32- or 64-bit storage.
vtkIdType GetId(vtkIdType i)
Return the id at location i.
void SetId(vtkIdType i, vtkIdType id)
Set the id at location i.
bool CanConvertTo32BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage. ...
bool AllocateExact(vtkIdType numCells, vtkIdType connectivitySize)
Pre-allocate memory in internal data structures.
void AppendLegacyFormat(vtkIdTypeArray *data, vtkIdType ptOffset=0)
Append an array of data with the legacy vtkCellArray layout, e.g.
vtkIdType IsHomogeneous() const override
Check if all cells have the same number of vertices.
void ReverseCellAtId(vtkIdType cellId)
Reverses the order of the point ids for the specified cell.
Array-Of-Structs implementation of vtkGenericDataArray.
bool ResizeExact(vtkIdType numCells, vtkIdType connectivitySize)
ResizeExact() resizes the internal structures to hold numCells total cell offsets and connectivitySiz...
void Use32BitStorage()
Initialize internal data structures to use 32- or 64-bit storage.
vtkIdType GetNumberOfIds() const noexcept
Return the number of id's in the list.
void Dispatch(Functor &&functor, Args &&...args)
bool IsStorage64Bit() const
void Reset()
Reset to an empty state, without freeing any memory.
AffineArray64 * GetOffsetsAffineArray64() const
Return the array used to store cell offsets.
void UpdateCellCount(int npts)
Used in conjunction with InsertNextCell(int npts) and InsertCellPoint() to update the number of point...
bool ConvertToFixedSize64BitStorage()
Convert internal data structures to use 32- or 64-bit storage.
vtkIdType InsertNextCell(vtkCell *cell)
Insert a cell object.
bool IsStorageFixedSize32Bit() const
void Initialize() override
Free any memory and reset to an empty state.
vtkIdType GetCapacity() const
Get the capacity of the array.
object to represent cell connectivity
void ReplaceCellAtId(vtkIdType cellId, vtkIdList *list)
Replaces the point ids for the specified cell with the supplied list.
vtkSmartPointer< T > TakeSmartPointer(T *obj)
Construct a vtkSmartPointer containing obj.
bool ConvertTo64BitStorage()
Convert internal data structures to use 32- or 64-bit storage.
A utility array for wrapping affine functions in implicit arrays.
bool ConvertToFixedSize32BitStorage()
Convert internal data structures to use 32- or 64-bit storage.
Allocate and hold a VTK object.
bool CanConvertTo64BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage. ...
void SetData(AOSArray32 *, AOSArray32 *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
#define vtkLogScopeF(verbosity_name,...)
bool CanConvertToFixedSize64BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage. ...
vtkIdList * GetPointIds()
Return the list of point ids defining the cell.
virtual bool SetNumberOfValues(vtkIdType numValues)
Specify the number of values (tuples * components) for this object to hold.
vtkDataArray * GetConnectivityArray() const
Return the array used to store the point ids that define the cells' connectivity. ...
bool IsValid()
Check that internal storage is consistent and in a valid state.
AOSArray64 * GetOffsetsAOSArray64() const
Return the array used to store cell offsets.
bool IsStorage32Bit() const
vtkCellArrayIterator * NewIterator()
NewIterator returns a new instance of vtkCellArrayIterator that is initialized to point at the first ...
bool ConvertTo32BitStorage()
Convert internal data structures to use 32- or 64-bit storage.
#define TEST_ASSERT(cond)
void Use64BitStorage()
Initialize internal data structures to use 32- or 64-bit storage.
bool IsStorageGeneric() const
STL-compatible iterable ranges that provide access to vtkDataArray elements.
void ImportLegacyFormat(vtkIdTypeArray *data)
Import an array of data with the legacy vtkCellArray layout, e.g.
bool AllocateEstimate(vtkIdType numCells, vtkIdType maxCellSize)
Pre-allocate memory in internal data structures.
int GetNextCell(vtkIdType &npts, vtkIdType const *&pts)
vtkIdType * GetPointer(vtkIdType i)
Get a pointer to a particular data index.