vtk-m/vtkm/exec/arg
Kenneth Moreland eda6dc39f2 Support using arrays with dynamic Vec-likes as output arrays
When you use an `ArrayHandle` as an output array in a worklet (for example,
as a `FieldOut`), the fetch operation does not read values from the array
during the `Load`. Instead, it just constructs a new object. This makes
sense as an output array is expected to have garbage in it anyway.

This is a problem for some special arrays that contain `Vec`-like objects
that are sized dynamically. For example, if you use an
`ArrayHandleGroupVecVariable`, each entry is a dynamically sized `Vec`. The
array is referenced by creating a special version of `Vec` that holds a
reference to the array portal and an index. Components are retrieved and
set by accessing the memory in the array portal. This allows us to have a
dynamically sized `Vec` in the execution environment without having to
allocate within the worklet.

The problem comes when we want to use one of these arrays with `Vec`-like
objects for an output. The typical fetch fails because you cannot construct
one of these `Vec`-like objects without an array portal to bind it to. In
these cases, we need the fetch to create the `Vec`-like object by reading
it from the array. Even though the data will be garbage, you get the
necessary buffer into the array (and nothing more).

Previously, the problem was fixed by creating partial specializations of
the `Fetch` for these `ArrayHandle`s. This worked OK as long as you were
using the array directly. However, the approach failed if the `ArrayHandle`
was wrapped in another `ArrayHandle` (for example, if an `ArrayHandleView`
was applied to an `ArrayHandleGroupVecVariable`).

To get around this problem and simplify things, the basic `Fetch` for
direct output arrays is changed to handle all cases where the values in the
`ArrayHandle` cannot be directly constructed. A compile-time check of the
array's value type is checked with `std::is_default_constructible`. If it
can be constructed, then the array is not accessed. If it cannot be
constructed, then it grabs a value out of the array.
2023-01-23 13:02:40 -07:00
..
AspectTagDefault.h conslidate the license statement 2019-04-17 10:57:13 -06:00
BasicArg.h conslidate the license statement 2019-04-17 10:57:13 -06:00
Boundary.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
CellShape.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
CMakeLists.txt Support using arrays with dynamic Vec-likes as output arrays 2023-01-23 13:02:40 -07:00
ExecutionSignatureTagBase.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Fetch.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
FetchExtrude.h Remove testing headers from benchmarking 2021-06-10 09:41:26 -06:00
FetchTagArrayDirectIn.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
FetchTagArrayDirectInOut.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
FetchTagArrayDirectOut.h Support using arrays with dynamic Vec-likes as output arrays 2023-01-23 13:02:40 -07:00
FetchTagArrayNeighborhoodIn.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
FetchTagArrayTopologyMapIn.h Update CellSetExtrude to not specify exec types by device 2021-02-08 16:57:16 -07:00
FetchTagCellSetIn.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
FetchTagExecObject.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
FetchTagKeysIn.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
FetchTagWholeCellSetIn.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
IncidentElementCount.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
IncidentElementIndices.h Remove testing headers from benchmarking 2021-06-10 09:41:26 -06:00
InputIndex.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
OutputIndex.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
ThreadIndices.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
ThreadIndicesBasic3D.h Remove ArrayHandleStreaming capabilities 2020-03-24 15:01:56 -06:00
ThreadIndicesBasic.h Remove ArrayHandleStreaming capabilities 2020-03-24 15:01:56 -06:00
ThreadIndicesCellNeighborhood.h Extract WorkletNeighborhood base class 2020-07-20 17:50:14 -06:00
ThreadIndicesExtrude.h Support scatter/mask for CellSetExtrude 2021-09-27 13:27:02 -06:00
ThreadIndicesNeighborhood.h Add CellNeighborhood 2020-07-15 14:41:32 -06:00
ThreadIndicesPointNeighborhood.h Add CellNeighborhood 2020-07-15 14:41:32 -06:00
ThreadIndicesReduceByKey.h Add non-templated base class to Keys class. 2020-05-21 08:34:07 -06:00
ThreadIndicesTopologyMap.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
ValueCount.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
VisitIndex.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00
WorkIndex.h relaxes ThreadIndicesType across multiple worklets fetchs 2020-04-24 17:39:31 -04:00