17 #ifndef vtkToDax_vtkPointsContainer_h
18 #define vtkToDax_vtkPointsContainer_h
24 #include <dax/Types.h>
25 #include <dax/VectorTraits.h>
26 #include <dax/cont/ArrayPortal.h>
27 #include <dax/cont/internal/IteratorFromArrayPortal.h>
33 #include <boost/type_traits/remove_const.hpp>
34 #include <boost/type_traits/is_const.hpp>
35 #include <boost/type_traits/is_base_of.hpp>
36 #include <boost/mpl/if.hpp>
43 template<
typename T,
typename Tuple>
44 void operator()(T* t,
const Tuple& tuple)
const
46 fillComponents<N-1>()(t,tuple);
47 t[N-1]=dax::VectorTraits<Tuple>::GetComponent(tuple,N-1);
52 struct fillComponents<1>
54 template<
typename T,
typename Tuple>
55 void operator()(T* t,
const Tuple& tuple)
const
57 t[0]=dax::VectorTraits<Tuple>::GetComponent(tuple,0);
64 template<
typename T,
typename Tuple>
65 void operator()(
const T* t, Tuple& tuple)
const
67 readComponents<N-1>()(t,tuple);
68 dax::VectorTraits<Tuple>::SetComponent(tuple,N-1,t[N-1]);
73 struct readComponents<1>
75 template<
typename T,
typename Tuple>
76 void operator()(
const T* t, Tuple& tuple)
const
78 dax::VectorTraits<Tuple>::SetComponent(tuple,0,t[0]);
82 template<
typename ValueType,
int N>
86 ValueType operator()(
const T* rawArray)
89 readComponents<N>()(rawArray,temp);
94 template<
typename ValueType>
95 struct readVector<ValueType,1>
98 ValueType operator()(
const T* rawArray)
100 return ValueType(*rawArray);
106 struct ConstCorrectedType
109 static const int NUM_COMPONENTS = dax::VectorTraits<T>::NUM_COMPONENTS;
110 typedef typename dax::VectorTraits<T>::ComponentType ComponentType;
125 template <
typename DaxValueType,
typename VTKComponentType>
128 static const int NUM_COMPONENTS =
129 dax::VectorTraits<DaxValueType>::NUM_COMPONENTS;
131 typedef typename ConstCorrectedType<DaxValueType>::Type
ValueType;
132 typedef typename ConstCorrectedType<DaxValueType>::ComponentType
ComponentType;
143 Array(static_cast<VTKComponentType*>(array->GetVoidPointer(0))),
154 template<
typename OtherDaxType,
typename OtherVTKType>
172 VTKComponentType *rawArray = this->Array + (index * NUM_COMPONENTS);
173 return readVector<ValueType,NUM_COMPONENTS>()(rawArray);
179 VTKComponentType *rawArray = this->Array + (index * NUM_COMPONENTS);
181 fillComponents<NUM_COMPONENTS>()(rawArray,value);
184 typedef dax::cont::internal::IteratorFromArrayPortal<vtkArrayPortal>
201 VTKComponentType *Array;
207 template <
typename Type,
208 int NUM_COMPONENTS = dax::VectorTraits<Type>::NUM_COMPONENTS>
212 typedef typename ConstCorrectedType<Type>::Type
ValueType;
224 Array(static_cast<ComponentType*>(points->GetVoidPointer(0))),
234 template<
typename OtherType>
238 Array(static_cast<ComponentType*>(src.
GetVtkData()->GetVoidPointer(0))),
252 return ValueType(this->Array+(index*NUM_COMPONENTS));
258 ComponentType *rawArray = this->Array + (index * NUM_COMPONENTS);
260 fillComponents<NUM_COMPONENTS>()(rawArray,value);
263 typedef dax::cont::internal::IteratorFromArrayPortal<vtkPointsPortal>
279 ComponentType *Array;
292 template<
typename T,
int Po
intsPerCell>
308 RawCells(cells->GetPointer()),
313 daxTopoLen + (daxTopoLen/PointsPerCell));
320 template<
typename OtherType>
337 return this->RawCells[1 + index + (index/PointsPerCell) ];
342 this->RawCells[1 + index + index/PointsPerCell]=
value;
345 typedef dax::cont::internal::IteratorFromArrayPortal<vtkTopologyPortal>
370 #endif // vtkToDax_vtkPointsContainer_h
DAX_CONT_EXPORT vtkPointsPortal()
DAX_CONT_EXPORT IteratorType GetIteratorBegin() const
DAX_CONT_EXPORT void Set(dax::Id index, const ValueType &value) const
DAX_CONT_EXPORT void Set(dax::Id index, const ValueType &value) const
DAX_CONT_EXPORT vtkTopologyPortal(vtkCellArray *cells, dax::Id daxTopoLen)
vtkPoints * GetVtkData() const
DAX_CONT_EXPORT vtkTopologyPortal()
DAX_CONT_EXPORT vtkPointsPortal(vtkPoints *points, dax::Id size)
DAX_CONT_EXPORT dax::Id GetNumberOfValues() const
DAX_CONT_EXPORT ValueType Get(dax::Id index) const
DAX_CONT_EXPORT IteratorType GetIteratorEnd() const
DAX_CONT_EXPORT IteratorType GetIteratorBegin() const
DAX_CONT_EXPORT IteratorType GetIteratorBegin() const
ConstCorrectedType< Type >::ComponentType ComponentType
DAX_CONT_EXPORT void Set(dax::Id index, const ValueType &value) const
vtkIdType GetNumberOfConnectivityEntries()
Get the total number of entries (i.e., data values) in the connectivity array.
DAX_CONT_EXPORT IteratorType GetIteratorEnd() const
abstract superclass for arrays of numeric data
DAX_CONT_EXPORT vtkArrayPortal(const vtkArrayPortal< OtherDaxType, OtherVTKType > &src)
Copy constructor for any other vtkArrayPortal with an iterator type that can be copied to this iterat...
dax::cont::internal::IteratorFromArrayPortal< vtkPointsPortal > IteratorType
DAX_CONT_EXPORT dax::Id GetNumberOfValues() const
DAX_CONT_EXPORT vtkTopologyPortal(const vtkTopologyPortal< OtherType, PointsPerCell > &src)
Copy constructor for any other vtkArrayPortal with an iterator type that can be copied to this iterat...
dax::cont::internal::IteratorFromArrayPortal< vtkArrayPortal > IteratorType
DAX_CONT_EXPORT dax::Id GetNumberOfValues() const
DAX_CONT_EXPORT vtkPointsPortal(const vtkPointsPortal< OtherType > &src)
Copy constructor for any other vtkArrayPortal with an iterator type that can be copied to this iterat...
object to represent cell connectivity
ConstCorrectedType< Type >::Type ValueType
DAX_CONT_EXPORT vtkArrayPortal()
DAX_CONT_EXPORT vtkDataArray * GetVtkData() const
dax::cont::internal::IteratorFromArrayPortal< vtkTopologyPortal > IteratorType
vtkCellArray * GetVtkData() const
DAX_CONT_EXPORT vtkArrayPortal(vtkDataArray *array, dax::Id size)
ConstCorrectedType< DaxValueType >::ComponentType ComponentType
DAX_CONT_EXPORT IteratorType GetIteratorEnd() const
ConstCorrectedType< DaxValueType >::Type ValueType
represent and manipulate 3D points
DAX_CONT_EXPORT ValueType Get(dax::Id index) const
DAX_CONT_EXPORT ValueType Get(dax::Id index) const