VTK-m  2.1
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

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

Private Member Functions

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

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::UnknownCellSet::UnknownCellSet ( )
default

◆ UnknownCellSet() [2/2]

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

Member Function Documentation

◆ AsCellSet() [1/2]

template<typename CellSetType >
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 >
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 >
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>
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()

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

◆ GetCellPointIds()

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

◆ GetCellSetBase() [1/2]

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

Returns a pointer to the CellSet base class.

◆ GetCellSetBase() [2/2]

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

◆ GetCellSetName()

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::UInt8 vtkm::cont::UnknownCellSet::GetCellShape ( vtkm::Id  id) const
inline

◆ GetNumberOfCells()

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

◆ GetNumberOfEdges()

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

◆ GetNumberOfFaces()

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

◆ GetNumberOfPoints()

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

◆ GetNumberOfPointsInCell()

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   
)
inlineprivate

◆ InitializeKnownOrUnknownCellSet() [2/2]

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

◆ IsType()

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

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

◆ IsValid()

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()

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()

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

◆ ReleaseResourcesExecution()

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

◆ ResetCellSetList() [1/4]

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

◆ ResetCellSetList() [2/4]

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

◆ ResetCellSetList() [3/4]

template<typename CellSetList >
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::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: