VTK-m
2.0
|
Treat a Vec
or Vec
-like object as a flat Vec
.
More...
#include <VecFlat.h>
Treat a Vec
or Vec
-like object as a flat Vec
.
The VecFlat
template wraps around another object that is a nested Vec
object (that is, a vector of vectors) and treats it like a flat, 1 dimensional Vec
. For example, let's say that you have a Vec
of size 3 holding Vec
s of size 2.
flatVec
is now of type vtkm::VecFlat<vtkm::Vec<vtkm::Vec<T, 2>, 3>.
flatVec::NUM_COMPONENTS<tt>is 6 (3 * 2). The[]operator takes an index between 0 and 5 and returns a value of type
vtkm::Id<tt>. The indices are explored in depth-first order. SoflatVec[0] == nestedVec[0][0],
flatVec[1] == nestedVec[0][1],
flatVec[2] == nestedVec[1][0]`, and so on.
Note that flatVec
only works with types that have VecTraits
defined where the IsSizeStatic
field is vtkm::VecTraitsTagSizeStatic
(that is, the NUM_COMPONENTS
constant is defined).