VTK  9.7.20261027
vtkCellTypeSides.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
58
59#ifndef vtkCellTypeSides_h
60#define vtkCellTypeSides_h
61
62#include "vtkBiQuadraticQuad.h"
66#include "vtkCellType.h"
67#include "vtkCellTypeTraits.h"
68#include "vtkGenericCell.h"
69#include "vtkHexagonalPrism.h"
70#include "vtkHexahedron.h"
71#include "vtkIdList.h"
72#include "vtkPentagonalPrism.h"
73#include "vtkPixel.h"
75#include "vtkPyramid.h"
76#include "vtkQuad.h"
80#include "vtkQuadraticPyramid.h"
81#include "vtkQuadraticQuad.h"
82#include "vtkQuadraticTetra.h"
84#include "vtkQuadraticWedge.h"
85#include "vtkSetGet.h"
86#include "vtkTetra.h"
89#include "vtkTriangle.h"
90#include "vtkUnstructuredGrid.h"
91#include "vtkVoxel.h"
92#include "vtkWedge.h"
93
94#include <algorithm>
95#include <array>
96#include <cstdint>
97#include <type_traits>
98#include <utility>
99
101{
102VTK_ABI_NAMESPACE_BEGIN
103
104// The maximum number of points of a side read from the static tables of the cells, the largest
105// edge or face of the cell types of a fixed size, see vtkCellTypeTraits: a face of a tri-quadratic
106// hexahedron.
108{
109 int maximum = 2; // an edge of a polygon
111 [&maximum](auto traits)
112 {
113 using Traits = decltype(traits);
114 if constexpr (Traits::HasFixedSize)
115 {
116 maximum = std::max({ maximum, Traits::MaximumEdgeSize, Traits::MaximumFaceSize });
117 }
118 });
119 return maximum;
120}
122
123//------------------------------------------------------------------------------
124// The cell type of a side of a cell of a fixed size, given by its number of points and of corners:
125// a vertex, an edge, or a face, linear or nonlinear, e.g., a face of 8 points and 4 corners is a
126// VTK_QUADRATIC_QUAD, and a face of 5 or 6 corners, of a pentagonal or hexagonal prism, is a
127// VTK_POLYGON, so that the faces of a voxel, in the order of a polygon, are quads.
128constexpr int GetFixedSizeSideType(int numPts, int numCorners)
129{
130 switch (numCorners)
131 {
132 case 1:
133 return VTK_VERTEX;
134 case 2:
135 return numPts == 2 ? VTK_LINE : VTK_QUADRATIC_EDGE;
136 case 3:
137 switch (numPts)
138 {
139 case 3:
140 return VTK_TRIANGLE;
141 case 6:
143 default:
145 }
146 case 4:
147 switch (numPts)
148 {
149 case 4:
150 return VTK_QUAD;
151 case 6:
153 case 8:
154 return VTK_QUADRATIC_QUAD;
155 default:
157 }
158 default:
159 return VTK_POLYGON;
160 }
161}
162
163//------------------------------------------------------------------------------
164// The edges and faces of the cells of the cell type of a fixed size CellType, whose sizes are given
165// by vtkCellTypeTraits, as small tables built once, since CellClass::GetEdgeArray() and
166// CellClass::GetFaceArray() are not inlined: their local points, number of points, number of
167// corners, which are the points of the cell of index less than its number of corners, and cell
168// type, see GetFixedSizeSideType(). The rows of the tables of the cells with fewer points end
169// with -1, and the faces of a voxel are in the order of a polygon instead of a pixel.
170template <int CellType>
172{
174 using CellClass = typename Traits::CellClass;
175 std::array<std::array<std::uint8_t, Traits::MaximumEdgeSize>, Traits::NumberOfEdges> Edges{};
176 std::array<std::uint8_t, Traits::NumberOfEdges> EdgeSizes{};
177 std::array<std::uint8_t, Traits::NumberOfEdges> EdgeCorners{};
178 std::array<std::uint8_t, Traits::NumberOfEdges> EdgeTypes{};
179 std::array<std::array<std::uint8_t, Traits::MaximumFaceSize>, Traits::NumberOfFaces> Faces{};
180 std::array<std::uint8_t, Traits::NumberOfFaces> FaceSizes{};
181 std::array<std::uint8_t, Traits::NumberOfFaces> FaceCorners{};
182 std::array<std::uint8_t, Traits::NumberOfFaces> FaceTypes{};
183
185 {
186 if constexpr (Traits::NumberOfEdges > 0)
187 {
188 for (int e = 0; e < Traits::NumberOfEdges; ++e)
189 {
190 SetRow(CellClass::GetEdgeArray(e), Traits::MaximumEdgeSize, this->Edges[e].data(),
191 this->EdgeSizes[e], this->EdgeCorners[e], this->EdgeTypes[e]);
192 }
193 }
194 if constexpr (Traits::NumberOfFaces > 0)
195 {
196 for (int f = 0; f < Traits::NumberOfFaces; ++f)
197 {
198 SetRow(CellClass::GetFaceArray(f), Traits::MaximumFaceSize, this->Faces[f].data(),
199 this->FaceSizes[f], this->FaceCorners[f], this->FaceTypes[f]);
200 if constexpr (CellType == VTK_VOXEL)
201 {
202 std::swap(this->Faces[f][2], this->Faces[f][3]);
203 }
204 }
205 }
206 }
207
208 static void SetRow(const vtkIdType* row, int maxSize, std::uint8_t* side, std::uint8_t& size,
209 std::uint8_t& corners, std::uint8_t& type)
210 {
211 int n = 0;
212 for (; n < maxSize && row[n] >= 0; ++n)
213 {
214 side[n] = static_cast<std::uint8_t>(row[n]);
215 }
216 int c = 0;
217 while (c < n && row[c] < Traits::NumberOfCorners)
218 {
219 ++c;
220 }
221 size = static_cast<std::uint8_t>(n);
222 corners = static_cast<std::uint8_t>(c);
223 type = static_cast<std::uint8_t>(GetFixedSizeSideType(n, c));
224 }
225};
226
227//------------------------------------------------------------------------------
228// The cells of the cell type of a fixed size CellType, see vtkCellTypeTraits::HasFixedSize, e.g.,
229// VTK_TETRA and VTK_QUADRATIC_HEXAHEDRON, whose sides are read from static tables, see
230// FixedSizeCellSideTables. The other cells have their own classes, see DispatchCellSides().
231template <int CellType>
233{
235 static_assert(Traits::HasFixedSize, "only the cell types of a fixed size have static tables");
236 static_assert((Traits::NumberOfEdges > 0) == (Traits::Dimension >= 2) &&
237 (Traits::NumberOfFaces > 0) == (Traits::Dimension == 3),
238 "the cells have edges if they are 2D or 3D, and faces if they are 3D");
239 static constexpr bool UsesNumberOfPoints = false;
240 static constexpr int MaximumFaceCorners = Traits::MaximumFaceCorners;
241 static constexpr int MinimumFaceCorners = Traits::MinimumFaceCorners;
242 // The tables are built once, when the program is loaded, so that reading them needs no guard.
244
245 static constexpr int GetDimension(unsigned char) { return Traits::Dimension; }
246
247 template <class DataSetT>
248 static constexpr int GetNumberOfSides(
249 DataSetT*, vtkIdType, unsigned char, int sideDim, vtkIdType, vtkGenericCell*)
250 {
251 switch (sideDim)
252 {
253 case 0:
254 return Traits::NumberOfPoints;
255 case 1:
256 return Traits::NumberOfEdges;
257 case 2:
258 default:
259 return Traits::NumberOfFaces;
260 }
261 }
262
263 static int GetSideType(unsigned char, int sideDim, int sideId)
264 {
265 switch (sideDim)
266 {
267 case 0:
268 return VTK_VERTEX;
269 case 1:
270 if constexpr (Traits::Dimension >= 2)
271 {
272 return Tables.EdgeTypes[sideId];
273 }
274 else
275 {
276 return VTK_EMPTY_CELL;
277 }
278 case 2:
279 default:
280 if constexpr (Traits::Dimension == 3)
281 {
282 return Tables.FaceTypes[sideId];
283 }
284 else
285 {
286 return VTK_EMPTY_CELL;
287 }
288 }
289 }
290
291 // The number of points of an edge, of a face and of its corners, known at compile time if all
292 // the edges or faces have the same.
293 static VTK_ALWAYS_INLINE int GetEdgeSize(int edge)
294 {
295 if constexpr (Traits::MinimumEdgeSize == Traits::MaximumEdgeSize)
296 {
297 return Traits::MaximumEdgeSize;
298 }
299 else
300 {
301 return Tables.EdgeSizes[edge];
302 }
303 }
304 static VTK_ALWAYS_INLINE int GetFaceSize(int face)
305 {
306 if constexpr (Traits::MinimumFaceSize == Traits::MaximumFaceSize)
307 {
308 return Traits::MaximumFaceSize;
309 }
310 else
311 {
312 return Tables.FaceSizes[face];
313 }
314 }
315 static VTK_ALWAYS_INLINE int GetFaceCorners(int face)
316 {
317 if constexpr (MaximumFaceCorners == MinimumFaceCorners)
318 {
319 return MaximumFaceCorners;
320 }
321 else
322 {
323 return Tables.FaceCorners[face];
324 }
325 }
326
327 template <class DataSetT>
328 static int GetSideSize(
329 DataSetT*, vtkIdType, unsigned char, int sideDim, int sideId, vtkGenericCell*)
330 {
331 switch (sideDim)
332 {
333 case 0:
334 return 1;
335 case 1:
336 if constexpr (Traits::Dimension >= 2)
337 {
338 return FixedSizeCellSides::GetEdgeSize(sideId);
339 }
340 else
341 {
342 return 0;
343 }
344 case 2:
345 default:
346 if constexpr (Traits::Dimension == 3)
347 {
348 return FixedSizeCellSides::GetFaceSize(sideId);
349 }
350 else
351 {
352 return 0;
353 }
354 }
355 }
356
357 template <class DataSetT, class PointsIterator>
358 static vtkIdType GetSidePoints(DataSetT*, vtkIdType, unsigned char, int sideDim, int sideId,
359 vtkIdType, PointsIterator pts, vtkIdType* ptIds, vtkIdList*, const vtkIdType*& ids,
360 vtkIdType& numCorners, vtkGenericCell*)
361 {
362 ids = ptIds;
363 switch (sideDim)
364 {
365 case 0:
366 ptIds[0] = static_cast<vtkIdType>(pts[sideId]);
367 return numCorners = 1;
368 case 1:
369 if constexpr (Traits::Dimension >= 2)
370 {
371 const auto& edge = Tables.Edges[sideId];
372 const int numEdgePts = FixedSizeCellSides::GetEdgeSize(sideId);
373 for (int k = 0; k < numEdgePts; ++k)
374 {
375 ptIds[k] = static_cast<vtkIdType>(pts[edge[k]]);
376 }
377 numCorners = 2;
378 return numEdgePts;
379 }
380 else
381 {
382 return numCorners = 0;
383 }
384 case 2:
385 default:
386 if constexpr (Traits::Dimension == 3)
387 {
388 const auto& face = Tables.Faces[sideId];
389 const int numFacePts = FixedSizeCellSides::GetFaceSize(sideId);
390 for (int k = 0; k < numFacePts; ++k)
391 {
392 ptIds[k] = static_cast<vtkIdType>(pts[face[k]]);
393 }
394 numCorners = FixedSizeCellSides::GetFaceCorners(sideId);
395 return numFacePts;
396 }
397 else
398 {
399 return numCorners = 0;
400 }
401 }
402 }
403};
404
405//------------------------------------------------------------------------------
406// The cells of the cell type CellType, VTK_POLY_VERTEX or VTK_POLY_LINE, whose only sides are their
407// vertices, their points: a poly-line has no edges, see vtkPolyLine::GetNumberOfEdges().
408template <int CellType>
410{
412 static_assert(CellType == VTK_POLY_VERTEX || CellType == VTK_POLY_LINE,
413 "only the cell types whose only sides are their vertices");
414 static constexpr bool UsesNumberOfPoints = true;
415 static constexpr int MaximumFaceCorners = 0;
416 static constexpr int MinimumFaceCorners = 0;
417
418 static constexpr int GetDimension(unsigned char) { return Traits::Dimension; }
419
420 template <class DataSetT>
421 static constexpr int GetNumberOfSides(
422 DataSetT*, vtkIdType, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell*)
423 {
424 return sideDim == 0 ? static_cast<int>(npts) : 0;
425 }
426
427 static constexpr int GetSideType(unsigned char, int sideDim, int)
428 {
429 return sideDim == 0 ? VTK_VERTEX : VTK_EMPTY_CELL;
430 }
431
432 template <class DataSetT>
433 static constexpr int GetSideSize(
434 DataSetT*, vtkIdType, unsigned char, int sideDim, int, vtkGenericCell*)
435 {
436 return sideDim == 0 ? 1 : 0;
437 }
438
439 template <class DataSetT, class PointsIterator>
440 static vtkIdType GetSidePoints(DataSetT*, vtkIdType, unsigned char, int sideDim, int sideId,
441 vtkIdType, PointsIterator pts, vtkIdType* ptIds, vtkIdList*, const vtkIdType*& ids,
442 vtkIdType& numCorners, vtkGenericCell*)
443 {
444 ids = ptIds;
445 if (sideDim != 0)
446 {
447 return numCorners = 0;
448 }
449 ptIds[0] = static_cast<vtkIdType>(pts[sideId]);
450 return numCorners = 1;
451 }
452};
453
454//------------------------------------------------------------------------------
455// The triangle strips, whose npts edges are their boundary, as vtkTriangleStrip::GetEdge(): the
456// first edge (0, 1), then the edges (k - 1, k + 1) along both sides of the strip, and the last
457// edge (npts - 2, npts - 1).
459{
460 static constexpr bool UsesNumberOfPoints = true;
461 static constexpr int MaximumFaceCorners = 0;
462 static constexpr int MinimumFaceCorners = 0;
463
464 static constexpr int GetDimension(unsigned char) { return 2; }
465
466 template <class DataSetT>
467 static constexpr int GetNumberOfSides(
468 DataSetT*, vtkIdType, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell*)
469 {
470 return sideDim < 2 ? static_cast<int>(npts) : 0;
471 }
472
473 static constexpr int GetSideType(unsigned char, int sideDim, int)
474 {
475 switch (sideDim)
476 {
477 case 0:
478 return VTK_VERTEX;
479 case 1:
480 return VTK_LINE;
481 case 2:
482 default:
483 return VTK_EMPTY_CELL;
484 }
485 }
486
487 template <class DataSetT>
488 static constexpr int GetSideSize(
489 DataSetT*, vtkIdType, unsigned char, int sideDim, int, vtkGenericCell*)
490 {
491 switch (sideDim)
492 {
493 case 0:
494 return 1;
495 case 1:
496 return 2;
497 case 2:
498 default:
499 return 0;
500 }
501 }
502
503 template <class DataSetT, class PointsIterator>
504 static vtkIdType GetSidePoints(DataSetT*, vtkIdType, unsigned char, int sideDim, int sideId,
505 vtkIdType npts, PointsIterator pts, vtkIdType* ptIds, vtkIdList*, const vtkIdType*& ids,
506 vtkIdType& numCorners, vtkGenericCell*)
507 {
508 ids = ptIds;
509 switch (sideDim)
510 {
511 case 0:
512 ptIds[0] = static_cast<vtkIdType>(pts[sideId]);
513 return numCorners = 1;
514 case 1:
515 {
516 // The edges along the sides of the strip join every other point, between the first and the
517 // last edges.
518 vtkIdType first = sideId - 1;
519 vtkIdType second = sideId + 1;
520 if (sideId == 0)
521 {
522 first = 0;
523 second = 1;
524 }
525 else if (sideId == npts - 1)
526 {
527 first = npts - 2;
528 second = npts - 1;
529 }
530 ptIds[0] = static_cast<vtkIdType>(pts[first]);
531 ptIds[1] = static_cast<vtkIdType>(pts[second]);
532 return numCorners = 2;
533 }
534 case 2:
535 default:
536 return numCorners = 0;
537 }
538 }
539};
540
541//------------------------------------------------------------------------------
542// The polygons, whose edges join consecutive points, and, with Quadratic, the quadratic polygons,
543// see vtkQuadraticPolygon, whose first n = npts / 2 points are the corners, joined by the edges,
544// and whose last n points are the mid-edge points: the edge i is (i, (i + 1) % n, i + n), a
545// VTK_QUADRATIC_EDGE.
546template <bool Quadratic>
548{
549 static constexpr bool UsesNumberOfPoints = true;
550 static constexpr int MaximumFaceCorners = 0;
551 static constexpr int MinimumFaceCorners = 0;
552
553 static constexpr int GetDimension(unsigned char) { return 2; }
554
555 // The number of corners of a polygon of npts points.
557 {
558 return Quadratic ? npts / 2 : npts;
559 }
560
561 template <class DataSetT>
562 static constexpr int GetNumberOfSides(
563 DataSetT*, vtkIdType, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell*)
564 {
565 switch (sideDim)
566 {
567 case 0:
568 return npts;
569 case 1:
571 case 2:
572 default:
573 return 0;
574 }
575 }
576
577 static constexpr int GetSideType(unsigned char, int sideDim, int)
578 {
579 switch (sideDim)
580 {
581 case 0:
582 return VTK_VERTEX;
583 case 1:
584 return Quadratic ? VTK_QUADRATIC_EDGE : VTK_LINE;
585 case 2:
586 default:
587 return VTK_EMPTY_CELL;
588 }
589 }
590
591 template <class DataSetT>
592 static constexpr int GetSideSize(
593 DataSetT*, vtkIdType, unsigned char, int sideDim, int, vtkGenericCell*)
594 {
595 switch (sideDim)
596 {
597 case 0:
598 return 1;
599 case 1:
600 return Quadratic ? 3 : 2;
601 case 2:
602 default:
603 return 0;
604 }
605 }
606
607 template <class DataSetT, class PointsIterator>
608 static vtkIdType GetSidePoints(DataSetT*, vtkIdType, unsigned char, int sideDim, int sideId,
609 vtkIdType npts, PointsIterator pts, vtkIdType* ptIds, vtkIdList*, const vtkIdType*& ids,
610 vtkIdType& numCorners, vtkGenericCell*)
611 {
612 ids = ptIds;
613 switch (sideDim)
614 {
615 case 0:
616 ptIds[0] = static_cast<vtkIdType>(pts[sideId]);
617 return numCorners = 1;
618 case 1:
619 {
621 ptIds[0] = static_cast<vtkIdType>(pts[sideId]);
622 ptIds[1] = static_cast<vtkIdType>(pts[(sideId + 1) % n]);
623 numCorners = 2;
624 if constexpr (Quadratic)
625 {
626 ptIds[2] = static_cast<vtkIdType>(pts[sideId + n]);
627 return 3;
628 }
629 else
630 {
631 return 2;
632 }
633 }
634 case 2:
635 default:
636 return numCorners = 0;
637 }
638 }
639};
640
641//------------------------------------------------------------------------------
642// The number of corners of a side of type sideType and numSidePts points, which are its first
643// points: its points for a linear side.
644constexpr vtkIdType GetNumberOfSideCorners(int sideType, vtkIdType numSidePts)
645{
646 switch (sideType)
647 {
649 case VTK_CUBIC_LINE:
652 case VTK_BEZIER_CURVE:
653 return 2;
659 return 3;
666 return 4;
668 return numSidePts / 2;
669 default:
670 return numSidePts;
671 }
672}
673
674//------------------------------------------------------------------------------
675// The edge (sideDim 1) or face (sideDim 2) sideId of the cell cellId, built in `cell`, or nullptr.
676// GetNumberOfFaces() comes first: a vtkConvexPointSet finds its faces there.
677template <class DataSetT>
679 DataSetT* input, vtkIdType cellId, int sideDim, int sideId, vtkGenericCell* cell)
680{
681 // if the previous queried cell is still the same one, no need to extract the cell
682 if (cellId != cell->GetCellId())
683 {
684 input->GetCell(cellId, cell);
685 }
686 switch (sideDim)
687 {
688 case 0:
689 return nullptr;
690 case 1:
691 return cell->GetEdge(sideId);
692 case 2:
693 default:
694 return cell->GetFace(sideId);
695 }
696}
697
698//------------------------------------------------------------------------------
699// The points of the edge or face sideId of the cell cellId, built in `cell`, copied into
700// `sidePts`, as the GetSidePoints() of the classes of sides, or none if it cannot be built. Not
701// inlined, to keep it out of the hot loops.
702template <class DataSetT>
703VTK_NEVER_INLINE vtkIdType GetGenericSidePoints(DataSetT* input, vtkIdType cellId, int sideDim,
704 int sideId, vtkIdList* sidePts, const vtkIdType*& ids, vtkIdType& numCorners,
705 vtkGenericCell* cell)
706{
707 vtkCell* side = GetGenericSide(input, cellId, sideDim, sideId, cell);
708 if (!side)
709 {
710 ids = sidePts->GetPointer(0);
711 return numCorners = 0;
712 }
713 sidePts->DeepCopy(side->GetPointIds());
714 ids = sidePts->GetPointer(0);
715 const vtkIdType numSidePts = sidePts->GetNumberOfIds();
716 numCorners = std::min(numSidePts, GetNumberOfSideCorners(side->GetCellType(), numSidePts));
717 return numSidePts;
718}
719
720//------------------------------------------------------------------------------
721// The convex point sets, which have no edges, see vtkConvexPointSet::GetNumberOfEdges(), and whose
722// faces are the triangles of the triangulation of their points.
724{
725 static constexpr bool UsesNumberOfPoints = true;
726 static constexpr int MaximumFaceCorners = 3;
727 static constexpr int MinimumFaceCorners = 3;
728
729 static constexpr int GetDimension(unsigned char) { return 3; }
730
731 template <class DataSetT>
732 static constexpr int GetNumberOfSides(DataSetT* input, vtkIdType cellId, unsigned char,
733 int sideDim, vtkIdType npts, vtkGenericCell* cell)
734 {
735 switch (sideDim)
736 {
737 case 0:
738 return static_cast<int>(npts);
739 case 1:
740 return 0;
741 case 2:
742 default:
743 if (cellId != cell->GetCellId())
744 {
745 input->GetCell(cellId, cell);
746 }
747 return cell->GetNumberOfFaces();
748 }
749 }
750
751 static constexpr int GetSideType(unsigned char, int sideDim, int)
752 {
753 switch (sideDim)
754 {
755 case 0:
756 return VTK_VERTEX;
757 case 1:
758 return VTK_EMPTY_CELL;
759 case 2:
760 default:
761 return VTK_TRIANGLE;
762 }
763 }
764
765 template <class DataSetT>
766 static constexpr int GetSideSize(
767 DataSetT*, vtkIdType, unsigned char, int sideDim, int, vtkGenericCell*)
768 {
769 switch (sideDim)
770 {
771 case 0:
772 return 1;
773 case 1:
774 return 0;
775 case 2:
776 default:
777 return 3;
778 }
779 }
780
781 template <class DataSetT, class PointsIterator>
782 static vtkIdType GetSidePoints(DataSetT* input, vtkIdType cellId, unsigned char, int sideDim,
783 int sideId, vtkIdType, PointsIterator pts, vtkIdType* ptIds, vtkIdList* sidePts,
784 const vtkIdType*& ids, vtkIdType& numCorners, vtkGenericCell* cell)
785 {
786 ids = ptIds;
787 switch (sideDim)
788 {
789 case 0:
790 ptIds[0] = static_cast<vtkIdType>(pts[sideId]);
791 return numCorners = 1;
792 case 1:
793 return numCorners = 0;
794 case 2:
795 default:
796 return GetGenericSidePoints(input, cellId, 2, sideId, sidePts, ids, numCorners, cell);
797 }
798 }
799};
800
801//------------------------------------------------------------------------------
802// The polyhedra of a vtkUnstructuredGrid, whose faces are given by its vtkPolyhedronCellArray. The
803// other datasets have no polyhedron. A polyhedron is assumed to be closed and of genus 0, as by
804// vtkPolyhedron, so that its number of edges is given by Euler's formula, V - E + F = 2, from its
805// number of points and of faces. Its edges are those of the vtkPolyhedron built in `cell`, see
806// GetGenericSidePoints(), and an edge beyond them, of a polyhedron that is not closed, has no
807// points.
809{
810 static constexpr bool UsesNumberOfPoints = true;
811 static constexpr int MaximumFaceCorners = 0;
812 static constexpr int MinimumFaceCorners = 0;
813
814 static constexpr int GetDimension(unsigned char) { return 3; }
815
816 template <class DataSetT>
818 DataSetT* input, vtkIdType cellId, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell*)
819 {
820 if constexpr (!std::is_same_v<DataSetT, vtkUnstructuredGrid>)
821 {
822 return 0;
823 }
824 else
825 {
826 switch (sideDim)
827 {
828 case 0:
829 return static_cast<int>(npts);
830 case 1:
831 return static_cast<int>(
832 input->GetPolyhedronCellArray()->GetCellNumberOfFacePoints(cellId) / 2);
833 case 2:
834 default:
835 return input->GetPolyhedronCellArray()->GetCellNumberOfFaces(cellId);
836 }
837 }
838 }
839
840 static constexpr int GetSideType(unsigned char, int sideDim, int)
841 {
842 switch (sideDim)
843 {
844 case 0:
845 return VTK_VERTEX;
846 case 1:
847 return VTK_LINE;
848 case 2:
849 default:
850 return VTK_POLYGON;
851 }
852 }
853
854 template <class DataSetT>
855 static int GetSideSize(
856 DataSetT* input, vtkIdType cellId, unsigned char, int sideDim, int sideId, vtkGenericCell*)
857 {
858 if constexpr (!std::is_same_v<DataSetT, vtkUnstructuredGrid>)
859 {
860 return 0;
861 }
862 else
863 {
864 switch (sideDim)
865 {
866 case 0:
867 return 1;
868 case 1:
869 return 2;
870 case 2:
871 default:
872 return static_cast<int>(input->GetPolyhedronCellArray()->GetFaceSize(cellId, sideId));
873 }
874 }
875 }
876
877 template <class DataSetT, class PointsIterator>
878 static vtkIdType GetSidePoints(DataSetT* input, vtkIdType cellId, unsigned char, int sideDim,
879 int sideId, vtkIdType, PointsIterator pts, vtkIdType* ptIds, vtkIdList* sidePts,
880 const vtkIdType*& ids, vtkIdType& numCorners, vtkGenericCell* cell)
881 {
882 if constexpr (!std::is_same_v<DataSetT, vtkUnstructuredGrid>)
883 {
884 return numCorners = 0;
885 }
886 else
887 {
888 switch (sideDim)
889 {
890 case 0:
891 ids = ptIds;
892 ptIds[0] = static_cast<vtkIdType>(pts[sideId]);
893 return numCorners = 1;
894 case 1:
895 // The edges of a polyhedron are found by vtkPolyhedron from its faces.
897 input, cellId, sideDim, sideId, sidePts, ids, numCorners, cell);
898 case 2:
899 default:
900 {
901 vtkIdType numFacePts = 0;
902 input->GetPolyhedronCellArray()->GetFacePoints(cellId, sideId, numFacePts, ids, sidePts);
903 return numCorners = numFacePts;
904 }
905 }
906 }
907 }
908};
909
910//------------------------------------------------------------------------------
911// The number of points of the edge or face sideId of the cell cellId, built in `cell`, or 0 if it
912// cannot be built. Not inlined, to keep it out of the hot loops.
913template <class DataSetT>
914VTK_NEVER_INLINE int GetGenericSideSize(
915 DataSetT* input, vtkIdType cellId, int sideDim, int sideId, vtkGenericCell* cell)
916{
917 vtkCell* side = GetGenericSide(input, cellId, sideDim, sideId, cell);
918 return side ? static_cast<int>(side->GetNumberOfPoints()) : 0;
919}
920
921//------------------------------------------------------------------------------
922// The higher order cells of the cell type CellType, the Lagrange and Bezier ones, e.g.,
923// VTK_LAGRANGE_HEXAHEDRON, whose numbers and types of sides are given by their traits: their edges
924// are the curves and their faces the triangles or quadrilaterals of the same family, e.g.,
925// VTK_LAGRANGE_CURVE and VTK_LAGRANGE_QUADRILATERAL. The sizes and points of their sides depend on
926// the order of the cell, which can differ by direction, see vtkCellData::GetHigherOrderDegrees(),
927// so that they are given by the cell built in `cell`, see GetGenericSideSize() and
928// GetGenericSidePoints(). The higher order cell types that cannot be built, see
929// vtkGenericCell::SetCellType(), the abstract VTK_HIGHER_ORDER_ ones and the pyramids, which are
930// not implemented, are empty cells, see DispatchNonLinearCellSides().
931template <int CellType>
933{
935 static_assert(!Traits::IsLinear && !Traits::HasFixedSize && Traits::NumberOfCorners > 0,
936 "only the higher order cell types, whose corners, edges and faces are known");
937 static constexpr bool UsesNumberOfPoints = true;
938 static constexpr int MaximumFaceCorners = Traits::MaximumFaceCorners;
939 static constexpr int MinimumFaceCorners = Traits::MinimumFaceCorners;
940
941 // The cell types of the curves, triangles and quadrilaterals of the family of the cell type.
942 static constexpr bool IsBezier = CellType >= VTK_BEZIER_CURVE && CellType <= VTK_BEZIER_PYRAMID;
945 static constexpr int QuadrilateralType =
947
948 static constexpr int GetDimension(unsigned char) { return Traits::Dimension; }
949
950 template <class DataSetT>
951 static constexpr int GetNumberOfSides(
952 DataSetT*, vtkIdType, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell*)
953 {
954 switch (sideDim)
955 {
956 case 0:
957 return static_cast<int>(npts);
958 case 1:
959 return Traits::NumberOfEdges;
960 case 2:
961 default:
962 return Traits::NumberOfFaces;
963 }
964 }
965
966 static constexpr int GetSideType(unsigned char, int sideDim, int sideId)
967 {
968 switch (sideDim)
969 {
970 case 0:
971 return VTK_VERTEX;
972 case 1:
973 return Traits::Dimension >= 2 ? CurveType : VTK_EMPTY_CELL;
974 case 2:
975 default:
976 if constexpr (Traits::Dimension < 3)
977 {
978 return VTK_EMPTY_CELL;
979 }
980 else if constexpr (MinimumFaceCorners == MaximumFaceCorners)
981 {
982 // The faces of 3 corners are triangles, of 4 quadrilaterals.
984 }
985 else
986 {
987 // The faces 0 and 1 of a wedge are its triangles, see vtkLagrangeWedge::GetFace().
988 return sideId < 2 ? TriangleType : QuadrilateralType;
989 }
990 }
991 }
992
993 template <class DataSetT>
994 static int GetSideSize(
995 DataSetT* input, vtkIdType cellId, unsigned char, int sideDim, int sideId, vtkGenericCell* cell)
996 {
997 return sideDim == 0 ? 1 : GetGenericSideSize(input, cellId, sideDim, sideId, cell);
998 }
999
1000 template <class DataSetT, class PointsIterator>
1001 static vtkIdType GetSidePoints(DataSetT* input, vtkIdType cellId, unsigned char, int sideDim,
1002 int sideId, vtkIdType, PointsIterator pts, vtkIdType* ptIds, vtkIdList* sidePts,
1003 const vtkIdType*& ids, vtkIdType& numCorners, vtkGenericCell* cell)
1004 {
1005 if (sideDim == 0)
1006 {
1007 ids = ptIds;
1008 ptIds[0] = static_cast<vtkIdType>(pts[sideId]);
1009 return numCorners = 1;
1010 }
1011 return GetGenericSidePoints(input, cellId, sideDim, sideId, sidePts, ids, numCorners, cell);
1012 }
1013};
1014
1015//------------------------------------------------------------------------------
1016// The object of a class of sides given to the functors of the dispatch functions, constant
1017// initialized once, whose tables are static members, see FixedSizeCellSides::Tables.
1018template <class Sides>
1019inline constexpr Sides CellSidesInstance{};
1020
1021//------------------------------------------------------------------------------
1022// Call functor(sides) with the sides of the class of the nonlinear cell type cellType, and return
1023// its value, if any, in the order of vtkCellType.h: the cell types that DispatchCellSides() gives
1024// to NonLinearCellSides, which calls this function out of the hot loops.
1025template <class Functor>
1026VTK_ALWAYS_INLINE constexpr decltype(auto) DispatchNonLinearCellSides(
1027 unsigned char cellType, Functor&& functor)
1028{
1029 switch (cellType)
1030 {
1031 case VTK_QUADRATIC_EDGE:
1035 case VTK_QUADRATIC_QUAD:
1063 case VTK_CUBIC_LINE:
1065 case VTK_LAGRANGE_CURVE:
1075 case VTK_LAGRANGE_WEDGE:
1077 case VTK_BEZIER_CURVE:
1087 case VTK_BEZIER_WEDGE:
1089 default:
1090 // Not reached from DispatchCellSides(), which dispatches the other cell types.
1092 }
1093}
1123 "DispatchNonLinearCellSides() dispatches only nonlinear cell types");
1124
1125//------------------------------------------------------------------------------
1126// The dimension of the cells of every cell type with traits, from vtkCellTypeTraits, read for the
1127// nonlinear ones, see NonLinearCellSides: DispatchCellSides() dispatches the cell types without
1128// traits to the empty cells.
1129constexpr std::array<int, VTK_NUMBER_OF_CELL_TYPES> GetDimensions()
1130{
1131 std::array<int, VTK_NUMBER_OF_CELL_TYPES> dimensions{};
1133 [&](auto traits)
1134 {
1135 using Traits = decltype(traits);
1136 dimensions[Traits::CellType] = Traits::Dimension;
1137 });
1138 return dimensions;
1139}
1140inline constexpr std::array<int, VTK_NUMBER_OF_CELL_TYPES> Dimensions = GetDimensions();
1141
1142//------------------------------------------------------------------------------
1143// The nonlinear cells, dispatched out of the hot loops of DispatchCellSides(): their functions are
1144// not inlined, and call DispatchNonLinearCellSides() with the arguments of the sides, not the
1145// functor of the loop, whose references to the locals of the loop would escape, so that they would
1146// be kept in memory for every cell.
1148{
1149 static constexpr bool UsesNumberOfPoints = true;
1150 static constexpr int MaximumFaceCorners = 0;
1151 static constexpr int MinimumFaceCorners = 0;
1152
1153 static constexpr int GetDimension(unsigned char cellType) { return Dimensions[cellType]; }
1154
1155 template <class DataSetT>
1156 static VTK_NEVER_INLINE int GetNumberOfSides(DataSetT* input, vtkIdType cellId,
1157 unsigned char cellType, int sideDim, vtkIdType npts, vtkGenericCell* cell)
1158 {
1159 return DispatchNonLinearCellSides(cellType, [&](auto sides) VTK_ALWAYS_INLINE_LAMBDA
1160 { return sides.GetNumberOfSides(input, cellId, cellType, sideDim, npts, cell); });
1161 }
1162
1163 static VTK_NEVER_INLINE int GetSideType(unsigned char cellType, int sideDim, int sideId)
1164 {
1165 return DispatchNonLinearCellSides(cellType, [&](auto sides) VTK_ALWAYS_INLINE_LAMBDA
1166 { return sides.GetSideType(cellType, sideDim, sideId); });
1167 }
1168
1169 template <class DataSetT>
1170 static VTK_NEVER_INLINE int GetSideSize(DataSetT* input, vtkIdType cellId, unsigned char cellType,
1171 int sideDim, int sideId, vtkGenericCell* cell)
1172 {
1173 return DispatchNonLinearCellSides(cellType, [&](auto sides) VTK_ALWAYS_INLINE_LAMBDA
1174 { return sides.GetSideSize(input, cellId, cellType, sideDim, sideId, cell); });
1175 }
1176
1177 template <class DataSetT, class PointsIterator>
1178 static vtkIdType GetSidePoints(DataSetT* input, vtkIdType cellId, unsigned char cellType,
1179 int sideDim, int sideId, vtkIdType npts, PointsIterator pts, vtkIdType* ptIds,
1180 vtkIdList* sidePts, const vtkIdType*& ids, vtkIdType& numCorners, vtkGenericCell* cell)
1181 {
1182 switch (sideDim)
1183 {
1184 case 0:
1185 ids = ptIds;
1186 ptIds[0] = static_cast<vtkIdType>(pts[sideId]);
1187 return numCorners = 1;
1188 case 1:
1189 case 2:
1190 default:
1191 return DispatchNonLinearCellSides(cellType,
1192 [&](auto sides) VTK_ALWAYS_INLINE_LAMBDA
1193 {
1194 return sides.GetSidePoints(input, cellId, cellType, sideDim, sideId, npts, pts, ptIds,
1195 sidePts, ids, numCorners, cell);
1196 });
1197 }
1198 }
1199};
1200
1201//------------------------------------------------------------------------------
1202// Call functor(sides) with the sides of the class of the cell type cellType, and return its value,
1203// if any, in the order of vtkCellType.h: the linear cell types, see vtkCellTypeTraits, to their
1204// classes, the nonlinear ones to NonLinearCellSides, to keep the hot loops that call it small, and
1205// the cell types that cannot be built, see vtkGenericCell::SetCellType(), to the empty cells. The
1206// functor is inlined for every class, and must be, otherwise its members are read through memory
1207// for every side: a struct with a VTK_ALWAYS_INLINE call operator, or a lambda marked with
1208// VTK_ALWAYS_INLINE_LAMBDA.
1209template <class Functor>
1210VTK_ALWAYS_INLINE constexpr decltype(auto) DispatchCellSides(
1211 unsigned char cellType, Functor&& functor)
1212{
1213 switch (cellType)
1214 {
1215 case VTK_EMPTY_CELL:
1217 case VTK_VERTEX:
1219 case VTK_POLY_VERTEX:
1221 case VTK_LINE:
1223 case VTK_POLY_LINE:
1225 case VTK_TRIANGLE:
1227 case VTK_TRIANGLE_STRIP:
1229 case VTK_POLYGON:
1231 case VTK_PIXEL:
1233 case VTK_QUAD:
1235 case VTK_TETRA:
1237 case VTK_VOXEL:
1239 case VTK_HEXAHEDRON:
1241 case VTK_WEDGE:
1243 case VTK_PYRAMID:
1249 case VTK_QUADRATIC_EDGE:
1251 case VTK_QUADRATIC_QUAD:
1265 case VTK_CUBIC_LINE:
1266 // The cell types of DispatchNonLinearCellSides(), out of the hot loops.
1270 case VTK_POLYHEDRON:
1272 case VTK_LAGRANGE_CURVE:
1277 case VTK_LAGRANGE_WEDGE:
1278 case VTK_BEZIER_CURVE:
1283 case VTK_BEZIER_WEDGE:
1284 // The cell types of DispatchNonLinearCellSides(), out of the hot loops.
1286 default:
1287 // The cell types that cannot be built, see vtkGenericCell::SetCellType(): without traits, the
1288 // abstract VTK_HIGHER_ORDER_ ones, and the higher order pyramids, are empty cells.
1290 }
1291}
1304 "DispatchCellSides() dispatches only the linear cell types to their classes, the others to "
1305 "NonLinearCellSides");
1306
1307//------------------------------------------------------------------------------
1308// The number of sides of dimension sideDim (0 for the vertices, 1 for the edges, 2 for the faces)
1309// of the cell cellId, of type cellType, or 0 if it has none, e.g., the faces of a 2D cell: see
1310// vtkUnstructuredGrid::GetCellNumberOfEdges() and vtkUnstructuredGrid::GetCellNumberOfFaces(). It
1311// is given by the cell type, the number of points of the cell, or the faces of a polyhedron,
1312// without building the cell.
1313template <class DataSetT>
1315 DataSetT* input, vtkIdType cellId, unsigned char cellType, int sideDim, vtkGenericCell* cell)
1316{
1317 return DispatchCellSides(cellType,
1318 [&](auto sides) VTK_ALWAYS_INLINE_LAMBDA
1319 {
1320 if (VTK_UNLIKELY(sideDim < 0 || sideDim >= sides.GetDimension(cellType)))
1321 {
1322 return 0;
1323 }
1324 vtkIdType npts = 0;
1325 if constexpr (decltype(sides)::UsesNumberOfPoints)
1326 {
1327 npts = input->GetCellSize(cellId);
1328 }
1329 return sides.GetNumberOfSides(input, cellId, cellType, sideDim, npts, cell);
1330 });
1331}
1332
1333//------------------------------------------------------------------------------
1334// The cell type of the side sideId of dimension sideDim (0 for the vertices, 1 for the edges, 2 for
1335// the faces) of the cells of type cellType, 0 <= sideId < its number of sides of this dimension,
1336// or VTK_EMPTY_CELL if they have no side of this dimension: the type of vtkCell::GetEdge() and
1337// vtkCell::GetFace(), e.g., VTK_QUADRATIC_QUAD for a face of a VTK_QUADRATIC_HEXAHEDRON, but for
1338// the faces of a voxel, which are quads, in the order of GetCellSidePoints(). It is given by the
1339// cell type, without the cell.
1340inline int GetCellSideType(unsigned char cellType, int sideDim, int sideId)
1341{
1342 return DispatchCellSides(cellType,
1343 [&](auto sides) VTK_ALWAYS_INLINE_LAMBDA
1344 {
1345 return VTK_LIKELY(sideDim >= 0 && sideDim < sides.GetDimension(cellType))
1346 ? sides.GetSideType(cellType, sideDim, sideId)
1348 });
1349}
1350
1351//------------------------------------------------------------------------------
1352// The number of points of the side sideId of dimension sideDim of the cell cellId, of type
1353// cellType, 0 <= sideId < its number of sides of this dimension, or 0 if the cell has no side of
1354// this dimension: the number of points of GetCellSidePoints(), without reading them, e.g., from the
1355// static tables of the cells of a fixed size. The scratch cell `cell` builds the cells whose sides
1356// are not read from static tables.
1357template <class DataSetT>
1358int GetCellSideSize(DataSetT* input, vtkIdType cellId, unsigned char cellType, int sideDim,
1359 int sideId, vtkGenericCell* cell)
1360{
1361 return DispatchCellSides(cellType,
1362 [&](auto sides) VTK_ALWAYS_INLINE_LAMBDA
1363 {
1364 return VTK_LIKELY(sideDim >= 0 && sideDim < sides.GetDimension(cellType))
1365 ? sides.GetSideSize(input, cellId, cellType, sideDim, sideId, cell)
1366 : 0;
1367 });
1368}
1369
1370//------------------------------------------------------------------------------
1371// The points of the side sideId of dimension sideDim (0 for the vertices, 1 for the edges, 2 for
1372// the faces) of the cell cellId, of type cellType and whose npts points are `pts`, into sidePtIds,
1373// none if it is out of range: see vtkUnstructuredGrid::GetCellEdgePoints() and
1374// vtkUnstructuredGrid::GetCellFacePoints(), whose scratch cell is `cell`. The dataset is, e.g., a
1375// vtkUnstructuredGrid or a vtkPolyData.
1376template <class DataSetT>
1377VTK_ALWAYS_INLINE void GetCellSidePoints(DataSetT* input, vtkIdType cellId, unsigned char cellType,
1378 int sideDim, int sideId, vtkIdType npts, const vtkIdType* pts, vtkIdList* sidePtIds,
1379 vtkGenericCell* cell)
1380{
1381 DispatchCellSides(cellType,
1382 [&](auto sides) VTK_ALWAYS_INLINE_LAMBDA
1383 {
1384 if (VTK_UNLIKELY(sideDim < 0 || sideDim >= sides.GetDimension(cellType) || sideId < 0 ||
1385 sideId >= sides.GetNumberOfSides(input, cellId, cellType, sideDim, npts, cell)))
1386 {
1387 sidePtIds->Reset();
1388 return;
1389 }
1390 const vtkIdType* ids = nullptr;
1391 vtkIdType numCorners = 0;
1392 if constexpr (std::is_same_v<decltype(sides), PolyhedronCellSides>)
1393 {
1394 // A polyhedron may read its sides into sidePtIds, so the others are written into a
1395 // buffer, or point to its faces, then copied into sidePtIds.
1397 const vtkIdType numSidePts = sides.GetSidePoints(input, cellId, cellType, sideDim, sideId,
1398 npts, pts, ptIds, sidePtIds, ids, numCorners, cell);
1399 if (ids != sidePtIds->GetPointer(0))
1400 {
1401 sidePtIds->SetNumberOfIds(numSidePts);
1402 std::copy_n(ids, numSidePts, sidePtIds->GetPointer(0));
1403 }
1404 }
1405 else
1406 {
1407 // The side is written into sidePtIds itself, with room for the largest side, or copied
1408 // into it by a built cell.
1410 const vtkIdType numSidePts = sides.GetSidePoints(input, cellId, cellType, sideDim, sideId,
1411 npts, pts, sidePtIds->GetPointer(0), sidePtIds, ids, numCorners, cell);
1412 sidePtIds->SetNumberOfIds(numSidePts);
1413 }
1414 });
1415}
1416
1417VTK_ABI_NAMESPACE_END
1418} // namespace vtkCellTypeSides
1419#endif // vtkCellTypeSides_h
1420// VTK-HeaderTest-Exclude: vtkCellTypeSides.h
abstract class to specify cell behavior
Definition vtkCell.h:131
vtkIdType GetCellId()
Get the cell id of this cell from its originating vtkDataSet.
Definition vtkCell.h:237
provides thread-safe access to cells
vtkCell * GetFace(int faceId) override
See the vtkCell API for descriptions of these methods.
int GetNumberOfFaces() override
See the vtkCell API for descriptions of these methods.
vtkCell * GetEdge(int edgeId) override
See the vtkCell API for descriptions of these methods.
list of point or cell ids
Definition vtkIdList.h:135
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:185
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition vtkIdList.h:295
void DeepCopy(vtkIdList *ids)
Copy an id list by explicitly copying the internal array.
vtkIdType * GetPointer(vtkIdType i)
Get a pointer to a particular data index.
Definition vtkIdList.h:259
constexpr int GetMaximumCellSidePoints()
VTK_ALWAYS_INLINE constexpr decltype(auto) DispatchNonLinearCellSides(unsigned char cellType, Functor &&functor)
vtkCell * GetGenericSide(DataSetT *input, vtkIdType cellId, int sideDim, int sideId, vtkGenericCell *cell)
constexpr std::array< int, VTK_NUMBER_OF_CELL_TYPES > Dimensions
constexpr int GetFixedSizeSideType(int numPts, int numCorners)
int GetCellSideType(unsigned char cellType, int sideDim, int sideId)
constexpr Sides CellSidesInstance
VTK_ALWAYS_INLINE constexpr decltype(auto) DispatchCellSides(unsigned char cellType, Functor &&functor)
VTK_NEVER_INLINE vtkIdType GetGenericSidePoints(DataSetT *input, vtkIdType cellId, int sideDim, int sideId, vtkIdList *sidePts, const vtkIdType *&ids, vtkIdType &numCorners, vtkGenericCell *cell)
constexpr vtkIdType GetNumberOfSideCorners(int sideType, vtkIdType numSidePts)
constexpr int MaximumCellSidePoints
VTK_NEVER_INLINE int GetGenericSideSize(DataSetT *input, vtkIdType cellId, int sideDim, int sideId, vtkGenericCell *cell)
int GetCellSideSize(DataSetT *input, vtkIdType cellId, unsigned char cellType, int sideDim, int sideId, vtkGenericCell *cell)
constexpr std::array< int, VTK_NUMBER_OF_CELL_TYPES > GetDimensions()
VTK_ALWAYS_INLINE void GetCellSidePoints(DataSetT *input, vtkIdType cellId, unsigned char cellType, int sideDim, int sideId, vtkIdType npts, const vtkIdType *pts, vtkIdList *sidePtIds, vtkGenericCell *cell)
int GetCellNumberOfSides(DataSetT *input, vtkIdType cellId, unsigned char cellType, int sideDim, vtkGenericCell *cell)
static constexpr int GetSideType(unsigned char, int sideDim, int)
static constexpr int GetNumberOfSides(DataSetT *input, vtkIdType cellId, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell *cell)
static constexpr int GetDimension(unsigned char)
static constexpr int GetSideSize(DataSetT *, vtkIdType, unsigned char, int sideDim, int, vtkGenericCell *)
static vtkIdType GetSidePoints(DataSetT *input, vtkIdType cellId, unsigned char, int sideDim, int sideId, vtkIdType, PointsIterator pts, vtkIdType *ptIds, vtkIdList *sidePts, const vtkIdType *&ids, vtkIdType &numCorners, vtkGenericCell *cell)
std::array< std::uint8_t, Traits::NumberOfEdges > EdgeSizes
static void SetRow(const vtkIdType *row, int maxSize, std::uint8_t *side, std::uint8_t &size, std::uint8_t &corners, std::uint8_t &type)
std::array< std::uint8_t, Traits::NumberOfFaces > FaceSizes
std::array< std::array< std::uint8_t, Traits::MaximumFaceSize >, Traits::NumberOfFaces > Faces
std::array< std::uint8_t, Traits::NumberOfFaces > FaceTypes
std::array< std::uint8_t, Traits::NumberOfFaces > FaceCorners
std::array< std::array< std::uint8_t, Traits::MaximumEdgeSize >, Traits::NumberOfEdges > Edges
std::array< std::uint8_t, Traits::NumberOfEdges > EdgeTypes
std::array< std::uint8_t, Traits::NumberOfEdges > EdgeCorners
static vtkIdType GetSidePoints(DataSetT *, vtkIdType, unsigned char, int sideDim, int sideId, vtkIdType, PointsIterator pts, vtkIdType *ptIds, vtkIdList *, const vtkIdType *&ids, vtkIdType &numCorners, vtkGenericCell *)
static VTK_ALWAYS_INLINE int GetEdgeSize(int edge)
static VTK_ALWAYS_INLINE int GetFaceSize(int face)
static int GetSideSize(DataSetT *, vtkIdType, unsigned char, int sideDim, int sideId, vtkGenericCell *)
static int GetSideType(unsigned char, int sideDim, int sideId)
static constexpr int GetDimension(unsigned char)
static VTK_ALWAYS_INLINE int GetFaceCorners(int face)
static constexpr int GetNumberOfSides(DataSetT *, vtkIdType, unsigned char, int sideDim, vtkIdType, vtkGenericCell *)
vtkCellTypeTraits< CellType > Traits
static const FixedSizeCellSideTables< CellType > Tables
static vtkIdType GetSidePoints(DataSetT *input, vtkIdType cellId, unsigned char, int sideDim, int sideId, vtkIdType, PointsIterator pts, vtkIdType *ptIds, vtkIdList *sidePts, const vtkIdType *&ids, vtkIdType &numCorners, vtkGenericCell *cell)
static constexpr int GetSideType(unsigned char, int sideDim, int sideId)
vtkCellTypeTraits< CellType > Traits
static constexpr int GetDimension(unsigned char)
static int GetSideSize(DataSetT *input, vtkIdType cellId, unsigned char, int sideDim, int sideId, vtkGenericCell *cell)
static constexpr int GetNumberOfSides(DataSetT *, vtkIdType, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell *)
static constexpr int GetDimension(unsigned char cellType)
static VTK_NEVER_INLINE int GetSideType(unsigned char cellType, int sideDim, int sideId)
static VTK_NEVER_INLINE int GetSideSize(DataSetT *input, vtkIdType cellId, unsigned char cellType, int sideDim, int sideId, vtkGenericCell *cell)
static VTK_NEVER_INLINE int GetNumberOfSides(DataSetT *input, vtkIdType cellId, unsigned char cellType, int sideDim, vtkIdType npts, vtkGenericCell *cell)
static vtkIdType GetSidePoints(DataSetT *input, vtkIdType cellId, unsigned char cellType, int sideDim, int sideId, vtkIdType npts, PointsIterator pts, vtkIdType *ptIds, vtkIdList *sidePts, const vtkIdType *&ids, vtkIdType &numCorners, vtkGenericCell *cell)
static vtkIdType GetSidePoints(DataSetT *, vtkIdType, unsigned char, int sideDim, int sideId, vtkIdType, PointsIterator pts, vtkIdType *ptIds, vtkIdList *, const vtkIdType *&ids, vtkIdType &numCorners, vtkGenericCell *)
static constexpr int GetSideType(unsigned char, int sideDim, int)
vtkCellTypeTraits< CellType > Traits
static constexpr int GetSideSize(DataSetT *, vtkIdType, unsigned char, int sideDim, int, vtkGenericCell *)
static constexpr int GetNumberOfSides(DataSetT *, vtkIdType, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell *)
static constexpr int GetDimension(unsigned char)
static constexpr bool UsesNumberOfPoints
static vtkIdType GetSidePoints(DataSetT *, vtkIdType, unsigned char, int sideDim, int sideId, vtkIdType npts, PointsIterator pts, vtkIdType *ptIds, vtkIdList *, const vtkIdType *&ids, vtkIdType &numCorners, vtkGenericCell *)
static constexpr int GetDimension(unsigned char)
static constexpr int GetSideType(unsigned char, int sideDim, int)
static constexpr int GetNumberOfSides(DataSetT *, vtkIdType, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell *)
static constexpr vtkIdType GetNumberOfCorners(vtkIdType npts)
static constexpr int GetSideSize(DataSetT *, vtkIdType, unsigned char, int sideDim, int, vtkGenericCell *)
static int GetSideSize(DataSetT *input, vtkIdType cellId, unsigned char, int sideDim, int sideId, vtkGenericCell *)
static vtkIdType GetSidePoints(DataSetT *input, vtkIdType cellId, unsigned char, int sideDim, int sideId, vtkIdType, PointsIterator pts, vtkIdType *ptIds, vtkIdList *sidePts, const vtkIdType *&ids, vtkIdType &numCorners, vtkGenericCell *cell)
static constexpr int GetSideType(unsigned char, int sideDim, int)
static int GetNumberOfSides(DataSetT *input, vtkIdType cellId, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell *)
static constexpr int GetDimension(unsigned char)
static vtkIdType GetSidePoints(DataSetT *, vtkIdType, unsigned char, int sideDim, int sideId, vtkIdType npts, PointsIterator pts, vtkIdType *ptIds, vtkIdList *, const vtkIdType *&ids, vtkIdType &numCorners, vtkGenericCell *)
static constexpr int GetSideType(unsigned char, int sideDim, int)
static constexpr int GetNumberOfSides(DataSetT *, vtkIdType, unsigned char, int sideDim, vtkIdType npts, vtkGenericCell *)
static constexpr int GetDimension(unsigned char)
static constexpr int GetSideSize(DataSetT *, vtkIdType, unsigned char, int sideDim, int, vtkGenericCell *)
The traits of the cell type CellType, see the file description.
#define VTK_LIKELY(cond)
Hint that cond is expected to be true most of the time.
Definition vtkAssume.h:200
#define VTK_UNLIKELY(cond)
Hint that cond is expected to be false most of the time.
Definition vtkAssume.h:201
The metadata of the cell types of vtkCellType.h, known at compile time.
constexpr void vtkForEachCellType(Functor &&functor)
Call functor(vtkCellTypeTraits<CellType>{}) for every cell type with traits, in the order of vtkCellT...
@ VTK_VOXEL
Definition vtkCellType.h:48
@ VTK_QUADRATIC_HEXAHEDRON
Definition vtkCellType.h:61
@ VTK_TRIANGLE_STRIP
Definition vtkCellType.h:43
@ VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON
Definition vtkCellType.h:70
@ VTK_LAGRANGE_CURVE
@ VTK_PYRAMID
Definition vtkCellType.h:51
@ VTK_PIXEL
Definition vtkCellType.h:45
@ VTK_QUADRATIC_WEDGE
Definition vtkCellType.h:62
@ VTK_BEZIER_WEDGE
@ VTK_BIQUADRATIC_QUAD
Definition vtkCellType.h:64
@ VTK_LAGRANGE_QUADRILATERAL
@ VTK_POLY_LINE
Definition vtkCellType.h:41
@ VTK_TRIQUADRATIC_PYRAMID
Definition vtkCellType.h:66
@ VTK_TRIANGLE
Definition vtkCellType.h:42
@ VTK_BEZIER_TRIANGLE
@ VTK_POLYGON
Definition vtkCellType.h:44
@ VTK_EMPTY_CELL
Definition vtkCellType.h:37
@ VTK_QUADRATIC_PYRAMID
Definition vtkCellType.h:63
@ VTK_POLYHEDRON
Definition vtkCellType.h:80
@ VTK_TRIQUADRATIC_HEXAHEDRON
Definition vtkCellType.h:65
@ VTK_TETRA
Definition vtkCellType.h:47
@ VTK_LINE
Definition vtkCellType.h:40
@ VTK_CONVEX_POINT_SET
Definition vtkCellType.h:77
@ VTK_BEZIER_HEXAHEDRON
@ VTK_LAGRANGE_WEDGE
@ VTK_LAGRANGE_HEXAHEDRON
@ VTK_PENTAGONAL_PRISM
Definition vtkCellType.h:52
@ VTK_HIGHER_ORDER_TRIANGLE
Definition vtkCellType.h:93
@ VTK_QUADRATIC_QUAD
Definition vtkCellType.h:58
@ VTK_WEDGE
Definition vtkCellType.h:50
@ VTK_LAGRANGE_TETRAHEDRON
@ VTK_BEZIER_CURVE
@ VTK_HEXAGONAL_PRISM
Definition vtkCellType.h:53
@ VTK_BEZIER_QUADRILATERAL
@ VTK_QUADRATIC_LINEAR_WEDGE
Definition vtkCellType.h:68
@ VTK_HEXAHEDRON
Definition vtkCellType.h:49
@ VTK_CUBIC_LINE
Definition vtkCellType.h:74
@ VTK_LAGRANGE_TRIANGLE
@ VTK_HIGHER_ORDER_QUADRILATERAL
Definition vtkCellType.h:96
@ VTK_QUADRATIC_POLYGON
Definition vtkCellType.h:59
@ VTK_QUAD
Definition vtkCellType.h:46
@ VTK_HIGHER_ORDER_CURVE
Definition vtkCellType.h:92
@ VTK_QUADRATIC_TRIANGLE
Definition vtkCellType.h:57
@ VTK_QUADRATIC_EDGE
Definition vtkCellType.h:56
@ VTK_QUADRATIC_TETRA
Definition vtkCellType.h:60
@ VTK_BEZIER_TETRAHEDRON
@ VTK_VERTEX
Definition vtkCellType.h:38
@ VTK_POLY_VERTEX
Definition vtkCellType.h:39
@ VTK_QUADRATIC_LINEAR_QUAD
Definition vtkCellType.h:67
@ VTK_BEZIER_PYRAMID
@ VTK_BIQUADRATIC_QUADRATIC_WEDGE
Definition vtkCellType.h:69
@ VTK_BIQUADRATIC_TRIANGLE
Definition vtkCellType.h:71
@ Sides
A side specified by a cell ID and an integer index into sides.
int vtkIdType
Definition vtkType.h:363