Go to the documentation of this file.
   10 #ifndef vtk_m_cont_CellSetSingleType_h 
   11 #define vtk_m_cont_CellSetSingleType_h 
   30 template <
typename ConnectivityStorageTag = VTKM_DEFAULT_CONNECTIVITY_STORAGE_TAG>
 
   33       typename vtkm::cont::ArrayHandleConstant<vtkm::UInt8>::StorageTag, 
 
   34       ConnectivityStorageTag,
 
   35       typename vtkm::cont::ArrayHandleCounting<vtkm::Id>::StorageTag 
 
   41                                 ConnectivityStorageTag,
 
   48     , ExpectedNumberOfCellsAdded(-1)
 
   49     , CellShapeAsId(CellShapeTagEmpty::
Id)
 
   50     , NumberOfPointsPerCell(0)
 
   57     , ExpectedNumberOfCellsAdded(-1)
 
   58     , CellShapeAsId(src.CellShapeAsId)
 
   59     , NumberOfPointsPerCell(src.NumberOfPointsPerCell)
 
   66     , ExpectedNumberOfCellsAdded(-1)
 
   67     , CellShapeAsId(src.CellShapeAsId)
 
   68     , NumberOfPointsPerCell(src.NumberOfPointsPerCell)
 
   76     this->Superclass::operator=(src);
 
   85     this->Superclass::operator=(std::forward<Superclass>(src));
 
   86     this->CellShapeAsId = src.CellShapeAsId;
 
   87     this->NumberOfPointsPerCell = src.NumberOfPointsPerCell;
 
   99     this->Data->CellPointIds.Connectivity.Allocate(connectivityMaxLen);
 
  101     this->Data->NumberOfCellsAdded = 0;
 
  102     this->Data->ConnectivityAdded = 0;
 
  103     this->ExpectedNumberOfCellsAdded = numCells;
 
  107   template <
