Go to the documentation of this file.
10 #ifndef vtk_m_cont_UnknownCellSet_h
11 #define vtk_m_cont_UnknownCellSet_h
15 #include <vtkm/cont/DefaultTypes.h>
17 #include <vtkm/cont/vtkm_cont_export.h>
27 template <
typename CellSetList>
28 class UncertainCellSet;
58 template <
typename CellSetType>
63 this->Container = std::shared_ptr<vtkm::cont::CellSet>(
new CellSetType(cellSet));
69 template <
typename CellSetType>
72 this->InitializeKnownOrUnknownCellSet(
73 cellSet,
typename std::is_base_of<UnknownCellSet, CellSetType>::type{});
101 VTKM_CONT std::string GetCellSetName()
const;
105 template <
typename CellSetType>
108 return (
dynamic_cast<const CellSetType*
>(this->Container.get()) !=
nullptr);
113 return this->Container ? this->Container->GetNumberOfCells() : 0;
117 return this->Container ? this->Container->GetNumberOfFaces() : 0;
121 return this->Container ? this->Container->GetNumberOfEdges() : 0;
125 return this->Container ? this->Container->GetNumberOfPoints() : 0;
130 return this->GetCellSetBase()->GetCellShape(
id);
134 return this->GetCellSetBase()->GetNumberOfPointsInCell(
id);
138 return this->GetCellSetBase()->GetCellPointIds(
id, ptids);
143 VTKM_CONT void PrintSummary(std::ostream& os)
const;
149 this->Container->ReleaseResourcesExecution();
160 template <
typename CellSetType>
166 return this->IsType<CellSetType>();
177 template <
typename CellSetType>
181 CellSetType* cellSetPointer =
dynamic_cast<CellSetType*
>(this->Container.get());
182 if (cellSetPointer ==
nullptr)
188 cellSet = *cellSetPointer;
191 template <
typename CellSetType>
195 this->AsCellSet(cellSet);
208 template <
typename CellSetList>
210 template <
typename CellSetList>
222 template <
typename CellSetList,
typename Functor,
typename... Args>
223 VTKM_CONT void CastAndCallForTypes(Functor&& functor, Args&&... args)
const;
232 template <
typename CellSetType>
235 return unknownCellSet.
IsType<CellSetType>();
242 template <
typename CellSetType>
245 return unknownCellSet.
AsCellSet<CellSetType>();
252 const std::type_info&);
257 using DynamicTag = vtkm::cont::internal::DynamicTransformTagCastAndCall;
262 template <
typename CellSetList,
typename Functor,
typename... Args>
269 if (!called && this->
CanConvert<decltype(cellSet)>())
280 functor(cellSet, args...);
288 internal::ThrowCastAndCallException(*
this,
typeid(CellSetList));
294 template <
typename Functor,
typename... Args>
298 std::forward<Args>(args)...);
307 template <
typename T>
308 using UnknownCellSetCheck =
typename std::is_base_of<vtkm::cont::UnknownCellSet, T>::type;
310 #define VTKM_IS_UNKNOWN_CELL_SET(T) \
311 VTKM_STATIC_ASSERT(::vtkm::cont::internal::UnknownCellSetCheck<T>::value)
313 #define VTKM_IS_KNOWN_OR_UNKNOWN_CELL_SET(T) \
314 VTKM_STATIC_ASSERT(::vtkm::cont::internal::CellSetCheck<T>::type::value || \
315 ::vtkm::cont::internal::UnknownCellSetCheck<T>::value)
332 struct VTKM_CONT_EXPORT SerializableTypeString<
vtkm::cont::UnknownCellSet>
343 struct VTKM_CONT_EXPORT Serialization<
vtkm::cont::UnknownCellSet>
359 #endif //vtk_m_cont_UnknownCellSet_h
VTKM_CONT vtkm::Id GetNumberOfEdges() const
Definition: UnknownCellSet.h:119
VTKM_CONT void DeepCopyFrom(const CellSet *src)
Definition: UnknownCellSet.h:141
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_CONT vtkm::UInt8 GetCellShape(vtkm::Id id) const
Definition: UnknownCellSet.h:128
VTKM_CONT bool CanConvert() const
Returns true if this cell set can be retrieved as the given type.
Definition: UnknownCellSet.h:161
#define VTKM_LOG_CAST_FAIL(inObj, outType)
Convenience macro for logging a failed cast of dynamic object.
Definition: Logging.h:269
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
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
VTKM_CONT vtkm::cont::CellSet * GetCellSetBase()
Returns a pointer to the CellSet base class.
Definition: UnknownCellSet.h:85
A CellSet of an uncertain type.
Definition: UncertainCellSet.h:38
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC_CONT void ListForEach(Functor &&f, vtkm::List< Ts... >, Args &&... args)
Definition: List.h:720
A CellSet of an unknown type.
Definition: UnknownCellSet.h:48
void CastAndCall(const DynamicObject &dynamicObject, Functor &&f, Args &&... args)
A Generic interface to CastAndCall.
Definition: CastAndCall.h:47
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
VTKM_SILENCE_WEAK_VTABLE_WARNING_END VTKM_CONT_EXPORT void throwFailedDynamicCast(const std::string &baseType, const std::string &derivedType)
Throws an ErrorBadType exception with the following message: Cast failed: baseType --> derivedType".
VTKM_CONT ArrayHandleType Cast(const vtkm::cont::UnknownArrayHandle &array)
Returns variant cast to the given ArrayHandle type.
Definition: UnknownArrayHandle.h:1099
VTKM_CONT void AsCellSet(CellSetType &cellSet) const
Get the cell set as a known type.
Definition: UnknownCellSet.h:178
#define VTKM_LOG_CAST_SUCC(inObj, outObj)
Convenience macro for logging the successful cast of dynamic object.
Definition: Logging.h:268
void InitializeKnownOrUnknownCellSet(const UnknownCellSet &cellSet, std::true_type vtkmNotUsed(isUnknownCellSet))
Definition: UnknownCellSet.h:52
#define VTKM_CONT
Definition: ExportMacros.h:57
std::shared_ptr< vtkm::cont::CellSet > Container
Definition: UnknownCellSet.h:50
uint8_t UInt8
Definition: Types.h:157
VTKM_CONT vtkm::Id GetNumberOfFaces() const
Definition: UnknownCellSet.h:115
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
VTKM_CONT void CastAndCallForTypes(Functor &&functor, Args &&... args) const
Call a functor using the underlying cell set type.
Definition: UnknownCellSet.h:263
const VTKM_CONT vtkm::cont::CellSet * GetCellSetBase() const
Definition: UnknownCellSet.h:86
#define VTKM_IS_LIST(type)
Checks that the argument is a proper list.
Definition: List.h:64
VTKM_CONT vtkm::IdComponent GetNumberOfPointsInCell(vtkm::Id id) const
Definition: UnknownCellSet.h:132
VTKM_CONT bool IsType(const vtkm::cont::UnknownArrayHandle &array)
Returns true if variant matches the type of ArrayHandleType.
Definition: UnknownArrayHandle.h:1089
VTKM_CONT UnknownCellSet(const CellSetType &cellSet)
Definition: UnknownCellSet.h:70
VTKM_CONT bool IsValid() const
Returns whether a cell set is stored in this UnknownCellSet.
Definition: UnknownCellSet.h:81
VTKM_CONT vtkm::Id GetNumberOfPoints() const
Definition: UnknownCellSet.h:123
void InitializeKnownOrUnknownCellSet(const CellSetType &cellSet, std::false_type vtkmNotUsed(isUnknownCellSet))
Definition: UnknownCellSet.h:59
VTKM_CONT bool IsType() const
Returns true if this cell set matches the CellSetType template argument.
Definition: UnknownCellSet.h:106
VTKM_CONT_EXPORT VTKM_CONT std::string TypeToString(const std::type_info &t)
Use RTTI information to retrieve the name of the type T.
VTKM_CONT CellSetType AsCellSet() const
Get the cell set as a known type.
Definition: UnknownCellSet.h:192
VTKM_CONT vtkm::Id GetNumberOfCells() const
Definition: UnknownCellSet.h:111
#define VTKM_IS_CELL_SET(T)
Definition: CellSet.h:71
VTKM_CONT void GetCellPointIds(vtkm::Id id, vtkm::Id *ptids) const
Definition: UnknownCellSet.h:136
VTKM_CONT void ReleaseResourcesExecution()
Definition: UnknownCellSet.h:145