VTK-m
2.0
|
A CellSet of an unknown type. More...
#include <UnknownCellSet.h>
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::CellSet * | GetCellSetBase () |
Returns a pointer to the CellSet base class. More... | |
const VTKM_CONT vtkm::cont::CellSet * | GetCellSetBase () 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::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.
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.
|
inline |
|
inline |
Returns a pointer to the CellSet
base class.
|
inline |
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.
|
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.
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.
VTKM_CONT void vtkm::cont::UnknownCellSet::PrintSummary | ( | std::ostream & | os | ) | const |
|
inline |
VTKM_CONT vtkm::cont::UncertainCellSet<NewCellSetList> vtkm::cont::UnknownCellSet::ResetCellSetList | ( | ) | const |
VTKM_CONT vtkm::cont::UncertainCellSet<CellSetList> vtkm::cont::UnknownCellSet::ResetCellSetList | ( | ) | const |
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.
VTKM_CONT vtkm::cont::UncertainCellSet<NewCellSetList> vtkm::cont::UnknownCellSet::ResetCellSetList | ( | NewCellSetList | ) | const |
|
private |