Go to the documentation of this file.
19 #ifndef viskores_cont_ArraySetValues_h
20 #define viskores_cont_ArraySetValues_h
27 #include <initializer_list>
41 std::false_type extractComponentInefficient);
43 template <
typename IdsArrayHandle,
typename ValuesArrayHandle,
typename DataArrayHandle>
44 void ArraySetValuesImpl(
const IdsArrayHandle& ids,
45 const ValuesArrayHandle& values,
46 const DataArrayHandle& data,
53 auto idsPortal = ids.ReadPortal();
54 auto valuesPortal = values.ReadPortal();
55 auto dataPortal = data.WritePortal();
59 dataPortal.Set(idsPortal.Get(index), valuesPortal.Get(index));
120 template <
typename SIds,
typename T,
typename SValues,
typename SData>
126 using InefficientExtract =
127 viskores::cont::internal::ArrayExtractComponentIsInefficient<DataArrayHandle>;
128 internal::ArraySetValuesImpl(ids, values, data, InefficientExtract{});
132 template <
typename SIds,
typename TIn,
typename SValues,
typename TOut,
typename SData>
144 outp.Set(i,
static_cast<TIn
>(inp.Get(i)));
151 template <
typename SIds,
typename T,
typename SData,
typename Alloc>
153 const std::vector<T, Alloc>& values,
160 template <
typename T,
typename SIds,
typename SValues,
typename SData>
169 template <
typename T,
typename AllocId,
typename AllocVal,
typename SData>
171 const std::vector<T, AllocVal>& values,
179 template <
typename T,
typename SData,
typename Alloc>
181 const std::vector<T, Alloc>& values,
190 template <
typename T,
typename SData>
192 const std::initializer_list<T>& values,
202 template <
typename T,
typename SValues,
typename SData>
212 template <
typename T,
typename SData>
215 const std::vector<T>& values,
220 const auto valuesAH =
225 template <
typename T,
typename SData>
234 const auto valuesAH =
239 template <
typename T,
typename SData>
255 template <
typename T,
typename SData>
270 #endif //viskores_cont_ArraySetValues_h
ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:447
Definition: ArrayHandleCast.h:36
void ArraySetValues(const viskores::cont::ArrayHandle< viskores::Id, SIds > &ids, const viskores::cont::ArrayHandle< T, SValues > &values, const viskores::cont::ArrayHandle< T, SData > &data)
Set a small set of values in an ArrayHandle with minimal device transfers.
Definition: ArraySetValues.h:121
Cast the values of an array to the specified type, on demand.
Definition: ArrayHandleCast.h:151
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
Manages an array-worth of data.
Definition: ArrayHandle.h:313
ArrayHandleType GetSourceArray() const
Returns the ArrayHandle that is being transformed.
Definition: ArrayHandleCast.h:179
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
#define VISKORES_CONT
Definition: ExportMacros.h:65
Groups connected points that have the same field value.
Definition: Atomic.h:27
void Allocate(viskores::Id numberOfValues, viskores::CopyFlag preserve, viskores::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:504
Basic array storage for an array handle.
Definition: ArrayHandleBasic.h:120
viskores::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:482
#define VISKORES_ASSERT(condition)
Definition: Assert.h:51
WritePortalType WritePortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:468
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:451
viskores::cont::ArrayHandleBasic< T > make_ArrayHandle(const T *array, viskores::Id numberOfValues, viskores::CopyFlag copy)
A convenience function for creating an ArrayHandle from a standard C array.
Definition: ArrayHandleBasic.h:285
void ArraySetValue(viskores::Id id, const T &value, const viskores::cont::ArrayHandle< T, SData > &data)
Set a single value in an ArrayHandle at the specified index.
Definition: ArraySetValues.h:256