Go to the documentation of this file.
10 #ifndef vtk_m_cont_UnknownCellSet_h
11 #define vtk_m_cont_UnknownCellSet_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)
359 #endif //vtk_m_cont_UnknownCellSet_h
void CastAndCallForTypes(Functor &&functor, Args &&... args) const
Call a functor using the underlying cell set type.
Definition: UnknownCellSet.h:263
std::string TypeToString(const std::type_info &t)
Use RTTI information to retrieve the name of the type T.
bool CanConvert() const
Returns true if this cell set can be retrieved as the given type.
Definition: UnknownCellSet.h:161
T load(const U &u, vtkm::Id v)
Definition: FetchTagArrayDirectIn.h:36
Groups connected points that have the same field value.
Definition: Atomic.h:19
auto Get(const vtkm::Tuple< Ts... > &tuple)
Retrieve the object from a vtkm::Tuple at the given index.
Definition: Tuple.h:81
void InitializeKnownOrUnknownCellSet(const CellSetType &cellSet, std::false_type)
Definition: UnknownCellSet.h:59
#define VTKM_LOG_CAST_FAIL(inObj, outType)
Convenience macro for logging a failed cast of dynamic object.
Definition: Logging.h:230
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
bool IsType(const vtkm::cont::UnknownArrayHandle &array)
Returns true if variant matches the type of ArrayHandleType.
Definition: UnknownArrayHandle.h:1236
UnknownCellSet(const CellSetType &cellSet)
Definition: UnknownCellSet.h:70
A CellSet of an uncertain type.
Definition: UncertainCellSet.h:38
vtkm::Id GetNumberOfCells() const
Definition: UnknownCellSet.h:111
void GetCellPointIds(vtkm::Id id, vtkm::Id *ptids) const
Definition: UnknownCellSet.h:136
A CellSet of an unknown type.
Definition: UnknownCellSet.h:48
void AsCellSet(CellSetType &cellSet) const
Get the cell set as a known type.
Definition: UnknownCellSet.h:178
void CastAndCall(const DynamicObject &dynamicObject, Functor &&f, Args &&... args)
A Generic interface to CastAndCall.
Definition: CastAndCall.h:47
CellSetType AsCellSet() const
Get the cell set as a known type.
Definition: UnknownCellSet.h:192
Definition: Particle.h:351
void throwFailedDynamicCast(const std::string &baseType, const std::string &derivedType)
Throws an ErrorBadType exception with the following message: Cast failed: baseType --> derivedType".
vtkm::UInt8 GetCellShape(vtkm::Id id) const
Definition: UnknownCellSet.h:128
vtkm::IdComponent GetNumberOfPointsInCell(vtkm::Id id) const
Definition: UnknownCellSet.h:132
const vtkm::cont::CellSet * GetCellSetBase() const
Definition: UnknownCellSet.h:86
#define VTKM_DEFAULT_CELL_SET_LIST
Definition: DefaultTypes.h:77
vtkm::Id GetNumberOfPoints() const
Definition: UnknownCellSet.h:123
vtkm::Id GetNumberOfEdges() const
Definition: UnknownCellSet.h:119
#define VTKM_CONT_EXPORT
Definition: vtkm_cont_export.h:44
#define VTKM_LOG_CAST_SUCC(inObj, outObj)
Convenience macro for logging the successful cast of dynamic object.
Definition: Logging.h:221
void InitializeKnownOrUnknownCellSet(const UnknownCellSet &cellSet, std::true_type)
Definition: UnknownCellSet.h:52
bool IsValid() const
Returns whether a cell set is stored in this UnknownCellSet.
Definition: UnknownCellSet.h:81
vtkm::cont::CellSet * GetCellSetBase()
Returns a pointer to the CellSet base class.
Definition: UnknownCellSet.h:85
#define VTKM_CONT
Definition: ExportMacros.h:57
void DeepCopyFrom(const CellSet *src)
Definition: UnknownCellSet.h:141
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
Defines the topological structure of the data in a DataSet.
Definition: CellSet.h:28
std::shared_ptr< vtkm::cont::CellSet > Container
Definition: UnknownCellSet.h:50
bool IsType() const
Returns true if this cell set matches the CellSetType template argument.
Definition: UnknownCellSet.h:106
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:169
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
void ListForEach(Functor &&f, vtkm::List< Ts... >, Args &&... args)
For each typename represented by the list, call the functor with a default instance of that type.
Definition: List.h:725
ArrayHandleType Cast(const vtkm::cont::UnknownArrayHandle &array)
Returns variant cast to the given ArrayHandle type.
Definition: UnknownArrayHandle.h:1246
vtkm::Id GetNumberOfFaces() const
Definition: UnknownCellSet.h:115
#define VTKM_IS_LIST(type)
Checks that the argument is a proper list.
Definition: List.h:69
void ReleaseResourcesExecution()
Definition: UnknownCellSet.h:145
#define VTKM_IS_CELL_SET(T)
Definition: CellSet.h:89