VTK-m  2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
vtkm::cont::UnknownCellSet Class Reference

A CellSet of an unknown type. More...

#include <UnknownCellSet.h>

Inheritance diagram for vtkm::cont::UnknownCellSet:
vtkm::cont::UncertainCellSet< CellSetList >

Public Member Functions

VTKM_CONT UnknownCellSet ()=default
 
template<typename CellSetType >
VTKM_CONT UnknownCellSet (const CellSetType &cellSet)
 
VTKM_CONT bool IsValid () const
 Returns whether a cell set is stored in this UnknownCellSet. More...
 
VTKM_CONT vtkm::cont::CellSetGetCellSetBase ()
 Returns a pointer to the CellSet base class. More...
 
const VTKM_CONT vtkm::cont::CellSetGetCellSetBase () const
 
VTKM_CONT UnknownCellSet NewInstance () const
 Create a new cell set of the same type as this cell set. More...
 
VTKM_CONT std::string GetCellSetName () const
 Returns the name of the cell set type stored in this class. More...
 
template<typename CellSetType >
VTKM_CONT bool IsType () const
 Returns true if this cell set matches the CellSetType template argument. More...
 
VTKM_CONT vtkm::Id GetNumberOfCells () const
 
VTKM_CONT vtkm::Id GetNumberOfFaces () const
 
VTKM_CONT vtkm::Id GetNumberOfEdges () const
 
VTKM_CONT vtkm::Id GetNumberOfPoints () const
 
VTKM_CONT vtkm::UInt8 GetCellShape (vtkm::Id id) const
 
VTKM_CONT vtkm::IdComponent GetNumberOfPointsInCell (vtkm::Id id) const
 
VTKM_CONT void GetCellPointIds (vtkm::Id id, vtkm::Id *ptids) const
 
VTKM_CONT void DeepCopyFrom (const CellSet *src)
 
VTKM_CONT void PrintSummary (std::ostream &os) const
 
VTKM_CONT void ReleaseResourcesExecution ()
 
template<typename CellSetType >
VTKM_CONT bool CanConvert () const
 Returns true if this cell set can be retrieved as the given type. More...
 
template<typename CellSetList >
VTKM_CONT vtkm::cont::UncertainCellSet< CellSetList > ResetCellSetList (CellSetList) const
 Assigns potential cell set types. More...
 
template<typename CellSetList >
VTKM_CONT vtkm::cont::UncertainCellSet< CellSetList > ResetCellSetList () const
 
template<typename CellSetList , typename Functor , typename... Args>
VTKM_CONT void CastAndCallForTypes (Functor &&functor, Args &&... args) const
 Call a functor using the underlying cell set type. More...
 
template<typename NewCellSetList >
VTKM_CONT vtkm::cont::UncertainCellSet< NewCellSetList > ResetCellSetList (NewCellSetList) const
 
template<typename NewCellSetList >
VTKM_CONT vtkm::cont::UncertainCellSet< NewCellSetList > ResetCellSetList () const
 
template<typename CellSetType >
VTKM_CONT void AsCellSet (CellSetType &cellSet) const
 Get the cell set as a known type. More...
 
template<typename CellSetType >
VTKM_CONT CellSetType AsCellSet () const
 Get the cell set as a known type. More...
 

Private Member Functions

void InitializeKnownOrUnknownCellSet (const UnknownCellSet &cellSet, std::true_type vtkmNotUsed(isUnknownCellSet))
 
template<typename CellSetType >
void InitializeKnownOrUnknownCellSet (const CellSetType &cellSet, std::false_type vtkmNotUsed(isUnknownCellSet))
 

Private Attributes

std::shared_ptr< vtkm::cont::CellSetContainer
 

Detailed Description

A CellSet of an unknown type.

UnknownCellSet holds a CellSet object using runtime polymorphism to manage the dynamic type rather than compile-time templates. This adds a programming convenience that helps avoid a proliferation of templates.

