vtk-m2/vtkm/testing
Kenneth Moreland d1a4aecc59 Improvements to moving data into ArrayHandle
We have made several improvements to adding data into an `ArrayHandle`.

## Moving data from an `std::vector`

For numerous reasons, it is convenient to define data in a `std::vector`
and then wrap that into an `ArrayHandle`. It is often the case that an
`std::vector` is filled and then becomes unused once it is converted to an
`ArrayHandle`. In this case, what we really want is to pass the data off to
the `ArrayHandle` so that the `ArrayHandle` is now managing the data and
not the `std::vector`.

C++11 has a mechanism to do this: move semantics. You can now pass
variables to functions as an "rvalue" (right-hand value). When something is
passed as an rvalue, it can pull state out of that variable and move it
somewhere else. `std::vector` implements this movement so that an rvalue
can be moved to another `std::vector` without actually copying the data.
`make_ArrayHandle` now also takes advantage of this feature to move rvalue
`std::vector`s.

There is a special form of `make_ArrayHandle` named `make_ArrayHandleMove`
that takes an rvalue. There is also a special overload of
`make_ArrayHandle` itself that handles an rvalue `vector`. (However, using
the explicit move version is better if you want to make sure the data is
actually moved.)

## Make `ArrayHandle` from initalizer list

A common use case for using `std::vector` (particularly in our unit tests)
is to quickly add an initalizer list into an `ArrayHandle`. Now you can
by simply passing an initializer list to `make_ArrayHandle`.

## Deprecated `make_ArrayHandle` with default shallow copy

For historical reasons, passing an `std::vector` or a pointer to
`make_ArrayHandle` does a shallow copy (i.e. `CopyFlag` defaults to `Off`).
Although more efficient, this mode is inherintly unsafe, and making it the
default is asking for trouble.

To combat this, calling `make_ArrayHandle` without a copy flag is
deprecated. In this way, if you wish to do the faster but more unsafe
creation of an `ArrayHandle` you should explicitly express that.

This requried quite a few changes through the VTK-m source (particularly in
the tests).

## Similar changes to `Field`

`vtkm::cont::Field` has a `make_Field` helper function that is similar to
`make_ArrayHandle`. It also features the ability to create fields from
`std::vector`s and C arrays. It also likewise had the same unsafe behavior
by default of not copying from the source of the arrays.

That behavior has similarly been depreciated. You now have to specify a
copy flag.

The ability to construct a `Field` from an initializer list of values has
also been added.
2020-07-23 10:53:38 -06:00
..
CMakeLists.txt Fix warnings 2020-07-09 08:10:54 -05:00
Testing.h Make tests that throw an STL exception fail 2020-06-23 16:25:09 -06:00
TestingAlgorithms.h Improvements to moving data into ArrayHandle 2020-07-23 10:53:38 -06:00
TestingGeometry.h Update lists in TypeListTag.h 2019-12-05 11:05:19 -07:00
TestingMath.h Unfoobar the float_distance MR. 2020-06-24 10:52:59 -04:00
UnitTestAlgorithms.cxx Add vtkm/Algorithms.h header with device-friendly binary search algorithms. 2019-12-20 12:35:10 -05:00
UnitTestBinaryOperators.cxx Make BinaryOperators/Predicates more flexible. 2019-12-18 15:51:59 -05:00
UnitTestBinaryPredicates.cxx added missing MinAndMax BinaryOperator tests, updated formatting 2019-04-30 09:43:17 -06:00
UnitTestBounds.cxx Update VTK-m code to use new Vec aliases 2019-07-31 12:55:40 -06:00
UnitTestCellShape.cxx conslidate the license statement 2019-04-17 10:57:13 -06:00
UnitTestDeprecated.cxx Refactor deprecated macros 2019-11-06 14:47:59 -07:00
UnitTestExceptions.cxx RuntimeDeviceTracker can't be copied and is only accessible via reference. 2019-05-20 11:43:05 -04:00
UnitTestHash.cxx Update VTK-m code to use new Vec aliases 2019-07-31 12:55:40 -06:00
UnitTestList.cxx More testing of long lists 2020-01-09 10:33:49 -07:00
UnitTestListTag.cxx Implement old ListTag features with new ListTag implementations 2019-12-08 19:20:34 -07:00
UnitTestMath.cxx For VTK-m libs all includes of DeviceAdapterTagCuda happen from cuda files 2019-04-22 10:39:54 -04:00
UnitTestMatrix.cxx Update lists in TypeListTag.h 2019-12-05 11:05:19 -07:00
UnitTestNewtonsMethod.cxx conslidate the license statement 2019-04-17 10:57:13 -06:00
UnitTestNoAssert.cxx conslidate the license statement 2019-04-17 10:57:13 -06:00
UnitTestPair.cxx Update lists in TypeListTag.h 2019-12-05 11:05:19 -07:00
UnitTestRange.cxx conslidate the license statement 2019-04-17 10:57:13 -06:00
UnitTestTesting.cxx conslidate the license statement 2019-04-17 10:57:13 -06:00
UnitTestTransform3D.cxx Update lists in TypeListTag.h 2019-12-05 11:05:19 -07:00
UnitTestTuple.cxx Add vtkmstd::integer_sequence 2020-03-16 17:12:16 -06:00
UnitTestTypeList.cxx Remove instances of ListTag in favor of List 2019-12-06 21:32:36 -07:00
UnitTestTypeListTag.cxx Remove instances of ListTag in favor of List 2019-12-06 21:32:36 -07:00
UnitTestTypes.cxx Deprecate ListTag operations 2019-12-05 11:27:31 -05:00
UnitTestTypeTraits.cxx conslidate the license statement 2019-04-17 10:57:13 -06:00
UnitTestUnaryPredicates.cxx added missing MinAndMax BinaryOperator tests, updated formatting 2019-04-30 09:43:17 -06:00
UnitTestVecAxisAlignedPointCoordinates.cxx Update VTK-m code to use new Vec aliases 2019-07-31 12:55:40 -06:00
UnitTestVecFromPortal.cxx Update lists in TypeListTag.h 2019-12-05 11:05:19 -07:00
UnitTestVecFromPortalPermute.cxx Update lists in TypeListTag.h 2019-12-05 11:05:19 -07:00
UnitTestVectorAnalysis.cxx Update lists in TypeListTag.h 2019-12-05 11:05:19 -07:00
UnitTestVecTraits.cxx Update VTK-m code to use new Vec aliases 2019-07-31 12:55:40 -06:00
UnitTestVecVariable.cxx Update lists in TypeListTag.h 2019-12-05 11:05:19 -07:00
VecTraitsTests.h Add recursive component queries to VecTraits 2019-09-09 08:19:15 -06:00