Viskores  1.0
ConnectivityStructuredInternals.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 
19 #ifndef viskores_internal_ConnectivityStructuredInternals_h
20 #define viskores_internal_ConnectivityStructuredInternals_h
21 
22 #include <viskores/CellShape.h>
23 #include <viskores/StaticAssert.h>
25 #include <viskores/Types.h>
26 #include <viskores/VecVariable.h>
27 
29 
30 namespace viskores
31 {
32 namespace internal
33 {
34 
35 template <viskores::IdComponent>
36 class ConnectivityStructuredInternals;
37 
38 //1 D specialization.
39 template <>
40 class ConnectivityStructuredInternals<1>
41 {
42 public:
43  using SchedulingRangeType = viskores::Id;
44 
46  void SetPointDimensions(viskores::Id dimensions) { this->PointDimensions = dimensions; }
47 
49  void SetGlobalPointDimensions(viskores::Id dimensions)
50  {
51  this->GlobalPointDimensions = dimensions;
52  }
53 
55  void SetGlobalPointIndexStart(viskores::Id start) { this->GlobalPointIndexStart = start; }
56 
58  viskores::Id GetPointDimensions() const { return this->PointDimensions; }
59 
61  viskores::Id GetGlobalPointDimensions() const { return this->GlobalPointDimensions; }
62 
64  viskores::Id GetCellDimensions() const { return this->PointDimensions - 1; }
65 
67  viskores::Id GetGlobalCellDimensions() const { return this->GlobalPointDimensions - 1; }
68 
70  SchedulingRangeType GetSchedulingRange(viskores::TopologyElementTagCell) const
71  {
72  return this->GetNumberOfCells();
73  }
74 
76  SchedulingRangeType GetSchedulingRange(viskores::TopologyElementTagPoint) const
77  {
78  return this->GetNumberOfPoints();
79  }
80 
82  SchedulingRangeType GetGlobalPointIndexStart() const { return this->GlobalPointIndexStart; }
83 
84  static constexpr viskores::IdComponent NUM_POINTS_IN_CELL = 2;
85  static constexpr viskores::IdComponent MAX_CELL_TO_POINT = 2;
86 
88  viskores::Id GetNumberOfPoints() const { return this->PointDimensions; }
90  viskores::Id GetNumberOfCells() const { return this->PointDimensions - 1; }
92  viskores::IdComponent GetNumberOfPointsInCell() const { return NUM_POINTS_IN_CELL; }
94  viskores::IdComponent GetCellShape() const { return viskores::CELL_SHAPE_LINE; }
95 
96  using CellShapeTag = viskores::CellShapeTagLine;
97 
100  {
101  VISKORES_ASSUME(index >= 0);
102 
104  pointIds[0] = index;
105  pointIds[1] = pointIds[0] + 1;
106  return pointIds;
107  }
108 
110  viskores::IdComponent GetNumberOfCellsOnPoint(viskores::Id pointIndex) const
111  {
112  VISKORES_ASSUME(pointIndex >= 0);
113 
114  if ((pointIndex > 0) && (pointIndex < this->PointDimensions - 1))
115  {
116  return 2;
117  }
118  else
119  {
120  return 1;
121  }
122  }
123 
126  {
127  VISKORES_ASSUME(index >= 0);
128  VISKORES_ASSUME(this->PointDimensions > 1);
129 
131 
132  if (index > 0)
133  {
134  cellIds.Append(index - 1);
135  }
136  if (index < this->PointDimensions - 1)
137  {
138  cellIds.Append(index);
139  }
140 
141  return cellIds;
142  }
143 
144 
146  viskores::Id FlatToLogicalPointIndex(viskores::Id flatPointIndex) const { return flatPointIndex; }
147 
149  viskores::Id LogicalToFlatPointIndex(viskores::Id logicalPointIndex) const
150  {
151  return logicalPointIndex;
152  }
153 
155  viskores::Id FlatToLogicalCellIndex(viskores::Id flatCellIndex) const { return flatCellIndex; }
156 
158  viskores::Id LogicalToFlatCellIndex(viskores::Id logicalCellIndex) const
159  {
160  return logicalCellIndex;
161  }
162 
164  void PrintSummary(std::ostream& out) const
165  {
166  out << " UniformConnectivity<1> ";
167  out << "PointDimensions[" << this->PointDimensions << "] ";
168  out << "GlobalPointDimensions[" << this->GlobalPointDimensions << "] ";
169  out << "GlobalPointIndexStart[" << this->GlobalPointIndexStart << "] ";
170  out << "\n";
171  }
172 
173 private:
174  viskores::Id PointDimensions = 0;
175  viskores::Id GlobalPointDimensions = 0;
176  viskores::Id GlobalPointIndexStart = 0;
177 };
178 
179 //2 D specialization.
180 template <>
181 class ConnectivityStructuredInternals<2>
182 {
183 public:
184  using SchedulingRangeType = viskores::Id2;
185 
187  void SetPointDimensions(viskores::Id2 dims) { this->PointDimensions = dims; }
188 
190  void SetGlobalPointDimensions(viskores::Id2 dims) { this->GlobalPointDimensions = dims; }
191 
193  void SetGlobalPointIndexStart(viskores::Id2 start) { this->GlobalPointIndexStart = start; }
194 
196  const viskores::Id2& GetPointDimensions() const { return this->PointDimensions; }
197 
199  const viskores::Id2& GetGlobalPointDimensions() const { return this->GlobalPointDimensions; }
200 
202  viskores::Id2 GetCellDimensions() const { return this->PointDimensions - viskores::Id2(1); }
203 
205  viskores::Id2 GetGlobalCellDimensions() const
206  {
207  return this->GlobalPointDimensions - viskores::Id2(1);
208  }
209 
211  viskores::Id GetNumberOfPoints() const
212  {
213  return viskores::ReduceProduct(this->GetPointDimensions());
214  }
215 
216  //returns an id2 to signal what kind of scheduling to use
218  viskores::Id2 GetSchedulingRange(viskores::TopologyElementTagCell) const
219  {
220  return this->GetCellDimensions();
221  }
223  viskores::Id2 GetSchedulingRange(viskores::TopologyElementTagPoint) const
224  {
225  return this->GetPointDimensions();
226  }
227 
229  const viskores::Id2& GetGlobalPointIndexStart() const { return this->GlobalPointIndexStart; }
230 
231  static constexpr viskores::IdComponent NUM_POINTS_IN_CELL = 4;
232  static constexpr viskores::IdComponent MAX_CELL_TO_POINT = 4;
233 
235  viskores::Id GetNumberOfCells() const
236  {
237  return viskores::ReduceProduct(this->GetCellDimensions());
238  }
240  viskores::IdComponent GetNumberOfPointsInCell() const { return NUM_POINTS_IN_CELL; }
242  viskores::IdComponent GetCellShape() const { return viskores::CELL_SHAPE_QUAD; }
243 
244  using CellShapeTag = viskores::CellShapeTagQuad;
245 
248  const SchedulingRangeType& logicalCellIndex) const
249  {
251  pointIds[0] = this->LogicalToFlatPointIndex(logicalCellIndex);
252  pointIds[1] = pointIds[0] + 1;
253  pointIds[2] = pointIds[1] + this->PointDimensions[0];
254  pointIds[3] = pointIds[2] - 1;
255  return pointIds;
256  }
257 
259  viskores::Vec<viskores::Id, NUM_POINTS_IN_CELL> GetPointsOfCell(viskores::Id cellIndex) const
260  {
261  return this->GetPointsOfCell(this->FlatToLogicalCellIndex(cellIndex));
262  }
263 
264  VISKORES_EXEC_CONT viskores::IdComponent GetNumberOfCellsOnPoint(
265  const SchedulingRangeType& ij) const
266  {
267  viskores::IdComponent numCells = 1;
268 
269  for (viskores::IdComponent dim = 0; dim < 2; dim++)
270  {
271  if ((ij[dim] > 0) && (ij[dim] < this->PointDimensions[dim] - 1))
272  {
273  numCells *= 2;
274  }
275  }
276 
277  return numCells;
278  }
279 
281  viskores::IdComponent GetNumberOfCellsOnPoint(viskores::Id pointIndex) const
282  {
283  return this->GetNumberOfCellsOnPoint(this->FlatToLogicalPointIndex(pointIndex));
284  }
285 
288  const SchedulingRangeType& ij) const
289  {
291 
292  if ((ij[0] > 0) && (ij[1] > 0))
293  {
294  cellIds.Append(this->LogicalToFlatCellIndex(ij - viskores::Id2(1, 1)));
295  }
296  if ((ij[0] < this->PointDimensions[0] - 1) && (ij[1] > 0))
297  {
298  cellIds.Append(this->LogicalToFlatCellIndex(ij - viskores::Id2(0, 1)));
299  }
300  if ((ij[0] > 0) && (ij[1] < this->PointDimensions[1] - 1))
301  {
302  cellIds.Append(this->LogicalToFlatCellIndex(ij - viskores::Id2(1, 0)));
303  }
304  if ((ij[0] < this->PointDimensions[0] - 1) && (ij[1] < this->PointDimensions[1] - 1))
305  {
306  cellIds.Append(this->LogicalToFlatCellIndex(ij));
307  }
308 
309  return cellIds;
310  }
311 
314  viskores::Id pointIndex) const
315  {
316  return this->GetCellsOfPoint(this->FlatToLogicalPointIndex(pointIndex));
317  }
318 
320  viskores::Id2 FlatToLogicalPointIndex(viskores::Id flatPointIndex) const
321  {
322  viskores::Id2 logicalPointIndex;
323  logicalPointIndex[0] = flatPointIndex % this->PointDimensions[0];
324  logicalPointIndex[1] = flatPointIndex / this->PointDimensions[0];
325  return logicalPointIndex;
326  }
327 
329  viskores::Id LogicalToFlatPointIndex(const viskores::Id2& logicalPointIndex) const
330  {
331  return logicalPointIndex[0] + this->PointDimensions[0] * logicalPointIndex[1];
332  }
333 
335  viskores::Id2 FlatToLogicalCellIndex(viskores::Id flatCellIndex) const
336  {
337  viskores::Id2 cellDimensions = this->GetCellDimensions();
338  viskores::Id2 logicalCellIndex;
339  logicalCellIndex[0] = flatCellIndex % cellDimensions[0];
340  logicalCellIndex[1] = flatCellIndex / cellDimensions[0];
341  return logicalCellIndex;
342  }
343 
345  viskores::Id LogicalToFlatCellIndex(const viskores::Id2& logicalCellIndex) const
346  {
347  viskores::Id2 cellDimensions = this->GetCellDimensions();
348  return logicalCellIndex[0] + cellDimensions[0] * logicalCellIndex[1];
349  }
350 
352  void PrintSummary(std::ostream& out) const
353  {
354  out << " UniformConnectivity<2> ";
355  out << "PointDimensions[" << this->PointDimensions[0] << " " << this->PointDimensions[1]
356  << "] ";
357  out << "GlobalPointDimensions[" << this->GlobalPointDimensions[0] << " "
358  << this->GlobalPointDimensions[1] << "] ";
359  out << "GlobalPointIndexStart[" << this->GlobalPointIndexStart[0] << " "
360  << this->GlobalPointIndexStart[1] << "] ";
361  out << std::endl;
362  }
363 
364 private:
365  viskores::Id2 PointDimensions = { 0, 0 };
366  viskores::Id2 GlobalPointDimensions = { 0, 0 };
367  viskores::Id2 GlobalPointIndexStart = { 0, 0 };
368 };
369 
370 //3 D specialization.
371 template <>
372 class ConnectivityStructuredInternals<3>
373 {
374 public:
375  using SchedulingRangeType = viskores::Id3;
376 
378  void SetPointDimensions(viskores::Id3 dims)
379  {
380  this->PointDimensions = dims;
381  this->CellDimensions = dims - viskores::Id3(1);
382  this->CellDim01 = (dims[0] - 1) * (dims[1] - 1);
383  }
384 
386  void SetGlobalPointDimensions(viskores::Id3 dims)
387  {
388  this->GlobalPointDimensions = dims;
389  this->GlobalCellDimensions = dims - viskores::Id3(1);
390  }
391 
393  void SetGlobalPointIndexStart(viskores::Id3 start) { this->GlobalPointIndexStart = start; }
394 
396  const viskores::Id3& GetPointDimensions() const { return this->PointDimensions; }
397 
399  const viskores::Id3& GetGlobalPointDimensions() const { return this->GlobalPointDimensions; }
400 
402  const viskores::Id3& GetCellDimensions() const { return this->CellDimensions; }
403 
405  const viskores::Id3& GetGlobalCellDimensions() const { return this->GlobalCellDimensions; }
406 
408  viskores::Id GetNumberOfPoints() const { return viskores::ReduceProduct(this->PointDimensions); }
409 
410  //returns an id3 to signal what kind of scheduling to use
412  const viskores::Id3& GetSchedulingRange(viskores::TopologyElementTagCell) const
413  {
414  return this->GetCellDimensions();
415  }
417  const viskores::Id3& GetSchedulingRange(viskores::TopologyElementTagPoint) const
418  {
419  return this->GetPointDimensions();
420  }
421 
423  const viskores::Id3& GetGlobalPointIndexStart() const { return this->GlobalPointIndexStart; }
424 
425  static constexpr viskores::IdComponent NUM_POINTS_IN_CELL = 8;
426  static constexpr viskores::IdComponent MAX_CELL_TO_POINT = 8;
427 
429  viskores::Id GetNumberOfCells() const
430  {
431  return viskores::ReduceProduct(this->GetCellDimensions());
432  }
434  viskores::IdComponent GetNumberOfPointsInCell() const { return NUM_POINTS_IN_CELL; }
436  viskores::IdComponent GetCellShape() const { return viskores::CELL_SHAPE_HEXAHEDRON; }
437 
438  using CellShapeTag = viskores::CellShapeTagHexahedron;
439 
442  const SchedulingRangeType& ijk) const
443  {
445  pointIds[0] = (ijk[2] * this->PointDimensions[1] + ijk[1]) * this->PointDimensions[0] + ijk[0];
446  pointIds[1] = pointIds[0] + 1;
447  pointIds[2] = pointIds[1] + this->PointDimensions[0];
448  pointIds[3] = pointIds[2] - 1;
449  pointIds[4] = pointIds[0] + this->PointDimensions[0] * this->PointDimensions[1];
450  pointIds[5] = pointIds[4] + 1;
451  pointIds[6] = pointIds[5] + this->PointDimensions[0];
452  pointIds[7] = pointIds[6] - 1;
453 
454  return pointIds;
455  }
456 
458  viskores::Vec<viskores::Id, NUM_POINTS_IN_CELL> GetPointsOfCell(viskores::Id cellIndex) const
459  {
460  return this->GetPointsOfCell(this->FlatToLogicalCellIndex(cellIndex));
461  }
462 
463  VISKORES_EXEC_CONT viskores::IdComponent GetNumberOfCellsOnPoint(
464  const SchedulingRangeType& ijk) const
465  {
466  viskores::IdComponent numCells = 1;
467 
468  for (viskores::IdComponent dim = 0; dim < 3; dim++)
469  {
470  if ((ijk[dim] > 0) && (ijk[dim] < this->PointDimensions[dim] - 1))
471  {
472  numCells *= 2;
473  }
474  }
475 
476  return numCells;
477  }
478 
480  viskores::IdComponent GetNumberOfCellsOnPoint(viskores::Id pointIndex) const
481  {
482  return this->GetNumberOfCellsOnPoint(this->FlatToLogicalPointIndex(pointIndex));
483  }
484 
487  const SchedulingRangeType& ijk) const
488  {
490 
491  if ((ijk[0] > 0) && (ijk[1] > 0) && (ijk[2] > 0))
492  {
493  cellIds.Append(this->LogicalToFlatCellIndex(ijk - viskores::Id3(1, 1, 1)));
494  }
495  if ((ijk[0] < this->PointDimensions[0] - 1) && (ijk[1] > 0) && (ijk[2] > 0))
496  {
497  cellIds.Append(this->LogicalToFlatCellIndex(ijk - viskores::Id3(0, 1, 1)));
498  }
499  if ((ijk[0] > 0) && (ijk[1] < this->PointDimensions[1] - 1) && (ijk[2] > 0))
500  {
501  cellIds.Append(this->LogicalToFlatCellIndex(ijk - viskores::Id3(1, 0, 1)));
502  }
503  if ((ijk[0] < this->PointDimensions[0] - 1) && (ijk[1] < this->PointDimensions[1] - 1) &&
504  (ijk[2] > 0))
505  {
506  cellIds.Append(this->LogicalToFlatCellIndex(ijk - viskores::Id3(0, 0, 1)));
507  }
508 
509  if ((ijk[0] > 0) && (ijk[1] > 0) && (ijk[2] < this->PointDimensions[2] - 1))
510  {
511  cellIds.Append(this->LogicalToFlatCellIndex(ijk - viskores::Id3(1, 1, 0)));
512  }
513  if ((ijk[0] < this->PointDimensions[0] - 1) && (ijk[1] > 0) &&
514  (ijk[2] < this->PointDimensions[2] - 1))
515  {
516  cellIds.Append(this->LogicalToFlatCellIndex(ijk - viskores::Id3(0, 1, 0)));
517  }
518  if ((ijk[0] > 0) && (ijk[1] < this->PointDimensions[1] - 1) &&
519  (ijk[2] < this->PointDimensions[2] - 1))
520  {
521  cellIds.Append(this->LogicalToFlatCellIndex(ijk - viskores::Id3(1, 0, 0)));
522  }
523  if ((ijk[0] < this->PointDimensions[0] - 1) && (ijk[1] < this->PointDimensions[1] - 1) &&
524  (ijk[2] < this->PointDimensions[2] - 1))
525  {
526  cellIds.Append(this->LogicalToFlatCellIndex(ijk));
527  }
528 
529  return cellIds;
530  }
531 
534  viskores::Id pointIndex) const
535  {
536  return this->GetCellsOfPoint(this->FlatToLogicalPointIndex(pointIndex));
537  }
538 
540  void PrintSummary(std::ostream& out) const
541  {
542  out << " UniformConnectivity<3> ";
543  out << "PointDimensions[" << this->PointDimensions[0] << " " << this->PointDimensions[1] << " "
544  << this->PointDimensions[2] << "] ";
545  out << "GlobalPointDimensions[" << this->GlobalPointDimensions[0] << " "
546  << this->GlobalPointDimensions[1] << " " << this->GlobalPointDimensions[2] << "] ";
547  out << "GlobalPointIndexStart[" << this->GlobalPointIndexStart[0] << " "
548  << this->GlobalPointIndexStart[1] << " " << this->GlobalPointIndexStart[2] << "] ";
549  out << std::endl;
550  }
551 
553  viskores::Id3 FlatToLogicalPointIndex(viskores::Id flatPointIndex) const
554  {
555  const viskores::Id pointDims01 = this->PointDimensions[0] * this->PointDimensions[1];
556  const viskores::Id indexij = flatPointIndex % pointDims01;
557 
558  return viskores::Id3(indexij % this->PointDimensions[0],
559  indexij / this->PointDimensions[0],
560  flatPointIndex / pointDims01);
561  }
562 
564  viskores::Id LogicalToFlatPointIndex(const viskores::Id3& logicalPointIndex) const
565  {
566  return logicalPointIndex[0] +
567  this->PointDimensions[0] *
568  (logicalPointIndex[1] + this->PointDimensions[1] * logicalPointIndex[2]);
569  }
570 
572  viskores::Id3 FlatToLogicalCellIndex(viskores::Id flatCellIndex) const
573  {
574  const viskores::Id indexij = flatCellIndex % this->CellDim01;
575  return viskores::Id3(indexij % this->CellDimensions[0],
576  indexij / this->CellDimensions[0],
577  flatCellIndex / this->CellDim01);
578  }
579 
581  viskores::Id LogicalToFlatCellIndex(const viskores::Id3& logicalCellIndex) const
582  {
583  return logicalCellIndex[0] +
584  this->CellDimensions[0] *
585  (logicalCellIndex[1] + this->CellDimensions[1] * logicalCellIndex[2]);
586  }
587 
588 private:
589  viskores::Id3 PointDimensions = { 0, 0, 0 };
590  viskores::Id3 GlobalPointDimensions = { 0, 0, 0 };
591  viskores::Id3 GlobalCellDimensions = { 0, 0, 0 };
592  viskores::Id3 GlobalPointIndexStart = { 0, 0, 0 };
593  viskores::Id3 CellDimensions = { 0, 0, 0 };
594  viskores::Id CellDim01 = 0;
595 };
596 
597 // We may want to generalize this class depending on how ConnectivityExplicit
598 // eventually handles retrieving cell to point connectivity.
599 
600 template <typename VisitTopology, typename IncidentTopology, viskores::IdComponent Dimension>
601 struct ConnectivityStructuredIndexHelper
602 {
603  // We want an unconditional failure if this unspecialized class ever gets
604  // instantiated, because it means someone missed a topology mapping type.
605  // We need to create a test which depends on the templated types so
606  // it doesn't get picked up without a concrete instantiation.
607  VISKORES_STATIC_ASSERT_MSG(sizeof(VisitTopology) == static_cast<size_t>(-1),
608  "Missing Specialization for Topologies");
609 };
610 
611 template <viskores::IdComponent Dimension>
612 struct ConnectivityStructuredIndexHelper<viskores::TopologyElementTagCell,
614  Dimension>
615 {
616  using ConnectivityType = viskores::internal::ConnectivityStructuredInternals<Dimension>;
617  using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
618 
619  using CellShapeTag = typename ConnectivityType::CellShapeTag;
620 
622 
623  VISKORES_EXEC_CONT static viskores::Id GetNumberOfElements(const ConnectivityType& connectivity)
624  {
625  return connectivity.GetNumberOfCells();
626  }
627 
628  template <typename IndexType>
629  VISKORES_EXEC_CONT static viskores::IdComponent GetNumberOfIndices(
630  const ConnectivityType& viskoresNotUsed(connectivity),
631  const IndexType& viskoresNotUsed(cellIndex))
632  {
633  return ConnectivityType::NUM_POINTS_IN_CELL;
634  }
635 
636  template <typename IndexType>
637  VISKORES_EXEC_CONT static IndicesType GetIndices(const ConnectivityType& connectivity,
638  const IndexType& cellIndex)
639  {
640  return connectivity.GetPointsOfCell(cellIndex);
641  }
642 
644  static LogicalIndexType FlatToLogicalIncidentIndex(const ConnectivityType& connectivity,
645  viskores::Id flatFromIndex)
646  {
647  return connectivity.FlatToLogicalPointIndex(flatFromIndex);
648  }
649 
651  static viskores::Id LogicalToFlatIncidentIndex(const ConnectivityType& connectivity,
652  const LogicalIndexType& logicalFromIndex)
653  {
654  return connectivity.LogicalToFlatPointIndex(logicalFromIndex);
655  }
656 
658  static LogicalIndexType FlatToLogicalVisitIndex(const ConnectivityType& connectivity,
659  viskores::Id flatToIndex)
660  {
661  return connectivity.FlatToLogicalCellIndex(flatToIndex);
662  }
663 
665  static viskores::Id LogicalToFlatVisitIndex(const ConnectivityType& connectivity,
666  const LogicalIndexType& logicalToIndex)
667  {
668  return connectivity.LogicalToFlatCellIndex(logicalToIndex);
669  }
670 };
671 
672 template <viskores::IdComponent Dimension>
673 struct ConnectivityStructuredIndexHelper<viskores::TopologyElementTagPoint,
675  Dimension>
676 {
677  using ConnectivityType = viskores::internal::ConnectivityStructuredInternals<Dimension>;
678  using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
679 
680  using CellShapeTag = viskores::CellShapeTagVertex;
681 
683 
684  VISKORES_EXEC_CONT static viskores::Id GetNumberOfElements(const ConnectivityType& connectivity)
685  {
686  return connectivity.GetNumberOfPoints();
687  }
688 
689  template <typename IndexType>
690  VISKORES_EXEC_CONT static viskores::IdComponent GetNumberOfIndices(
691  const ConnectivityType& connectivity,
692  const IndexType& pointIndex)
693  {
694  return connectivity.GetNumberOfCellsOnPoint(pointIndex);
695  }
696 
697  template <typename IndexType>
698  VISKORES_EXEC_CONT static IndicesType GetIndices(const ConnectivityType& connectivity,
699  const IndexType& pointIndex)
700  {
701  return connectivity.GetCellsOfPoint(pointIndex);
702  }
703 
705  static LogicalIndexType FlatToLogicalIncidentIndex(const ConnectivityType& connectivity,
706  viskores::Id flatFromIndex)
707  {
708  return connectivity.FlatToLogicalCellIndex(flatFromIndex);
709  }
710 
712  static viskores::Id LogicalToFlatIncidentIndex(const ConnectivityType& connectivity,
713  const LogicalIndexType& logicalFromIndex)
714  {
715  return connectivity.LogicalToFlatCellIndex(logicalFromIndex);
716  }
717 
719  static LogicalIndexType FlatToLogicalVisitIndex(const ConnectivityType& connectivity,
720  viskores::Id flatToIndex)
721  {
722  return connectivity.FlatToLogicalPointIndex(flatToIndex);
723  }
724 
726  static viskores::Id LogicalToFlatVisitIndex(const ConnectivityType& connectivity,
727  const LogicalIndexType& logicalToIndex)
728  {
729  return connectivity.LogicalToFlatPointIndex(logicalToIndex);
730  }
731 };
732 }
733 } // namespace viskores::internal
734 
735 #endif //viskores_internal_ConnectivityStructuredInternals_h
viskores::Id2
viskores::Vec< viskores::Id, 2 > Id2
Id2 corresponds to a 2-dimensional index.
Definition: Types.h:935
viskores::TopologyElementTagCell
A tag used to identify the cell elements in a topology.
Definition: TopologyElementTag.h:32
Types.h
viskores::CellShapeTagLine
Definition: CellShape.h:158
viskores::VecVariable
A short variable-length array with maximum length.
Definition: VecVariable.h:38
viskores::CellShapeTagHexahedron
Definition: CellShape.h:167
viskores::filter::mesh_info::CellMetric::Dimension
@ Dimension
Compute for each cell a metric specifically designed for Sandia's Pronto code.
viskoresNotUsed
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
VISKORES_ASSUME
#define VISKORES_ASSUME(cond)
Definition: Assume.h:35
viskores::CELL_SHAPE_HEXAHEDRON
@ CELL_SHAPE_HEXAHEDRON
A hexahedron.
Definition: CellShape.h:70
CellShape.h
VISKORES_EXEC_CONT
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
viskores::VecVariable::Append
void Append(ComponentType value)
Definition: VecVariable.h:88
viskores::TopologyElementTagPoint
A tag used to identify the point elements in a topology.
Definition: TopologyElementTag.h:42
Assume.h
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::CellShapeTagVertex
Definition: CellShape.h:156
viskores::ReduceProduct
T ReduceProduct(const viskores::Vec< T, Size > &a)
Definition: Types.h:1610
viskores::CellShapeTagQuad
Definition: CellShape.h:164
viskores::Id3
viskores::Vec< viskores::Id, 3 > Id3
Id3 corresponds to a 3-dimensional index for 3d arrays.
Definition: Types.h:1053
VISKORES_STATIC_ASSERT_MSG
#define VISKORES_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:26
VecVariable.h
StaticAssert.h
viskores::CELL_SHAPE_QUAD
@ CELL_SHAPE_QUAD
A four-sided polygon.
Definition: CellShape.h:64
viskores::Vec
A short fixed-length array.
Definition: Types.h:365
viskores::CELL_SHAPE_LINE
@ CELL_SHAPE_LINE
A line cell connecting two points.
Definition: CellShape.h:50
TopologyElementTag.h