VTK: Common/DataModel/vtkCellArray.h Source File

| VTK 9.3.1

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
138 #ifndef vtkCellArray_h
139 #define vtkCellArray_h
140
141 #include "vtkCommonDataModelModule.h" // For export macro
142 #include "vtkObject.h"
143
144 #include "vtkAOSDataArrayTemplate.h" // Needed for inline methods
145 #include "vtkCell.h" // Needed for inline methods
146 #include "vtkDataArrayRange.h" // Needed for inline methods
147 #include "vtkFeatures.h" // for VTK_USE_MEMKIND
148 #include "vtkSmartPointer.h" // For vtkSmartPointer
149 #include "vtkTypeInt32Array.h" // Needed for inline methods
150 #include "vtkTypeInt64Array.h" // Needed for inline methods
151 #include "vtkTypeList.h" // Needed for ArrayList definition
152
153 #include <cassert> // for assert
154 #include <initializer_list> // for API
155 #include <type_traits> // for std::is_same
156 #include <utility> // for std::forward
157
178 #define VTK_CELL_ARRAY_V2
179
180 VTK_ABI_NAMESPACE_BEGIN
181 class vtkCellArrayIterator;
182 class vtkIdTypeArray;
183
184 class VTKCOMMONDATAMODEL_EXPORT vtkCellArray : public vtkObject
185 {
186 public:
187 using ArrayType32 = vtkTypeInt32Array;
188 using ArrayType64 = vtkTypeInt64Array;
189
191
195 static vtkCellArray* New();
196 vtkTypeMacro(vtkCellArray, vtkObject);
197 void PrintSelf(ostream& os, vtkIndent indent) override;
198 void PrintDebug(ostream& os);
200
209 using StorageArrayList = vtkTypeList::Create<ArrayType32, ArrayType64>;
210
219 using InputArrayList =
220 typename vtkTypeList::Unique<vtkTypeList::Create<vtkAOSDataArrayTemplate<int>,
221 vtkAOSDataArrayTemplate<long>, vtkAOSDataArrayTemplate<long long>>>::Result;
222
231 vtkTypeBool Allocate(vtkIdType sz, vtkIdType vtkNotUsed(ext) = 1000)
232 {
233 return this->AllocateExact(sz, sz) ? 1 : 0;
234 }
235
245 bool AllocateEstimate(vtkIdType numCells, vtkIdType maxCellSize)
246 {
247 return this->AllocateExact(numCells, numCells * maxCellSize);
248 }
249
259 bool AllocateExact(vtkIdType numCells, vtkIdType connectivitySize);
260
270 bool AllocateCopy(vtkCellArray* other)
271 {
272 return this->AllocateExact(other->GetNumberOfCells(), other->GetNumberOfConnectivityIds());
273 }
274
284 bool ResizeExact(vtkIdType numCells, vtkIdType connectivitySize);
285
289 void Initialize();
290
294 void Reset();
295
301 void Squeeze();
302
313 bool IsValid();
314
318 vtkIdType GetNumberOfCells() const
319 {
320 if (this->Storage.Is64Bit())
321 {
322 return this->Storage.GetArrays64().Offsets->GetNumberOfValues() - 1;
323 }
324 else
325 {
326 return this->Storage.GetArrays32().Offsets->GetNumberOfValues() - 1;
327 }
328 }
329
334 vtkIdType GetNumberOfOffsets() const
335 {
336 if (this->Storage.Is64Bit())
337 {
338 return this->Storage.GetArrays64().Offsets->GetNumberOfValues();
339 }
340 else
341 {
342 return this->Storage.GetArrays32().Offsets->GetNumberOfValues();
343 }
344 }
345
349 vtkIdType GetOffset(vtkIdType cellId)
350 {
351 if (this->Storage.Is64Bit())
352 {
353 return this->Storage.GetArrays64().Offsets->GetValue(cellId);
354 }
355 else
356 {
357 return this->Storage.GetArrays32().Offsets->GetValue(cellId);
358 }
359 }
360
367 vtkIdType GetNumberOfConnectivityIds() const
368 {
369 if (this->Storage.Is64Bit())
370 {
371 return this->Storage.GetArrays64().Connectivity->GetNumberOfValues();
372 }
373 else
374 {
375 return this->Storage.GetArrays32().Connectivity->GetNumberOfValues();
376 }
377 }
378
384 VTK_NEWINSTANCE vtkCellArrayIterator* NewIterator();
385
396 void SetData(vtkIdTypeArray* offsets, vtkIdTypeArray* connectivity);
397 void SetData(vtkAOSDataArrayTemplate<int>* offsets, vtkAOSDataArrayTemplate<int>* connectivity);
398 void SetData(vtkAOSDataArrayTemplate<long>* offsets, vtkAOSDataArrayTemplate<long>* connectivity);
399 void SetData(
400 vtkAOSDataArrayTemplate<long long>* offsets, vtkAOSDataArrayTemplate<long long>* connectivity);
401 void SetData(vtkTypeInt32Array* offsets, vtkTypeInt32Array* connectivity);
402 void SetData(vtkTypeInt64Array* offsets, vtkTypeInt64Array* connectivity);
417 bool SetData(vtkDataArray* offsets, vtkDataArray* connectivity);
418
432 bool SetData(vtkIdType cellSize, vtkDataArray* connectivity);
433
438 bool IsStorage64Bit() const { return this->Storage.Is64Bit(); }
439
446 bool IsStorageShareable() const
447 {
448 if (this->Storage.Is64Bit())
449 {
450 return VisitState<ArrayType64>::ValueTypeIsSameAsIdType;
451 }
452 else
453 {
454 return VisitState<ArrayType32>::ValueTypeIsSameAsIdType;
455 }
456 }
457
466 void Use32BitStorage();
467 void Use64BitStorage();
468 void UseDefaultStorage();
479 bool CanConvertTo32BitStorage() const;
480 bool CanConvertTo64BitStorage() const;
481 bool CanConvertToDefaultStorage() const;
500 bool ConvertTo32BitStorage();
501 bool ConvertTo64BitStorage();
502 bool ConvertToDefaultStorage();
503 bool ConvertToSmallestStorage();
511 vtkDataArray* GetOffsetsArray()
512 {
513 if (this->Storage.Is64Bit())
514 {
515 return this->GetOffsetsArray64();
516 }
517 else
518 {
519 return this->GetOffsetsArray32();
520 }
521 }
522 ArrayType32* GetOffsetsArray32() { return this->Storage.GetArrays32().Offsets; }
523 ArrayType64* GetOffsetsArray64() { return this->Storage.GetArrays64().Offsets; }
532 vtkDataArray* GetConnectivityArray()
533 {
534 if (this->Storage.Is64Bit())
535 {
536 return this->GetConnectivityArray64();
537 }
538 else
539 {
540 return this->GetConnectivityArray32();
541 }
542 }
543 ArrayType32* GetConnectivityArray32() { return this->Storage.GetArrays32().Connectivity; }
544 ArrayType64* GetConnectivityArray64() { return this->Storage.GetArrays64().Connectivity; }
555 vtkIdType IsHomogeneous();
556
566 void InitTraversal();
567
582 int GetNextCell(vtkIdType& npts, vtkIdType const*& pts) VTK_SIZEHINT(pts, npts);
583
594 int GetNextCell(vtkIdList* pts);
595
606 void GetCellAtId(vtkIdType cellId, vtkIdType& cellSize, vtkIdType const*& cellPoints)
607 VTK_SIZEHINT(cellPoints, cellSize) VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells());
608
618 void GetCellAtId(
619 vtkIdType cellId, vtkIdType& cellSize, vtkIdType const*& cellPoints, vtkIdList* ptIds)
620 VTK_SIZEHINT(cellPoints, cellSize) VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells());
621
627 void GetCellAtId(vtkIdType cellId, vtkIdList* pts)
628 VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells());
629
633 vtkIdType GetCellSize(vtkIdType cellId) const;
634
638 vtkIdType InsertNextCell(vtkCell* cell);
639
644 vtkIdType InsertNextCell(vtkIdType npts, const vtkIdType* pts) VTK_SIZEHINT(pts, npts);
645
650 vtkIdType InsertNextCell(vtkIdList* pts);
651
659 vtkIdType InsertNextCell(const std::initializer_list<vtkIdType>& cell)
660 {
661 return this->InsertNextCell(static_cast<vtkIdType>(cell.size()), cell.begin());
662 }
663
670 vtkIdType InsertNextCell(int npts);
671
676 void InsertCellPoint(vtkIdType id);
677
682 void UpdateCellCount(int npts);
683
691 vtkIdType GetTraversalCellId();
692 void SetTraversalCellId(vtkIdType cellId);
698 void ReverseCellAtId(vtkIdType cellId) VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells());
699
708 void ReplaceCellAtId(vtkIdType cellId, vtkIdList* list);
709 void ReplaceCellAtId(vtkIdType cellId, vtkIdType cellSize, const vtkIdType* cellPoints)
710 VTK_EXPECTS(0 <= cellId && cellId < GetNumberOfCells()) VTK_SIZEHINT(cellPoints, cellSize);
720 void ReplaceCellPointAtId(vtkIdType cellId, vtkIdType cellPointIndex, vtkIdType newPointId);
721
729 void ReplaceCellAtId(vtkIdType cellId, const std::initializer_list<vtkIdType>& cell)
730 {
731 return this->ReplaceCellAtId(cellId, static_cast<vtkIdType>(cell.size()), cell.begin());
732 }
733
738 int GetMaxCellSize();
739
743 void DeepCopy(vtkCellArray* ca);
744
748 void ShallowCopy(vtkCellArray* ca);
749
753 void Append(vtkCellArray* src, vtkIdType pointOffset = 0);
754
765 void ExportLegacyFormat(vtkIdTypeArray* data);
766
778 void ImportLegacyFormat(vtkIdTypeArray* data);
779 void ImportLegacyFormat(const vtkIdType* data, vtkIdType len) VTK_SIZEHINT(data, len);
793 void AppendLegacyFormat(vtkIdTypeArray* data, vtkIdType ptOffset = 0);
794 void AppendLegacyFormat(const vtkIdType* data, vtkIdType len, vtkIdType ptOffset = 0)
795 VTK_SIZEHINT(data, len);
806 unsigned long GetActualMemorySize() const;
807
808 // The following code is used to support
809
810 // The wrappers get understandably confused by some of the template code below
811 #ifndef __VTK_WRAP__
812
813 // Holds connectivity and offset arrays of the given ArrayType.
814 template <typename ArrayT>
815 struct VisitState
816 {
817 using ArrayType = ArrayT;
818 using ValueType = typename ArrayType::ValueType;
819 using CellRangeType = decltype(vtk::DataArrayValueRange<1>(std::declval<ArrayType>()));
820
821 // We can't just use is_same here, since binary compatible representations
822 // (e.g. int and long) are distinct types. Instead, ensure that ValueType
823 // is a signed integer the same size as vtkIdType.
824 // If this value is true, ValueType pointers may be safely converted to
825 // vtkIdType pointers via reinterpret cast.
826 static constexpr bool ValueTypeIsSameAsIdType = std::is_integral<ValueType>::value &&
827 std::is_signed<ValueType>::value && (sizeof(ValueType) == sizeof(vtkIdType));
828
829 ArrayType* GetOffsets() { return this->Offsets; }
830 const ArrayType* GetOffsets() const { return this->Offsets; }
831
832 ArrayType* GetConnectivity() { return this->Connectivity; }
833 const ArrayType* GetConnectivity() const { return this->Connectivity; }
834
835 vtkIdType GetNumberOfCells() const;
836
837 vtkIdType GetBeginOffset(vtkIdType cellId) const;
838
839 vtkIdType GetEndOffset(vtkIdType cellId) const;
840
841 vtkIdType GetCellSize(vtkIdType cellId) const;
842
843 CellRangeType GetCellRange(vtkIdType cellId);
844
845 friend class vtkCellArray;
846
847 protected:
848 VisitState()
849 {
850 this->Connectivity = vtkSmartPointer<ArrayType>::New();
851 this->Offsets = vtkSmartPointer<ArrayType>::New();
852 this->Offsets->InsertNextValue(0);
853 if (vtkObjectBase::GetUsingMemkind())
854 {
855 this->IsInMemkind = true;
856 }
857 }
858 ~VisitState() = default;
859 void* operator new(size_t nSize)
860 {
861 void* r;
862 #ifdef VTK_USE_MEMKIND
863 r = vtkObjectBase::GetCurrentMallocFunction()(nSize);
864 #else
865 r = malloc(nSize);
866 #endif
867 return r;
868 }
869 void operator delete(void* p)
870 {
871 #ifdef VTK_USE_MEMKIND
872 VisitState* a = static_cast<VisitState*>(p);
873 if (a->IsInMemkind)
874 {
875 vtkObjectBase::GetAlternateFreeFunction()(p);
876 }
877 else
878 {
879 free(p);
880 }
881 #else
882 free(p);
883 #endif
884 }
885
886 vtkSmartPointer<ArrayType> Connectivity;
887 vtkSmartPointer<ArrayType> Offsets;
888
889 private:
890 VisitState(const VisitState&) = delete;
891 VisitState& operator=(const VisitState&) = delete;
892 bool IsInMemkind = false;
893 };
894
895 private: // Helpers that allow Visit to return a value:
896 template <typename Functor, typename... Args>
897 using GetReturnType = decltype(
898 std::declval<Functor>()(std::declval<VisitState<ArrayType32>&>(), std::declval<Args>()...));
899
900 template <typename Functor, typename... Args>
901 struct ReturnsVoid : std::is_same<GetReturnType<Functor, Args...>, void>
902 {
903 };
904
905 public:
975 template <typename Functor, typename... Args,
976 typename = typename std::enable_if<ReturnsVoid<Functor, Args...>::value>::type>
977 void Visit(Functor&& functor, Args&&... args)
978 {
979 if (this->Storage.Is64Bit())
980 {
981 // If you get an error on the next line, a call to Visit(functor, Args...)
982 // is being called with arguments that do not match the functor's call
983 // signature. See the Visit documentation for details.
984 functor(this->Storage.GetArrays64(), std::forward<Args>(args)...);
985 }
986 else
987 {
988 // If you get an error on the next line, a call to Visit(functor, Args...)
989 // is being called with arguments that do not match the functor's call
990 // signature. See the Visit documentation for details.
991 functor(this->Storage.GetArrays32(), std::forward<Args>(args)...);
992 }
993 }
994
995 template <typename Functor, typename... Args,
996 typename = typename std::enable_if<ReturnsVoid<Functor, Args...>::value>::type>
997 void Visit(Functor&& functor, Args&&... args) const
998 {
999 if (this->Storage.Is64Bit())
1000 {
1001 // If you get an error on the next line, a call to Visit(functor, Args...)
1002 // is being called with arguments that do not match the functor's call
1003 // signature. See the Visit documentation for details.
1004 functor(this->Storage.GetArrays64(), std::forward<Args>(args)...);
1005 }
1006 else
1007 {
1008 // If you get an error on the next line, a call to Visit(functor, Args...)
1009 // is being called with arguments that do not match the functor's call
1010 // signature. See the Visit documentation for details.
1011 functor(this->Storage.GetArrays32(), std::forward<Args>(args)...);
1012 }
1013 }
1014
1015 template <typename Functor, typename... Args,
1016 typename = typename std::enable_if<!ReturnsVoid<Functor, Args...>::value>::type>
1017 GetReturnType<Functor, Args...> Visit(Functor&& functor, Args&&... args)
1018 {
1019 if (this->Storage.Is64Bit())
1020 {
1021 // If you get an error on the next line, a call to Visit(functor, Args...)
1022 // is being called with arguments that do not match the functor's call
1023 // signature. See the Visit documentation for details.
1024 return functor(this->Storage.GetArrays64(), std::forward<Args>(args)...);
1025 }
1026 else
1027 {
1028 // If you get an error on the next line, a call to Visit(functor, Args...)
1029 // is being called with arguments that do not match the functor's call
1030 // signature. See the Visit documentation for details.
1031 return functor(this->Storage.GetArrays32(), std::forward<Args>(args)...);
1032 }
1033 }
1034 template <typename Functor, typename... Args,
1035 typename = typename std::enable_if<!ReturnsVoid<Functor, Args...>::value>::type>
1036 GetReturnType<Functor, Args...> Visit(Functor&& functor, Args&&... args) const
1037 {
1038 if (this->Storage.Is64Bit())
1039 {
1040 // If you get an error on the next line, a call to Visit(functor, Args...)
1041 // is being called with arguments that do not match the functor's call
1042 // signature. See the Visit documentation for details.
1043 return functor(this->Storage.GetArrays64(), std::forward<Args>(args)...);
1044 }
1045 else
1046 {
1047 // If you get an error on the next line, a call to Visit(functor, Args...)
1048 // is being called with arguments that do not match the functor's call
1049 // signature. See the Visit documentation for details.
1050 return functor(this->Storage.GetArrays32(), std::forward<Args>(args)...);
1051 }
1052 }
1053
1056 #endif // __VTK_WRAP__
1057
1058 //=================== Begin Legacy Methods ===================================
1059 // These should be deprecated at some point as they are confusing or very slow
1060
1067 virtual void SetNumberOfCells(vtkIdType);
1068
1080 vtkIdType EstimateSize(vtkIdType numCells, int maxPtsPerCell);
1081
1090 vtkIdType GetSize();
1091
1098 vtkIdType GetNumberOfConnectivityEntries();
1099
1109 void GetCell(vtkIdType loc, vtkIdType& npts, const vtkIdType*& pts)
1110 VTK_EXPECTS(0 <= loc && loc < GetNumberOfConnectivityEntries()) VTK_SIZEHINT(pts, npts);
1111
1118 void GetCell(vtkIdType loc, vtkIdList* pts)
1119 VTK_EXPECTS(0 <= loc && loc < GetNumberOfConnectivityEntries());
1120
1127 vtkIdType GetInsertLocation(int npts);
1128
1136 vtkIdType GetTraversalLocation();
1137 vtkIdType GetTraversalLocation(vtkIdType npts);
1138 void SetTraversalLocation(vtkIdType loc);
1148 void ReverseCell(vtkIdType loc) VTK_EXPECTS(0 <= loc && loc < GetNumberOfConnectivityEntries());
1149
1161 void ReplaceCell(vtkIdType loc, int npts, const vtkIdType pts[])
1162 VTK_EXPECTS(0 <= loc && loc < GetNumberOfConnectivityEntries()) VTK_SIZEHINT(pts, npts);
1163
1178 void SetCells(vtkIdType ncells, vtkIdTypeArray* cells);
1179
1190 vtkIdTypeArray* GetData();
1191
1192 //=================== End Legacy Methods =====================================
1193
1194 friend class vtkCellArrayIterator;
1195
1196 protected:
1197 vtkCellArray();
1198 ~vtkCellArray() override;
1199
1200 // Encapsulates storage of the internal arrays as a discriminated union
1201 // between 32-bit and 64-bit storage.
1202 struct Storage
1203 {
1204 // Union type that switches 32 and 64 bit array storage
1205 union ArraySwitch {
1206 ArraySwitch() = default; // handled by Storage
1207 ~ArraySwitch() = default; // handle by Storage
1208 VisitState<ArrayType32>* Int32;
1209 VisitState<ArrayType64>* Int64;
1210 };
1211
1212 Storage()
1213 {
1214 #ifdef VTK_USE_MEMKIND
1215 this->Arrays =
1216 static_cast<ArraySwitch*>(vtkObjectBase::GetCurrentMallocFunction()(sizeof(ArraySwitch)));
1217 #else
1218 this->Arrays = new ArraySwitch;
1219 #endif
1220
1221 // Default to the compile-time setting:
1222 #ifdef VTK_USE_64BIT_IDS
1223
1224 this->Arrays->Int64 = new VisitState<ArrayType64>;
1225 this->StorageIs64Bit = true;
1226
1227 #else // VTK_USE_64BIT_IDS
1228
1229 this->Arrays->Int32 = new VisitState<ArrayType32>;
1230 this->StorageIs64Bit = false;
1231
1232 #endif // VTK_USE_64BIT_IDS
1233 #ifdef VTK_USE_MEMKIND
1234 if (vtkObjectBase::GetUsingMemkind())
1235 {
1236 this->IsInMemkind = true;
1237 }
1238 #else
1239 (void)this->IsInMemkind; // comp warning workaround
1240 #endif
1241 }
1242
1243 ~Storage()
1244 {
1245 if (this->StorageIs64Bit)
1246 {
1247 this->Arrays->Int64->~VisitState();
1248 delete this->Arrays->Int64;
1249 }
1250 else
1251 {
1252 this->Arrays->Int32->~VisitState();
1253 delete this->Arrays->Int32;
1254 }
1255 #ifdef VTK_USE_MEMKIND
1256 if (this->IsInMemkind)
1257 {
1258 vtkObjectBase::GetAlternateFreeFunction()(this->Arrays);
1259 }
1260 else
1261 {
1262 free(this->Arrays);
1263 }
1264 #else
1265 delete this->Arrays;
1266 #endif
1267 }
1268
1269 // Switch the internal arrays to be 32-bit. Any old data is lost. Returns
1270 // true if the storage changes.
1271 bool Use32BitStorage()
1272 {
1273 if (!this->StorageIs64Bit)
1274 {
1275 return false;
1276 }
1277
1278 this->Arrays->Int64->~VisitState();
1279 delete this->Arrays->Int64;
1280 this->Arrays->Int32 = new VisitState<ArrayType32>;
1281 this->StorageIs64Bit = false;
1282
1283 return true;
1284 }
1285
1286 // Switch the internal arrays to be 64-bit. Any old data is lost. Returns
1287 // true if the storage changes.
1288 bool Use64BitStorage()
1289 {
1290 if (this->StorageIs64Bit)
1291 {
1292 return false;
1293 }
1294
1295 this->Arrays->Int32->~VisitState();
1296 delete this->Arrays->Int32;
1297 this->Arrays->Int64 = new VisitState<ArrayType64>;
1298 this->StorageIs64Bit = true;
1299
1300 return true;
1301 }
1302
1303 // Returns true if the storage is currently configured to be 64 bit.
1304 bool Is64Bit() const { return this->StorageIs64Bit; }
1305
1306 // Get the VisitState for 32-bit arrays
1307 VisitState<ArrayType32>& GetArrays32()
1308 {
1309 assert(!this->StorageIs64Bit);
1310 return *this->Arrays->Int32;
1311 }
1312
1313 const VisitState<ArrayType32>& GetArrays32() const
1314 {
1315 assert(!this->StorageIs64Bit);
1316 return *this->Arrays->Int32;
1317 }
1318
1319 // Get the VisitState for 64-bit arrays
1320 VisitState<ArrayType64>& GetArrays64()
1321 {
1322 assert(this->StorageIs64Bit);
1323 return *this->Arrays->Int64;
1324 }
1325
1326 const VisitState<ArrayType64>& GetArrays64() const
1327 {
1328 assert(this->StorageIs64Bit);
1329 return *this->Arrays->Int64;
1330 }
1331
1332 private:
1333 // Access restricted to ensure proper union construction/destruction thru
1334 // API.
1335 ArraySwitch* Arrays;
1336 bool StorageIs64Bit;
1337 bool IsInMemkind = false;
1338 };
1339
1340 Storage Storage;
1341 vtkNew<vtkIdList> TempCell;
1342 vtkIdType TraversalCellId{ 0 };
1343
1344 vtkNew<vtkIdTypeArray> LegacyData; // For GetData().
1345
1346 private:
1347 vtkCellArray(const vtkCellArray&) = delete;
1348 void operator=(const vtkCellArray&) = delete;
1349 };
1350
1351 template <typename ArrayT>
1352 vtkIdType vtkCellArray::VisitState<ArrayT>::GetNumberOfCells() const
1353 {
1354 return this->Offsets->GetNumberOfValues() - 1;
1355 }
1356
1357 template <typename ArrayT>
1358 vtkIdType vtkCellArray::VisitState<ArrayT>::GetBeginOffset(vtkIdType cellId) const
1359 {
1360 return static_cast<vtkIdType>(this->Offsets->GetValue(cellId));
1361 }
1362
1363 template <typename ArrayT>
1364 vtkIdType vtkCellArray::VisitState<ArrayT>::GetEndOffset(vtkIdType cellId) const
1365 {
1366 return static_cast<vtkIdType>(this->Offsets->GetValue(cellId + 1));
1367 }
1368
1369 template <typename ArrayT>
1370 vtkIdType vtkCellArray::VisitState<ArrayT>::GetCellSize(vtkIdType cellId) const
1371 {
1372 return this->GetEndOffset(cellId) - this->GetBeginOffset(cellId);
1373 }
1374
1375 template <typename ArrayT>
1376 typename vtkCellArray::VisitState<ArrayT>::CellRangeType
1377 vtkCellArray::VisitState<ArrayT>::GetCellRange(vtkIdType cellId)
1378 {
1379 return vtk::DataArrayValueRange<1>(
1380 this->GetConnectivity(), this->GetBeginOffset(cellId), this->GetEndOffset(cellId));
1381 }
1382 VTK_ABI_NAMESPACE_END
1383
1384 namespace vtkCellArray_detail
1385 {
1386 VTK_ABI_NAMESPACE_BEGIN
1387
1388 struct InsertNextCellImpl
1389 {
1390 // Insert full cell
1391 template <typename CellStateT>
1392 vtkIdType operator()(CellStateT& state, const vtkIdType npts, const vtkIdType pts[])
1393 {
1394 using ValueType = typename CellStateT::ValueType;
1395 auto* conn = state.GetConnectivity();
1396 auto* offsets = state.GetOffsets();
1397
1398 const vtkIdType cellId = offsets->GetNumberOfValues() - 1;
1399
1400 offsets->InsertNextValue(static_cast<ValueType>(conn->GetNumberOfValues() + npts));
1401
1402 for (vtkIdType i = 0; i < npts; ++i)
1403 {
1404 conn->InsertNextValue(static_cast<ValueType>(pts[i]));
1405 }
1406
1407 return cellId;
1408 }
1409
1410 // Just update offset table (for incremental API)
1411 template <typename CellStateT>
1412 vtkIdType operator()(CellStateT& state, const vtkIdType npts)
1413 {
1414 using ValueType = typename CellStateT::ValueType;
1415 auto* conn = state.GetConnectivity();
1416 auto* offsets = state.GetOffsets();
1417
1418 const vtkIdType cellId = offsets->GetNumberOfValues() - 1;
1419
1420 offsets->InsertNextValue(static_cast<ValueType>(conn->GetNumberOfValues() + npts));
1421
1422 return cellId;
1423 }
1424 };
1425
1426 // for incremental API:
1427 struct UpdateCellCountImpl
1428 {
1429 template <typename CellStateT>
1430 void operator()(CellStateT& state, const vtkIdType npts)
1431 {
1432 using ValueType = typename CellStateT::ValueType;
1433
1434 auto* offsets = state.GetOffsets();
1435 const ValueType cellBegin = offsets->GetValue(offsets->GetMaxId() - 1);
1436 offsets->SetValue(offsets->GetMaxId(), static_cast<ValueType>(cellBegin + npts));
1437 }
1438 };
1439
1440 struct GetCellSizeImpl
1441 {
1442 template <typename CellStateT>
1443 vtkIdType operator()(CellStateT& state, vtkIdType cellId)
1444 {
1445 return state.GetCellSize(cellId);
1446 }
1447 };
1448
1449 struct GetCellAtIdImpl
1450 {
1451 template <typename CellStateT>
1452 void operator()(CellStateT& state, const vtkIdType cellId, vtkIdList* ids)
1453 {
1454 using ValueType = typename CellStateT::ValueType;
1455
1456 const vtkIdType beginOffset = state.GetBeginOffset(cellId);
1457 const vtkIdType endOffset = state.GetEndOffset(cellId);
1458 const vtkIdType cellSize = endOffset - beginOffset;
1459 const auto cellConnectivity = state.GetConnectivity()->GetPointer(beginOffset);
1460
1461 // ValueType differs from vtkIdType, so we have to copy into a temporary buffer:
1462 ids->SetNumberOfIds(cellSize);
1463 vtkIdType* idPtr = ids->GetPointer(0);
1464 for (ValueType i = 0; i < cellSize; ++i)
1465 {
1466 idPtr[i] = static_cast<vtkIdType>(cellConnectivity[i]);
1467 }
1468 }
1469
1470 // SFINAE helper to check if a VisitState's connectivity array's memory
1471 // can be used as a vtkIdType*.
1472 template <typename CellStateT>
1473 struct CanShareConnPtr
1474 {
1475 private:
1476 using ValueType = typename CellStateT::ValueType;
1477 using ArrayType = typename CellStateT::ArrayType;
1478 using AOSArrayType = vtkAOSDataArrayTemplate<ValueType>;
1479 static constexpr bool ValueTypeCompat = CellStateT::ValueTypeIsSameAsIdType;
1480 static constexpr bool ArrayTypeCompat = std::is_base_of<AOSArrayType, ArrayType>::value;
1481
1482 public:
1483 static constexpr bool value = ValueTypeCompat && ArrayTypeCompat;
1484 };
1485
1486 template <typename CellStateT>
1487 typename std::enable_if<CanShareConnPtr<CellStateT>::value, void>::type operator()(
1488 CellStateT& state, const vtkIdType cellId, vtkIdType& cellSize, vtkIdType const*& cellPoints,
1489 vtkIdList* vtkNotUsed(temp))
1490 {
1491 const vtkIdType beginOffset = state.GetBeginOffset(cellId);
1492 const vtkIdType endOffset = state.GetEndOffset(cellId);
1493 cellSize = endOffset - beginOffset;
1494 // This is safe, see CanShareConnPtr helper above.
1495 cellPoints = reinterpret_cast<vtkIdType*>(state.GetConnectivity()->GetPointer(beginOffset));
1496 }
1497
1498 template <typename CellStateT>
1499 typename std::enable_if<!CanShareConnPtr<CellStateT>::value, void>::type operator()(
1500 CellStateT& state, const vtkIdType cellId, vtkIdType& cellSize, vtkIdType const*& cellPoints,
1501 vtkIdList* temp)
1502 {
1503 using ValueType = typename CellStateT::ValueType;
1504
1505 const vtkIdType beginOffset = state.GetBeginOffset(cellId);
1506 const vtkIdType endOffset = state.GetEndOffset(cellId);
1507 cellSize = endOffset - beginOffset;
1508 const ValueType* cellConnectivity = state.GetConnectivity()->GetPointer(beginOffset);
1509
1510 // ValueType differs from vtkIdType, so we have to copy into a temporary buffer:
1511 temp->SetNumberOfIds(cellSize);
1512 vtkIdType* tempPtr = temp->GetPointer(0);
1513 for (vtkIdType i = 0; i < cellSize; ++i)
1514 {
1515 tempPtr[i] = static_cast<vtkIdType>(cellConnectivity[i]);
1516 }
1517
1518 cellPoints = temp->GetPointer(0);
1519 }
1520 };
1521
1522 struct ResetImpl
1523 {
1524 template <typename CellStateT>
1525 void operator()(CellStateT& state)
1526 {
1527 state.GetOffsets()->Reset();
1528 state.GetConnectivity()->Reset();
1529 state.GetOffsets()->InsertNextValue(0);
1530 }
1531 };
1532
1533 VTK_ABI_NAMESPACE_END
1534 } // end namespace vtkCellArray_detail
1535
1536 VTK_ABI_NAMESPACE_BEGIN
1537 //----------------------------------------------------------------------------
1538 inline void vtkCellArray::InitTraversal()
1539 {
1540 this->TraversalCellId = 0;
1541 }
1542
1543 //----------------------------------------------------------------------------
1544 inline int vtkCellArray::GetNextCell(vtkIdType& npts, vtkIdType const*& pts) VTK_SIZEHINT(pts, npts)
1545 {
1546 if (this->TraversalCellId < this->GetNumberOfCells())
1547 {
1548 this->GetCellAtId(this->TraversalCellId, npts, pts);
1549 ++this->TraversalCellId;
1550 return 1;
1551 }
1552
1553 npts = 0;
1554 pts = nullptr;
1555 return 0;
1556 }
1557
1558 //----------------------------------------------------------------------------
1559 inline int vtkCellArray::GetNextCell(vtkIdList* pts)
1560 {
1561 if (this->TraversalCellId < this->GetNumberOfCells())
1562 {
1563 this->GetCellAtId(this->TraversalCellId, pts);
1564 ++this->TraversalCellId;
1565 return 1;
1566 }
1567
1568 pts->Reset();
1569 return 0;
1570 }
1571 //----------------------------------------------------------------------------
1572 inline vtkIdType vtkCellArray::GetCellSize(const vtkIdType cellId) const
1573 {
1574 return this->Visit(vtkCellArray_detail::GetCellSizeImpl{}, cellId);
1575 }
1576
1577 //----------------------------------------------------------------------------
1578 inline void vtkCellArray::GetCellAtId(vtkIdType cellId, vtkIdType& cellSize,
1579 vtkIdType const*& cellPoints) VTK_SIZEHINT(cellPoints, cellSize)
1580 {
1581 this->Visit(vtkCellArray_detail::GetCellAtIdImpl{}, cellId, cellSize, cellPoints, this->TempCell);
1582 }
1583
1584 //----------------------------------------------------------------------------
1585 inline void vtkCellArray::GetCellAtId(vtkIdType cellId, vtkIdType& cellSize,
1586 vtkIdType const*& cellPoints, vtkIdList* ptIds) VTK_SIZEHINT(cellPoints, cellSize)
1587 {
1588 this->Visit(vtkCellArray_detail::GetCellAtIdImpl{}, cellId, cellSize, cellPoints, ptIds);
1589 }
1590
1591 //----------------------------------------------------------------------------
1592 inline void vtkCellArray::GetCellAtId(vtkIdType cellId, vtkIdList* pts)
1593 {
1594 this->Visit(vtkCellArray_detail::GetCellAtIdImpl{}, cellId, pts);
1595 }
1596
1597 //----------------------------------------------------------------------------
1598 inline vtkIdType vtkCellArray::InsertNextCell(vtkIdType npts, const vtkIdType* pts)
1599 VTK_SIZEHINT(pts, npts)
1600 {
1601 return this->Visit(vtkCellArray_detail::InsertNextCellImpl{}, npts, pts);
1602 }
1603
1604 //----------------------------------------------------------------------------
1605 inline vtkIdType vtkCellArray::InsertNextCell(int npts)
1606 {
1607 return this->Visit(vtkCellArray_detail::InsertNextCellImpl{}, npts);
1608 }
1609
1610 //----------------------------------------------------------------------------
1611 inline void vtkCellArray::InsertCellPoint(vtkIdType id)
1612 {
1613 if (this->Storage.Is64Bit())
1614 {
1615 using ValueType = typename ArrayType64::ValueType;
1616 this->Storage.GetArrays64().Connectivity->InsertNextValue(static_cast<ValueType>(id));
1617 }
1618 else
1619 {
1620 using ValueType = typename ArrayType32::ValueType;
1621 this->Storage.GetArrays32().Connectivity->InsertNextValue(static_cast<ValueType>(id));
1622 }
1623 }
1624
1625 //----------------------------------------------------------------------------
1626 inline void vtkCellArray::UpdateCellCount(int npts)
1627 {
1628 this->Visit(vtkCellArray_detail::UpdateCellCountImpl{}, npts);
1629 }
1630
1631 //----------------------------------------------------------------------------
1632 inline vtkIdType vtkCellArray::InsertNextCell(vtkIdList* pts)
1633 {
1634 return this->Visit(
1635 vtkCellArray_detail::InsertNextCellImpl{}, pts->GetNumberOfIds(), pts->GetPointer(0));
1636 }
1637
1638 //----------------------------------------------------------------------------
1639 inline vtkIdType vtkCellArray::InsertNextCell(vtkCell* cell)
1640 {
1641 vtkIdList* pts = cell->GetPointIds();
1642 return this->Visit(
1643 vtkCellArray_detail::InsertNextCellImpl{}, pts->GetNumberOfIds(), pts->GetPointer(0));
1644 }
1645
1646 //----------------------------------------------------------------------------
1647 inline void vtkCellArray::Reset()
1648 {
1649 this->Visit(vtkCellArray_detail::ResetImpl{});
1650 }
1651
1652 VTK_ABI_NAMESPACE_END
1653 #endif // vtkCellArray.h
vtkAOSDataArrayTemplate< long >
vtkCellArrayIterator
Encapsulate traversal logic for vtkCellArray.
Definition: vtkCellArrayIterator.h:77
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:185
vtkCellArray::SetData
void SetData(vtkAOSDataArrayTemplate< int > *offsets, vtkAOSDataArrayTemplate< int > *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
vtkCellArray::GetNextCell
int GetNextCell(vtkIdType &npts, vtkIdType const *&pts)
Definition: vtkCellArray.h:1544
vtkCellArray::GetNumberOfConnectivityEntries
vtkIdType GetNumberOfConnectivityEntries()
Return the size of the array that would be returned from ExportLegacyFormat().
vtkCellArray::SetData
void SetData(vtkTypeInt32Array *offsets, vtkTypeInt32Array *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
vtkCellArray::Allocate
vtkTypeBool Allocate(vtkIdType sz, vtkIdType vtkNotUsed(ext)=1000)
Allocate memory.
Definition: vtkCellArray.h:231
vtkCellArray::UseDefaultStorage
void UseDefaultStorage()
Initialize internal data structures to use 32- or 64-bit storage.
vtkCellArray::Storage
Storage Storage
Definition: vtkCellArray.h:1340
vtkCellArray::GetOffset
vtkIdType GetOffset(vtkIdType cellId)
Get the offset (into the connectivity) for a specified cell id.
Definition: vtkCellArray.h:349
vtkCellArray::GetCellSize
vtkIdType GetCellSize(vtkIdType cellId) const
Return the size of the cell at cellId.
Definition: vtkCellArray.h:1572
vtkCellArray::AllocateCopy
bool AllocateCopy(vtkCellArray *other)
Pre-allocate memory in internal data structures to match the used size of the input vtkCellArray.
Definition: vtkCellArray.h:270
vtkCellArray::AppendLegacyFormat
void AppendLegacyFormat(vtkIdTypeArray *data, vtkIdType ptOffset=0)
Append an array of data with the legacy vtkCellArray layout, e.g.
vtkCellArray::IsStorageShareable
bool IsStorageShareable() const
Definition: vtkCellArray.h:446
vtkCellArray::GetOffsetsArray32
ArrayType32 * GetOffsetsArray32()
Return the array used to store cell offsets.
Definition: vtkCellArray.h:522
vtkCellArray::IsValid
bool IsValid()
Check that internal storage is consistent and in a valid state.
vtkCellArray::AppendLegacyFormat
void AppendLegacyFormat(const vtkIdType *data, vtkIdType len, vtkIdType ptOffset=0)
Append an array of data with the legacy vtkCellArray layout, e.g.
vtkCellArray::SetData
bool SetData(vtkIdType cellSize, vtkDataArray *connectivity)
Sets the internal arrays to the supported connectivity array with an offsets array automatically gene...
vtkCellArray::GetTraversalCellId
vtkIdType GetTraversalCellId()
Get/Set the current cellId for traversal.
vtkCellArray::Visit
void Visit(Functor &&functor, Args &&... args)
Definition: vtkCellArray.h:977
vtkCellArray::ArrayType32
vtkTypeInt32Array ArrayType32
Definition: vtkCellArray.h:187
vtkCellArray::Reset
void Reset()
Reuse list.
Definition: vtkCellArray.h:1647
vtkCellArray::GetOffsetsArray64
ArrayType64 * GetOffsetsArray64()
Return the array used to store cell offsets.
Definition: vtkCellArray.h:523
vtkCellArray::SetData
void SetData(vtkAOSDataArrayTemplate< long long > *offsets, vtkAOSDataArrayTemplate< long long > *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
vtkCellArray::Visit
GetReturnType< Functor, Args... > Visit(Functor &&functor, Args &&... args)
Definition: vtkCellArray.h:1017
vtkCellArray::AllocateExact
bool AllocateExact(vtkIdType numCells, vtkIdType connectivitySize)
Pre-allocate memory in internal data structures.
vtkCellArray::ResizeExact
bool ResizeExact(vtkIdType numCells, vtkIdType connectivitySize)
ResizeExact() resizes the internal structures to hold numCells total cell offsets and connectivitySiz...
vtkCellArray::EstimateSize
vtkIdType EstimateSize(vtkIdType numCells, int maxPtsPerCell)
Utility routines help manage memory of cell array.
vtkCellArray::AllocateEstimate
bool AllocateEstimate(vtkIdType numCells, vtkIdType maxCellSize)
Pre-allocate memory in internal data structures.
Definition: vtkCellArray.h:245
vtkCellArray::GetNumberOfOffsets
vtkIdType GetNumberOfOffsets() const
Get the number of elements in the offsets array.
Definition: vtkCellArray.h:334
vtkCellArray::ArrayType64
vtkTypeInt64Array ArrayType64
Definition: vtkCellArray.h:188
vtkCellArray::TraversalCellId
vtkIdType TraversalCellId
Definition: vtkCellArray.h:1342
vtkCellArray::InitTraversal
void InitTraversal()
Definition: vtkCellArray.h:1538
vtkCellArray::Use64BitStorage
void Use64BitStorage()
Initialize internal data structures to use 32- or 64-bit storage.
vtkCellArray::ConvertToDefaultStorage
bool ConvertToDefaultStorage()
Convert internal data structures to use 32- or 64-bit storage.
vtkCellArray::CanConvertToDefaultStorage
bool CanConvertToDefaultStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
vtkCellArray::GetCell
void GetCell(vtkIdType loc, vtkIdType &npts, const vtkIdType *&pts)
Internal method used to retrieve a cell given a legacy offset location.
vtkCellArray::CanConvertTo32BitStorage
bool CanConvertTo32BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
vtkCellArray::InsertCellPoint
void InsertCellPoint(vtkIdType id)
Used in conjunction with InsertNextCell(npts) to add another point to the list of cells.
Definition: vtkCellArray.h:1611
vtkCellArray::GetCellAtId
void GetCellAtId(vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints)
Return the point ids for the cell at cellId.
Definition: vtkCellArray.h:1578
vtkCellArray::ReplaceCellAtId
void ReplaceCellAtId(vtkIdType cellId, vtkIdList *list)
Replaces the point ids for the specified cell with the supplied list.
vtkCellArray::ReverseCellAtId
void ReverseCellAtId(vtkIdType cellId)
Reverses the order of the point ids for the specified cell.
vtkCellArray::SetData
bool SetData(vtkDataArray *offsets, vtkDataArray *connectivity)
Sets the internal arrays to the supplied offsets and connectivity arrays.
vtkCellArray::Squeeze
void Squeeze()
Reclaim any extra memory while preserving data.
vtkCellArray::SetData
void SetData(vtkIdTypeArray *offsets, vtkIdTypeArray *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
vtkCellArray::New
static vtkCellArray * New()
Standard methods for instantiation, type information, and printing.
vtkCellArray::GetConnectivityArray32
ArrayType32 * GetConnectivityArray32()
Return the array used to store the point ids that define the cells' connectivity.
Definition: vtkCellArray.h:543
vtkCellArray::GetConnectivityArray64
ArrayType64 * GetConnectivityArray64()
Return the array used to store the point ids that define the cells' connectivity.
Definition: vtkCellArray.h:544
vtkCellArray::ConvertTo32BitStorage
bool ConvertTo32BitStorage()
Convert internal data structures to use 32- or 64-bit storage.
vtkCellArray::IsHomogeneous
vtkIdType IsHomogeneous()
Check if all cells have the same number of vertices.
vtkCellArray::Visit
void Visit(Functor &&functor, Args &&... args) const
Definition: vtkCellArray.h:997
vtkCellArray::GetMaxCellSize
int GetMaxCellSize()
Returns the size of the largest cell.
vtkCellArray::ConvertToSmallestStorage
bool ConvertToSmallestStorage()
Convert internal data structures to use 32- or 64-bit storage.
vtkCellArray::ShallowCopy
void ShallowCopy(vtkCellArray *ca)
Shallow copy ca into this cell array.
vtkCellArray::ExportLegacyFormat
void ExportLegacyFormat(vtkIdTypeArray *data)
Fill data with the old-style vtkCellArray data layout, e.g.
vtkCellArray::ConvertTo64BitStorage
bool ConvertTo64BitStorage()
Convert internal data structures to use 32- or 64-bit storage.
vtkCellArray::SetData
void SetData(vtkAOSDataArrayTemplate< long > *offsets, vtkAOSDataArrayTemplate< long > *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
vtkCellArray::ImportLegacyFormat
void ImportLegacyFormat(const vtkIdType *data, vtkIdType len)
Import an array of data with the legacy vtkCellArray layout, e.g.
vtkCellArray::ImportLegacyFormat
void ImportLegacyFormat(vtkIdTypeArray *data)
Import an array of data with the legacy vtkCellArray layout, e.g.
vtkCellArray::Use32BitStorage
void Use32BitStorage()
Initialize internal data structures to use 32- or 64-bit storage.
vtkCellArray::Initialize
void Initialize()
Free any memory and reset to an empty state.
vtkCellArray::DeepCopy
void DeepCopy(vtkCellArray *ca)
Perform a deep copy (no reference counting) of the given cell array.
vtkCellArray::InputArrayList
typename vtkTypeList::Unique< vtkTypeList::Create< vtkAOSDataArrayTemplate< int >, vtkAOSDataArrayTemplate< long >, vtkAOSDataArrayTemplate< long long > >>::Result InputArrayList
List of possible ArrayTypes that are compatible with internal storage.
Definition: vtkCellArray.h:221
vtkCellArray::GetConnectivityArray
vtkDataArray * GetConnectivityArray()
Return the array used to store the point ids that define the cells' connectivity.
Definition: vtkCellArray.h:532
vtkCellArray::SetTraversalCellId
void SetTraversalCellId(vtkIdType cellId)
Get/Set the current cellId for traversal.
vtkCellArray::SetData
void SetData(vtkTypeInt64Array *offsets, vtkTypeInt64Array *connectivity)
Set the internal data arrays to the supplied offsets and connectivity arrays.
vtkCellArray::GetNumberOfCells
vtkIdType GetNumberOfCells() const
Get the number of cells in the array.
Definition: vtkCellArray.h:318
vtkCellArray::InsertNextCell
vtkIdType InsertNextCell(vtkCell *cell)
Insert a cell object.
Definition: vtkCellArray.h:1639
vtkCellArray::SetNumberOfCells
virtual void SetNumberOfCells(vtkIdType)
Set the number of cells in the array.
vtkCellArray::GetNumberOfConnectivityIds
vtkIdType GetNumberOfConnectivityIds() const
Get the size of the connectivity array that stores the point ids.
Definition: vtkCellArray.h:367
vtkCellArray::LegacyData
vtkNew< vtkIdTypeArray > LegacyData
Definition: vtkCellArray.h:1344
vtkCellArray::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, type information, and printing.
vtkCellArray::PrintDebug
void PrintDebug(ostream &os)
Standard methods for instantiation, type information, and printing.
vtkCellArray::NewIterator
vtkCellArrayIterator * NewIterator()
NewIterator returns a new instance of vtkCellArrayIterator that is initialized to point at the first ...
vtkCellArray::UpdateCellCount
void UpdateCellCount(int npts)
Used in conjunction with InsertNextCell(int npts) and InsertCellPoint() to update the number of point...
Definition: vtkCellArray.h:1626
vtkCellArray::Visit
GetReturnType< Functor, Args... > Visit(Functor &&functor, Args &&... args) const
Definition: vtkCellArray.h:1036
vtkCellArray::TempCell
vtkNew< vtkIdList > TempCell
Definition: vtkCellArray.h:1341
vtkCellArray::GetSize
vtkIdType GetSize()
Get the size of the allocated connectivity array.
vtkCellArray::GetOffsetsArray
vtkDataArray * GetOffsetsArray()
Return the array used to store cell offsets.
Definition: vtkCellArray.h:511
vtkCellArray::StorageArrayList
vtkTypeList::Create< ArrayType32, ArrayType64 > StorageArrayList
List of possible array types used for storage.
Definition: vtkCellArray.h:209
vtkCellArray::InsertNextCell
vtkIdType InsertNextCell(const std::initializer_list< vtkIdType > &cell)
Overload that allows InsertNextCell({0, 1, 2}) syntax.
Definition: vtkCellArray.h:659
vtkCellArray::Append
void Append(vtkCellArray *src, vtkIdType pointOffset=0)
Append cells from src into this.
vtkCellArray::IsStorage64Bit
bool IsStorage64Bit() const
Definition: vtkCellArray.h:438
vtkCellArray::ReplaceCellAtId
void ReplaceCellAtId(vtkIdType cellId, vtkIdType cellSize, const vtkIdType *cellPoints)
Replaces the point ids for the specified cell with the supplied list.
vtkCellArray::CanConvertTo64BitStorage
bool CanConvertTo64BitStorage() const
Check if the existing data can safely be converted to use 32- or 64- bit storage.
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:59
vtkCell::GetPointIds
vtkIdList * GetPointIds()
Return the list of point ids defining the cell.
Definition: vtkCell.h:154
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:32
vtkIdList::SetNumberOfIds
void SetNumberOfIds(vtkIdType number)
Specify the number of ids for this object to hold.
vtkIdList::GetNumberOfIds
vtkIdType GetNumberOfIds() const noexcept
Return the number of id's in the list.
Definition: vtkIdList.h:58
vtkIdList::Reset
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition: vtkIdList.h:143
vtkIdList::GetPointer
vtkIdType * GetPointer(vtkIdType i)
Get a pointer to a particular data index.
Definition: vtkIdList.h:124
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:37
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkNew< vtkIdList >
vtkObjectBase::GetCurrentMallocFunction
static vtkMallocingFunction GetCurrentMallocFunction()
vtkObjectBase::GetAlternateFreeFunction
static vtkFreeingFunction GetAlternateFreeFunction()
vtkObjectBase::GetUsingMemkind
static bool GetUsingMemkind()
A global state flag that controls whether vtkObjects are constructed in the usual way (the default) o...
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkSmartPointer< ArrayType >
vtkSmartPointer::New
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
Definition: vtkSmartPointer.h:231
std
Definition: vtkSmartPointer.h:310
vtkCellArray_detail
Definition: vtkCellArray.h:1385
vtkIOSSUtilities::GetData
vtkSmartPointer< vtkDataArray > GetData(const Ioss::GroupingEntity *entity, const std::string &fieldname, Ioss::Transform *transform=nullptr, Cache *cache=nullptr, const std::string &cachekey=std::string())
Returns a VTK array for a given field (fieldname) on the chosen block (or set) entity.
vtkIOSSUtilities::GetConnectivity
vtkSmartPointer< vtkCellArray > GetConnectivity(Ioss::GroupingEntity *group_entity, int &vtk_topology_type, Cache *cache=nullptr)
Read connectivity information from the group_entity.
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkCellArray::Storage
Definition: vtkCellArray.h:1203
vtkCellArray::Storage::GetArrays32
VisitState< ArrayType32 > & GetArrays32()
Definition: vtkCellArray.h:1307
vtkCellArray::Storage::Storage
Storage()
Definition: vtkCellArray.h:1212
vtkCellArray::Storage::Is64Bit
bool Is64Bit() const
Definition: vtkCellArray.h:1304
vtkCellArray::Storage::GetArrays64
const VisitState< ArrayType64 > & GetArrays64() const
Definition: vtkCellArray.h:1326
vtkCellArray::Storage::GetArrays32
const VisitState< ArrayType32 > & GetArrays32() const
Definition: vtkCellArray.h:1313
vtkCellArray::Storage::Use64BitStorage
bool Use64BitStorage()
Definition: vtkCellArray.h:1288
vtkCellArray::Storage::~Storage
~Storage()
Definition: vtkCellArray.h:1243
vtkCellArray::Storage::GetArrays64
VisitState< ArrayType64 > & GetArrays64()
Definition: vtkCellArray.h:1320
vtkCellArray::Storage::Use32BitStorage
bool Use32BitStorage()
Definition: vtkCellArray.h:1271
vtkCellArray::VisitState
Definition: vtkCellArray.h:816
vtkCellArray::VisitState::ArrayType
ArrayT ArrayType
Definition: vtkCellArray.h:817
vtkCellArray::VisitState::GetOffsets
ArrayType * GetOffsets()
Definition: vtkCellArray.h:829
vtkCellArray::VisitState::GetNumberOfCells
vtkIdType GetNumberOfCells() const
Definition: vtkCellArray.h:1352
vtkCellArray::VisitState::GetEndOffset
vtkIdType GetEndOffset(vtkIdType cellId) const
Definition: vtkCellArray.h:1364
vtkCellArray::VisitState::Offsets
vtkSmartPointer< ArrayType > Offsets
Definition: vtkCellArray.h:887
vtkCellArray::VisitState::Connectivity
vtkSmartPointer< ArrayType > Connectivity
Definition: vtkCellArray.h:886
vtkCellArray::VisitState::GetConnectivity
ArrayType * GetConnectivity()
Definition: vtkCellArray.h:832
vtkCellArray::VisitState::CellRangeType
decltype(vtk::DataArrayValueRange< 1 >(std::declval< ArrayType >())) CellRangeType
Definition: vtkCellArray.h:819
vtkCellArray::VisitState::~VisitState
~VisitState()=default
vtkCellArray::VisitState::GetCellRange
CellRangeType GetCellRange(vtkIdType cellId)
Definition: vtkCellArray.h:1377
vtkCellArray::VisitState::VisitState
VisitState()
Definition: vtkCellArray.h:848
vtkCellArray::VisitState::GetOffsets
const ArrayType * GetOffsets() const
Definition: vtkCellArray.h:830
vtkCellArray::VisitState::GetBeginOffset
vtkIdType GetBeginOffset(vtkIdType cellId) const
Definition: vtkCellArray.h:1358
vtkCellArray::VisitState::GetCellSize
vtkIdType GetCellSize(vtkIdType cellId) const
Definition: vtkCellArray.h:1370
vtkCellArray::VisitState::GetConnectivity
const ArrayType * GetConnectivity() const
Definition: vtkCellArray.h:833
vtkCellArray::VisitState::ValueType
typename ArrayType::ValueType ValueType
Definition: vtkCellArray.h:818
vtkCellArray_detail::GetCellAtIdImpl::CanShareConnPtr
Definition: vtkCellArray.h:1474
vtkCellArray_detail::GetCellAtIdImpl
Definition: vtkCellArray.h:1450
vtkCellArray_detail::GetCellAtIdImpl::operator()
void operator()(CellStateT &state, const vtkIdType cellId, vtkIdList *ids)
Definition: vtkCellArray.h:1452
vtkCellArray_detail::GetCellAtIdImpl::operator()
std::enable_if<!CanShareConnPtr< CellStateT >::value, void >::type operator()(CellStateT &state, const vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints, vtkIdList *temp)
Definition: vtkCellArray.h:1499
vtkCellArray_detail::GetCellAtIdImpl::operator()
std::enable_if< CanShareConnPtr< CellStateT >::value, void >::type operator()(CellStateT &state, const vtkIdType cellId, vtkIdType &cellSize, vtkIdType const *&cellPoints, vtkIdList *vtkNotUsed(temp))
Definition: vtkCellArray.h:1487
vtkCellArray_detail::GetCellSizeImpl
Definition: vtkCellArray.h:1441
vtkCellArray_detail::GetCellSizeImpl::operator()
vtkIdType operator()(CellStateT &state, vtkIdType cellId)
Definition: vtkCellArray.h:1443
vtkCellArray_detail::InsertNextCellImpl
Definition: vtkCellArray.h:1389
vtkCellArray_detail::InsertNextCellImpl::operator()
vtkIdType operator()(CellStateT &state, const vtkIdType npts, const vtkIdType pts[])
Definition: vtkCellArray.h:1392
vtkCellArray_detail::InsertNextCellImpl::operator()
vtkIdType operator()(CellStateT &state, const vtkIdType npts)
Definition: vtkCellArray.h:1412
vtkCellArray_detail::ResetImpl
Definition: vtkCellArray.h:1523
vtkCellArray_detail::ResetImpl::operator()
void operator()(CellStateT &state)
Definition: vtkCellArray.h:1525
vtkCellArray_detail::UpdateCellCountImpl
Definition: vtkCellArray.h:1428
vtkCellArray_detail::UpdateCellCountImpl::operator()
void operator()(CellStateT &state, const vtkIdType npts)
Definition: vtkCellArray.h:1430
vtkTypeList::Unique
Remove all duplicate types from TypeList TList, storing the new list in Result.
Definition: vtkTypeList.h:110
vtkCellArray::Storage::ArraySwitch
Definition: vtkCellArray.h:1205
vtkCellArray::Storage::ArraySwitch::Int32
VisitState< ArrayType32 > * Int32
Definition: vtkCellArray.h:1208
vtkCellArray::Storage::ArraySwitch::Int64
VisitState< ArrayType64 > * Int64
Definition: vtkCellArray.h:1209
vtkCellArray::Storage::ArraySwitch::ArraySwitch
ArraySwitch()=default
vtkCellArray::Storage::ArraySwitch::~ArraySwitch
~ArraySwitch()=default
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkAOSDataArrayTemplate.h
vtkCell.h
vtkDataArrayRange.h
STL-compatible iterable ranges that provide access to vtkDataArray elements.
vtkObject.h
vtkSmartPointer.h
vtkTypeList.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:36
VTK_EXPECTS
#define VTK_EXPECTS(x)
Definition: vtkWrappingHints.h:35
VTK_NEWINSTANCE
#define VTK_NEWINSTANCE
Definition: vtkWrappingHints.h:32