To interface between the runtime polymorphism and the templated algorithms in VTK-m, UnknownCellSet contains a method named CastAndCallForTypes that determines the correct type from some known list of types. This mechanism is used internally by VTK-m's worklet invocation mechanism to determine the type when running algorithms.

If the UnknownCellSet is used in a context where the possible cell set types can be whittled down to a finite list, you can specify lists of cell set types using the ResetCellSetList method. This will convert this object to an UncertainCellSet of the given types. In cases where a finite set of types are needed but there is no subset, VTKM_DEFAULT_CELL_SET_LIST

Constructor & Destructor Documentation

◆ UnknownCellSet() [1/2]

VTKM_CONT vtkm::cont::UnknownCellSet::UnknownCellSet ( )
default

◆ UnknownCellSet() [2/2]

template<typename CellSetType >
VTKM_CONT vtkm::cont::UnknownCellSet::UnknownCellSet ( const CellSetType &  cellSet)
inline

Member Function Documentation

◆ AsCellSet() [1/2]

template<typename CellSetType >
VTKM_CONT CellSetType vtkm::cont::UnknownCellSet::AsCellSet ( ) const
inline

Get the cell set as a known type.

Returns this cell set cast appropriately and stored in the given CellSet type. Throws an ErrorBadType if the stored cell set cannot be stored in the given cell set type. Use the CanConvert method to determine if the cell set can be returned with the given type.

◆ AsCellSet() [2/2]

template<typename CellSetType >
VTKM_CONT void vtkm::cont::UnknownCellSet::AsCellSet ( CellSetType &  cellSet) const
inline

Get the cell set as a known type.

Returns this cell set cast appropriately and stored in the given CellSet type. Throws an ErrorBadType if the stored cell set cannot be stored in the given cell set type. Use the CanConvert method to determine if the cell set can be returned with the given type.

◆ CanConvert()

template<typename CellSetType >
VTKM_CONT bool vtkm::cont::UnknownCellSet::CanConvert ( ) const
inline

Returns true if this cell set can be retrieved as the given type.

This method will return true if calling AsCellSet of the given type will succeed. This result is similar to IsType, and if IsType returns true, then this will return true. However, this method will also return true for other types where automatic conversions are made.

◆ CastAndCallForTypes()

template<typename CellSetList , typename Functor , typename... Args>
VTKM_CONT void vtkm::cont::UnknownCellSet::CastAndCallForTypes ( Functor &&  functor,
Args &&...  args 
) const

Call a functor using the underlying cell set type.

CastAndCallForTypes attemts to cast the held cell set to a specific type and then calls the given functor with the cast cell set. You must specify the CellSetList (in a vtkm::List) as a template argument.

After the functor argument, you may add any number of arguments that will be passed to the functor after the converted cell set.

◆ DeepCopyFrom()

VTKM_CONT void vtkm::cont::UnknownCellSet::DeepCopyFrom ( const CellSet src)
inline

◆ GetCellPointIds()

VTKM_CONT void vtkm::cont::UnknownCellSet::GetCellPointIds ( vtkm::Id  id,
vtkm::Id ptids 
) const
inline

◆ GetCellSetBase() [1/2]

VTKM_CONT vtkm::cont::CellSet* vtkm::cont::UnknownCellSet::GetCellSetBase ( )
inline

Returns a pointer to the CellSet base class.

◆ GetCellSetBase() [2/2]

const VTKM_CONT vtkm::cont::CellSet* vtkm::cont::UnknownCellSet::GetCellSetBase ( ) const
inline

◆ GetCellSetName()

VTKM_CONT std::string vtkm::cont::UnknownCellSet::GetCellSetName ( ) const

Returns the name of the cell set type stored in this class.

Returns an empty string if no cell set is stored.

◆ GetCellShape()

VTKM_CONT vtkm::UInt8 vtkm::cont::UnknownCellSet::GetCellShape ( vtkm::Id  id) const
inline