typename IdVecType>
 
  112                            "CellSetSingleType::AddCell requires vtkm::Id for indices.");
 
  114     if (Traits::GetNumberOfComponents(ids) < numVertices)
 
  119     if (this->Data->ConnectivityAdded + numVertices >
 
  120         this->Data->CellPointIds.Connectivity.GetNumberOfValues())
 
  123         "Connectivity increased past estimated maximum connectivity.");
 
  132       this->CellShapeAsId = shapeId;
 
  133       this->CheckNumberOfPointsPerCell(numVertices);
 
  134       this->NumberOfPointsPerCell = numVertices;
 
  138       if (shapeId != this->GetCellShape(0))
 
  142       if (numVertices != this->NumberOfPointsPerCell)
 
  145           "Inconsistent number of points in cells for CellSetSingleType.");
 
  148     auto conn = this->Data->CellPointIds.Connectivity.WritePortal();
 
  151       conn.Set(this->Data->ConnectivityAdded + iVert, Traits::GetComponent(ids, iVert));
 
  153     this->Data->NumberOfCellsAdded++;
 
  154     this->Data->ConnectivityAdded += numVertices;
 
  161     this->Data->NumberOfPoints = numPoints;
 
  162     this->Data->CellPointIds.Connectivity.Allocate(this->Data->ConnectivityAdded,
 
  165     vtkm::Id numCells = this->Data->NumberOfCellsAdded;
 
  167     this->Data->CellPointIds.Shapes =
 
  172     this->Data->CellPointIds.ElementsValid = 
true;
 
  174     if (this->ExpectedNumberOfCellsAdded != this->GetNumberOfCells())
 
  179     this->Data->NumberOfCellsAdded = -1;
 
  180     this->Data->ConnectivityAdded = -1;
 
  181     this->ExpectedNumberOfCellsAdded = -1;
 
  191     this->Data->NumberOfPoints = numPoints;
 
  192     this->CellShapeAsId = shapeId;
 
  193     this->CheckNumberOfPointsPerCell(numberOfPointsPerCell);
 
  203     this->Data->CellPointIds.Connectivity = connectivity;
 
  205     this->Data->CellPointIds.ElementsValid = 
true;
 
  217     return static_cast<vtkm::UInt8>(this->CellShapeAsId);
 
  224     return std::make_shared<CellSetSingleType>();
 
  236     this->Superclass::DeepCopy(other);
 
  237     this->CellShapeAsId = other->CellShapeAsId;
 
  238     this->NumberOfPointsPerCell = other->NumberOfPointsPerCell;
 
  243     out << 
"   CellSetSingleType: Type=" << this->CellShapeAsId << std::endl;
 
  244     out << 
"   CellPointIds:" << std::endl;
 
  245     this->Data->CellPointIds.PrintSummary(out);
 
  246     out << 
"   PointCellIds:" << std::endl;
 
  247     this->Data->PointCellIds.PrintSummary(out);
 
  251   template <
typename CellShapeTag>
 
  262   template <
typename CellShapeTag>
 
  274     switch (this->CellShapeAsId)
 
  298 template <
typename ConnectivityST>
 
  299 struct SerializableTypeString<
vtkm::cont::CellSetSingleType<ConnectivityST>>
 
  303     static std::string name = 
"CS_Single<" +
 
  304       SerializableTypeString<vtkm::cont::ArrayHandle<vtkm::Id, ConnectivityST>>
::Get() + 
"_ST>";
 
  315 template <
typename ConnectivityST>
 
  316 struct Serialization<
vtkm::cont::CellSetSingleType<ConnectivityST>>
 
  322   static VTKM_CONT void save(BinaryBuffer& bb, 
const Type& cs)
 
  324     vtkmdiy::save(bb, cs.GetNumberOfPoints());
 
  325     vtkmdiy::save(bb, cs.GetCellShape(0));
 
  326     vtkmdiy::save(bb, cs.GetNumberOfPointsInCell(0));
 
  343     cs.Fill(numberOfPoints, shape, count, connectivity);
 
  350 #endif //vtk_m_cont_CellSetSingleType_h 
  
A tag used to identify the point elements in a topology.
Definition: TopologyElementTag.h:34
 
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
 
Manages an array-worth of data.
Definition: ArrayHandle.h:283
 
VTKM_CONT CellSetSingleType(const Thisclass &src)
Definition: CellSetSingleType.h:55
 
VTKM_CONT void DeepCopy(const CellSet *src) override
Definition: CellSetSingleType.h:228
 
Groups connected points that have the same field value.
Definition: Atomic.h:19
 
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
 
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC_CONT auto Get(const vtkm::Tuple< Ts... > &tuple) -> decltype(tuple.template Get< Index >())
Retrieve the object from a vtkm::Tuple at the given index.
Definition: Tuple.h:83
 
void CheckNumberOfPointsPerCell(CellShapeTag, vtkm::CellTraitsTagSizeVariable, vtkm::IdComponent vtkmNotUsed(numVertices)) const
Definition: CellSetSingleType.h:263
 
VTKM_CONT vtkm::cont::ArrayHandleCounting< CountingValueType > make_ArrayHandleCounting(CountingValueType start, CountingValueType step, vtkm::Id length)
A convenience function for creating an ArrayHandleCounting.
Definition: ArrayHandleCounting.h:151
 
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
 
vtkm::Id CellShapeAsId
Definition: CellSetSingleType.h:284
 
VTKM_DEPRECATED_SUPPRESS_END VTKM_CONT std::shared_ptr< CellSet > NewInstance() const override
Definition: CellSetSingleType.h:222
 
Definition: CastAndCall.h:34
 
vtkm::cont::ArrayHandleConstant< T > make_ArrayHandleConstant(T value, vtkm::Id numberOfValues)
make_ArrayHandleConstant is convenience function to generate an ArrayHandleImplicit.
Definition: ArrayHandleConstant.h:89
 
@ CELL_SHAPE_EMPTY
Definition: CellShape.h:36
 
This class is thrown when VTK-m encounters data of a type that is incompatible with the current opera...
Definition: ErrorBadType.h:25
 
Definition: Particle.h:331
 
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
 
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC T load(const U &u, vtkm::Id v)
Definition: FetchTagArrayDirectIn.h:36
 
#define VTKM_DEPRECATED_SUPPRESS_END
Definition: Deprecated.h:123
 
VTKM_DEPRECATED_SUPPRESS_BEGIN VTKM_CONT vtkm::UInt8 GetCellShape(vtkm::Id vtkmNotUsed(cellIndex)) const override
Definition: CellSetSingleType.h:215
 
#define vtkmGenericCellShapeMacro(call)
A macro used in a switch statement to determine cell shape.
Definition: CellShape.h:230
 
Definition: ArrayHandleCounting.h:23
 
vtkm::Id ExpectedNumberOfCellsAdded
Definition: CellSetSingleType.h:283
 
VTKM_CONT void PrepareToAddCells(vtkm::Id numCells, vtkm::Id connectivityMaxLen)
First method to add cells – one at a time.
Definition: CellSetSingleType.h:95
 
void CheckNumberOfPointsPerCell(CellShapeTag, vtkm::CellTraitsTagSizeFixed, vtkm::IdComponent numVertices) const
Definition: CellSetSingleType.h:252
 
#define VTKM_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:18
 
vtkm::IdComponent NumberOfPointsPerCell
Definition: CellSetSingleType.h:285
 
#define VTKM_CONT
Definition: ExportMacros.h:57
 
VTKM_CONT Thisclass & operator=(const Thisclass &src)
Definition: CellSetSingleType.h:74
 
uint8_t UInt8
Definition: Types.h:157
 
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
 
#define VTKM_DEPRECATED_SUPPRESS_BEGIN
Definition: Deprecated.h:122
 
void CheckNumberOfPointsPerCell(vtkm::IdComponent numVertices) const
Definition: CellSetSingleType.h:272
 
VTKM_CONT CellSetSingleType()
Definition: CellSetSingleType.h:46
 
This class is thrown when a VTKm function or method encounters an invalid value that inhibits progres...
Definition: ErrorBadValue.h:25
 
Definition: CastAndCall.h:36
 
VTKM_CONT CellSetSingleType(Thisclass &&src) noexcept
Definition: CellSetSingleType.h:64
 
VTKM_CONT void CompleteAddingCells(vtkm::Id numPoints)
Third and final method to add cells – one at a time.
Definition: CellSetSingleType.h:159
 
VTKM_CONT void AddCell(vtkm::UInt8 shapeId, vtkm::IdComponent numVertices, const IdVecType &ids)
Second method to add cells – one at a time.
Definition: CellSetSingleType.h:108
 
A tag used to identify the cell elements in a topology.
Definition: TopologyElementTag.h:24
 
The VecTraits class gives several static members that define how to use a given type as a vector.
Definition: VecTraits.h:66
 
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:92
 
virtual ~CellSetSingleType() override
Definition: CellSetSingleType.h:91
 
VTKM_CONT void Fill(vtkm::Id numPoints, vtkm::UInt8 shapeId, vtkm::IdComponent numberOfPointsPerCell, const vtkm::cont::ArrayHandle< vtkm::Id, ConnectivityStorageTag > &connectivity)
Definition: CellSetSingleType.h:186
 
VTKM_CONT vtkm::Id GetCellShapeAsId() const
Definition: CellSetSingleType.h:211
 
VTKM_CONT Thisclass & operator=(Thisclass &&src) noexcept
Definition: CellSetSingleType.h:83
 
virtual void PrintSummary(std::ostream &out) const override
Definition: CellSetSingleType.h:241
 
Information about a cell based on its tag.
Definition: CellTraits.h:46