Go to the documentation of this file.
10 #ifndef vtk_m_cont_ArrayCopy_h
11 #define vtk_m_cont_ArrayCopy_h
37 struct ArrayCopyConcreteSrc;
39 template <
typename SrcIsArrayHandle>
47 template <
typename SrcIsArrayHandle>
56 template <
typename T,
typename S>
70 vtkm::cont::detail::ArrayCopyImpl(source, destWrapper, std::false_type{}, std::false_type{});
72 destWrapper.AsArrayHandle(destination);
76 template <
typename TS,
typename SS,
typename TD,
typename SD>
82 detail::ArrayCopyConcreteSrc<SS>{}(source, destination);
86 template <
typename T,
typename S>
119 template <
typename SourceArrayType,
typename DestArrayType>
120 inline void ArrayCopy(
const SourceArrayType& source, DestArrayType& destination)
122 detail::ArrayCopyImpl(source,
124 typename internal::ArrayHandleCheck<SourceArrayType>::type{},
125 typename internal::ArrayHandleCheck<DestArrayType>::type{});
130 template <
typename SourceArrayType>
133 detail::ArrayCopyImpl(source,
135 typename internal::ArrayHandleCheck<SourceArrayType>::type{},
141 template <
typename T,
typename S>
158 template <
typename T,
typename S>
179 template <
typename S>
180 struct ArrayCopyConcreteSrc
182 template <
typename T,
typename DestArray>
187 source, destination, vtkm::cont::internal::ArrayExtractComponentIsInefficient<ArrayType>{});
190 template <
typename T,
typename DestArray>
192 DestArray& destination,
198 template <
typename T,
typename DestArray>
200 DestArray& destination,
204 "Attempting to copy from an array of type " +
206 " with ArrayCopy is inefficient. It is highly recommended you use another method "
207 "such as vtkm::cont::ArrayCopyDevice.");
216 struct ArrayCopyConcreteSrc<
vtkm::cont::StorageTagConstant>
218 template <
typename T1,
typename T2,
typename S2>
229 struct ArrayCopyConcreteSrc<
vtkm::cont::StorageTagIndex>
231 template <
typename T,
typename S>
245 template <
typename T1,
typename T2,
typename S2>
250 T1 start = countingSource.
GetStart();
251 T1 step = countingSource.
GetStep();
258 for (
vtkm::IdComponent comp = 0; comp < VTraits1::GetNumberOfComponents(start); ++comp)
260 this->CopyCountingFloat(
271 destination = this->CopyCountingId(source);
284 template <
typename ST1,
typename ST2>
285 struct ArrayCopyConcreteSrc<
vtkm::cont::StorageTagConcatenate<ST1, ST2>>
287 template <
typename SourceArrayType,
typename DestArrayType>
288 void operator()(
const SourceArrayType& source, DestArrayType& destination)
const
290 auto source1 = source.GetStorage().GetArray1(source.GetBuffers());
291 auto source2 = source.GetStorage().GetArray2(source.GetBuffers());
294 destination.Allocate(source.GetNumberOfValues());
297 destination, source1.GetNumberOfValues(), source2.GetNumberOfValues());
305 template <
typename SIndex,
typename SValue>
306 struct ArrayCopyConcreteSrc<
vtkm::cont::StorageTagPermutation<SIndex, SValue>>
309 template <
typename T1,
typename T2,
typename S2>
316 vtkm::cont::internal::MapArrayPermutation(valueArray, indexArray);
326 #endif //vtk_m_cont_ArrayCopy_h
bool CanConvert() const
Determine if the contained array can be passed to the given array type.
Definition: UnknownArrayHandle.h:997
std::string TypeToString(const std::type_info &t)
Use RTTI information to retrieve the name of the type T.
Manages an array-worth of data.
Definition: ArrayHandle.h:300
const std::vector< vtkm::cont::internal::Buffer > & GetBuffers() const
Returns the internal Buffer structures that hold the data.
Definition: ArrayHandle.h:721
Groups connected points that have the same field value.
Definition: Atomic.h:19
StorageType GetStorage() const
Get the storage.
Definition: ArrayHandle.h:421
ArrayHandleView< ArrayHandleType > make_ArrayHandleView(const ArrayHandleType &array, vtkm::Id startIndex, vtkm::Id numValues)
Construct a vtkm::cont::ArrayHandleView from a source array.
Definition: ArrayHandleView.h:240
@ Warn
Less important user errors, such as out-of-bounds parameters.
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
T GetValue() const
Returns the constant value stored in this array.
Definition: ArrayHandleConstant.h:89
CountingValueType GetStart() const
Definition: ArrayHandleCounting.h:145
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:430
vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:468
void ArrayCopyShallowIfPossible(const vtkm::cont::UnknownArrayHandle source, vtkm::cont::ArrayHandle< T, S > &destination)
Copies from an unknown to a known array type.
Definition: ArrayCopy.h:159
void AsArrayHandle(vtkm::cont::ArrayHandle< T, S > &array) const
Returns this array cast appropriately and stored in the given ArrayHandle type.
Definition: UnknownArrayHandle.h:657
Definition: ArrayHandlePermutation.h:93
void DeepCopyFrom(const vtkm::cont::UnknownArrayHandle &source)
Deep copies data from another UnknownArrayHandle.
ArrayHandleCounting is a specialization of ArrayHandle.
Definition: ArrayHandleCounting.h:130
#define VTKM_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:18
#define VTKM_CONT_EXPORT
Definition: vtkm_cont_export.h:44
void ArrayCopy(const SourceArrayType &source, DestArrayType &destination)
Does a deep copy from one array to another array.
Definition: ArrayCopy.h:120
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
An array handle with a constant value.
Definition: ArrayHandleConstant.h:70
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
CountingValueType GetStep() const
Definition: ArrayHandleCounting.h:147
void DeepCopyFrom(const vtkm::cont::ArrayHandle< ValueType, StorageTag > &source) const
Deep copies the data in the array.
Definition: ArrayHandle.h:707
#define VTKM_LOG_S(level,...)
Writes a message using stream syntax to the indicated log level.
Definition: Logging.h:208
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:236
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:490
Traits that can be queried to treat any type as a Vec.
Definition: VecTraits.h:61
vtkm::cont::ArrayHandleStride< BaseComponentType > ExtractComponent(vtkm::IdComponent componentIndex, vtkm::CopyFlag allowCopy=vtkm::CopyFlag::On) const
Extract a component of the array.
Definition: UnknownArrayHandle.h:787
void AllocateAndFill(vtkm::Id numberOfValues, const ValueType &fillValue, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
Allocates an array and fills it with an initial value.
Definition: ArrayHandle.h:519
An implicit array handle containing the its own indices.
Definition: ArrayHandleIndex.h:55