◆ GetNumberOfCells()

VTKM_CONT vtkm::Id vtkm::cont::UnknownCellSet::GetNumberOfCells ( ) const
inline

◆ GetNumberOfEdges()

VTKM_CONT vtkm::Id vtkm::cont::UnknownCellSet::GetNumberOfEdges ( ) const
inline

◆ GetNumberOfFaces()

VTKM_CONT vtkm::Id vtkm::cont::UnknownCellSet::GetNumberOfFaces ( ) const
inline

◆ GetNumberOfPoints()

VTKM_CONT vtkm::Id vtkm::cont::UnknownCellSet::GetNumberOfPoints ( ) const
inline

◆ GetNumberOfPointsInCell()

VTKM_CONT vtkm::IdComponent vtkm::cont::UnknownCellSet::GetNumberOfPointsInCell ( vtkm::Id  id) const
inline

◆ InitializeKnownOrUnknownCellSet() [1/2]

template<typename CellSetType >
void vtkm::cont::UnknownCellSet::InitializeKnownOrUnknownCellSet ( const CellSetType &  cellSet,
std::false_type   vtkmNotUsedisUnknownCellSet 
)
inlineprivate

◆ InitializeKnownOrUnknownCellSet() [2/2]

void vtkm::cont::UnknownCellSet::InitializeKnownOrUnknownCellSet ( const UnknownCellSet cellSet,
std::true_type   vtkmNotUsedisUnknownCellSet 
)
inlineprivate

◆ IsType()

template<typename CellSetType >
VTKM_CONT bool vtkm::cont::UnknownCellSet::IsType ( ) const
inline

Returns true if this cell set matches the CellSetType template argument.

◆ IsValid()

VTKM_CONT bool vtkm::cont::UnknownCellSet::IsValid ( ) const
inline

Returns whether a cell set is stored in this UnknownCellSet.

If the UnknownCellSet is constructed without a CellSet, it will not have an underlying type, and therefore the operations will be invalid.

◆ NewInstance()

VTKM_CONT UnknownCellSet vtkm::cont::UnknownCellSet::NewInstance ( ) const

Create a new cell set of the same type as this cell set.

This method creates a new cell set that is the same type as this one and returns a new UnknownCellSet for it. This method is convenient when creating output cell sets that should be the same type as the input cell set.

◆ PrintSummary()

VTKM_CONT void vtkm::cont::UnknownCellSet::PrintSummary ( std::ostream &  os) const

◆ ReleaseResourcesExecution()

VTKM_CONT void vtkm::cont::UnknownCellSet::ReleaseResourcesExecution ( )
inline

◆ ResetCellSetList() [1/4]

template<typename NewCellSetList >
VTKM_CONT vtkm::cont::UncertainCellSet<NewCellSetList> vtkm::cont::UnknownCellSet::ResetCellSetList ( ) const

◆ ResetCellSetList() [2/4]

template<typename CellSetList >
VTKM_CONT vtkm::cont::UncertainCellSet<CellSetList> vtkm::cont::UnknownCellSet::ResetCellSetList ( ) const

◆ ResetCellSetList() [3/4]

template<typename CellSetList >
VTKM_CONT vtkm::cont::UncertainCellSet<CellSetList> vtkm::cont::UnknownCellSet::ResetCellSetList ( CellSetList  ) const

Assigns potential cell set types.

Calling this method will return an UncertainCellSet with the provided cell set list. The returned object will hold the same CellSet, but CastAndCall's on the returned object will be constrained to the given types.

◆ ResetCellSetList() [4/4]

template<typename NewCellSetList >
VTKM_CONT vtkm::cont::UncertainCellSet<NewCellSetList> vtkm::cont::UnknownCellSet::ResetCellSetList ( NewCellSetList  ) const

Member Data Documentation

◆ Container

std::shared_ptr<vtkm::cont::CellSet> vtkm::cont::UnknownCellSet::Container
private

The documentation for this class was generated from the following files: