VTK-m
2.2
|
A CellSet of an unknown type. More...
#include <UnknownCellSet.h>
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::CellSet * | GetCellSetBase () |
Returns a pointer to the CellSet base class. More... | |
const vtkm::cont::CellSet * | GetCellSetBase () 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::CellSet > | Container |
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
|
default |
|
inline |
|
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.
|
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.
|
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.
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.
|
inline |
|
inline |
Returns a pointer to the CellSet
base class.
|
inline |
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.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
Returns true if this cell set matches the CellSetType
template argument.
|
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.
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.
void vtkm::cont::UnknownCellSet::PrintSummary | ( | std::ostream & | os | ) | const |
|
inline |
vtkm::cont::UncertainCellSet<NewCellSetList> vtkm::cont::UnknownCellSet::ResetCellSetList | ( | ) | const |
vtkm::cont::UncertainCellSet<CellSetList> vtkm::cont::UnknownCellSet::ResetCellSetList | ( | ) | const |
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.
vtkm::cont::UncertainCellSet<NewCellSetList> vtkm::cont::UnknownCellSet::ResetCellSetList | ( | NewCellSetList | ) | const |
|
private |