Go to the documentation of this file.
   10 #ifndef vtk_m_cont_ArrayGetValues_h 
   11 #define vtk_m_cont_ArrayGetValues_h 
   13 #include <vtkm/cont/vtkm_cont_export.h> 
   18 #include <initializer_list> 
   27 class UnknownArrayHandle;
 
   35                                          std::false_type extractComponentInefficient);
 
   37 template <
typename IdsArrayHandle, 
typename DataArrayHandle, 
typename OutputArrayHandle>
 
   38 void ArrayGetValuesImpl(
const IdsArrayHandle& ids,
 
   39                         const DataArrayHandle& data,
 
   40                         const OutputArrayHandle& output,
 
   41                         std::true_type 
vtkmNotUsed(extractComponentInefficient))
 
   48   vtkm::Id outputSize = ids.GetNumberOfValues();
 
   49   output.Allocate(outputSize);
 
   50   auto idsPortal = ids.ReadPortal();
 
   51   auto dataPortal = data.ReadPortal();
 
   52   auto outputPortal = output.WritePortal();
 
   53   for (
vtkm::Id index = 0; index < outputSize; ++index)
 
   55     outputPortal.Set(index, dataPortal.Get(idsPortal.Get(index)));
 
  118 template <
typename SIds, 
typename T, 
typename SData, 
typename SOut>
 
  125     "ArrayGetValues can only be used with arrays containing value types with VecTraits defined.");
 
  127   using InefficientExtract =
 
  128     vtkm::cont::internal::ArrayExtractComponentIsInefficient<DataArrayHandle>;
 
  129   internal::ArrayGetValuesImpl(ids, data, output, InefficientExtract{});
 
  134 template <
typename SIds, 
typename TIn, 
typename SData, 
typename TOut, 
typename SOut>
 
  150   for (
vtkm::Id i = 0; i < numExtracted; ++i)
 
  152     outp.Set(i, 
static_cast<TOut
>(inp.Get(i)));
 
  156 template <
typename SIds, 
typename T, 
typename SData, 
typename Alloc>
 
  159                               std::vector<T, Alloc>& output)
 
  164   output.resize(numVals);
 
  169   result.SyncControlArray();
 
  172 template <
typename SIds, 
typename T, 
typename SData>
 
  176   std::vector<T> result;
 
  181 template <
typename T, 
typename Alloc, 
typename SData, 
typename SOut>
 
  190 template <
typename T, 
typename AllocId, 
typename SData, 
typename AllocOut>
 
  193                               std::vector<T, AllocOut>& output)
 
  199 template <
typename T, 
typename Alloc, 
typename SData>
 
  207 template <
typename T, 
typename SData, 
typename SOut>
 
  217 template <
typename T, 
typename SData, 
typename Alloc>
 
  220                               std::vector<T, Alloc>& output)
 
  226 template <
typename T, 
typename SData>
 
  235 template <
typename T, 
typename SData, 
typename SOut>
 
  245 template <
typename T, 
typename SData, 
typename Alloc>
 
  249                               std::vector<T, Alloc>& output)
 
  254 template <
typename T, 
typename SData>
 
  263 template <
typename T, 
typename S>
 
  271 template <
typename T, 
typename S>
 
  280 #endif //vtk_m_cont_ArrayGetValues_h 
  
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
 
VTKM_CONT vtkm::cont::ArrayHandleBasic< T > make_ArrayHandle(const T *array, vtkm::Id numberOfValues, vtkm::CopyFlag copy)
A convenience function for creating an ArrayHandle from a standard C array.
Definition: ArrayHandleBasic.h:217
 
Manages an array-worth of data.
Definition: ArrayHandle.h:283
 
Groups connected points that have the same field value.
Definition: Atomic.h:19
 
VTKM_CONT void Allocate(vtkm::Id numberOfValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:465
 
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:406
 
typename detail::HasVecTraitsImpl< T >::Type HasVecTraits
Determines whether the given type has VecTraits defined.
Definition: VecTraits.h:176
 
VTKM_CONT void ArrayGetValues(const vtkm::cont::ArrayHandle< vtkm::Id, SIds > &ids, const vtkm::cont::ArrayHandle< T, SData > &data, vtkm::cont::ArrayHandle< T, SOut > &output)
Obtain a small set of values from an ArrayHandle with minimal device transfers.
Definition: ArrayGetValues.h:119
 
VTKM_CONT T ArrayGetValue(vtkm::Id id, const vtkm::cont::ArrayHandle< T, S > &data)
Obtain a small set of values from an ArrayHandle with minimal device transfers.
Definition: ArrayGetValues.h:264
 
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
 
Definition: ArrayHandleCast.h:28
 
ArrayHandleType GetSourceArray() const
Returns the ArrayHandle that is being transformed.
Definition: ArrayHandleCast.h:169
 
#define VTKM_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:18
 
#define VTKM_CONT
Definition: ExportMacros.h:57
 
VTKM_CONT WritePortalType WritePortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:435
 
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
 
Cast the values of an array to the specified type, on demand.
Definition: ArrayHandleCast.h:141
 
VTKM_CONT ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:414
 
Definition: ArrayHandleBasic.h:97