VTK-m
2.0
|
Class for loading and storing values in thread instance. More...
#include <Fetch.h>
Public Types | |
using | ValueType = typename ExecObjectType::ValueType |
The type of value to load and store. More... | |
Public Member Functions | |
template<typename ThreadIndicesType > | |
VTKM_EXEC ValueType | Load (const ThreadIndicesType &indices, const ExecObjectType &execObject) const |
Load data for a work instance. More... | |
template<typename ThreadIndicesType > | |
VTKM_EXEC void | Store (const ThreadIndicesType &indices, const ExecObjectType &execObject, const ValueType &value) const |
Store data from a work instance. More... | |
Class for loading and storing values in thread instance.
The Fetch
class is used within a thread in the execution environment to load a value from an execution object specific for the given thread instance and to store a resulting value back in the object. (Either load or store can be a no-op.)
Fetch
is a templated class with four arguments. The first argument is a tag declaring the type of fetch, which is usually tied to a particular type of execution object. The second argument is an aspect tag that declares what type of data to pull/push. Together, these two tags determine the mechanism for the fetch. The third argument is the type of thread indices used (one of the classes that starts with ThreadIndices
in the vtkm::exec::arg namespace), which defines the type of thread-local indices available during the fetch. The fourth argument is the type of execution object associated where the fetch (nominally) gets its data from. This execution object is the data provided by the transport.
There is no generic implementation of Fetch
. There are partial specializations of Fetch
for each mechanism (fetch-aspect tag combination) supported. If you get a compiler error about an incomplete type for Fetch
, it means you used an invalid FetchTag
- AspectTag
combination. Most likely this means that a parameter in an ExecutionSignature with a particular aspect is pointing to the wrong argument or an invalid argument in the ControlSignature.
using vtkm::exec::arg::Fetch< FetchTag, AspectTag, ExecObjectType >::ValueType = typename ExecObjectType::ValueType |
The type of value to load and store.
All Fetch
specializations are expected to declare a type named ValueType
that is the type of object returned from Load
and passed to Store
.
VTKM_EXEC ValueType vtkm::exec::arg::Fetch< FetchTag, AspectTag, ExecObjectType >::Load | ( | const ThreadIndicesType & | indices, |
const ExecObjectType & | execObject | ||
) | const |
Load data for a work instance.
All Fetch
specializations are expected to have a constant method named Load
that takes a ThreadIndices
object containing thread-local indices and an execution object and returns the value appropriate for the work instance. If there is no actual data to load (for example for a write-only fetch), this method can be a no-op and return any value.
VTKM_EXEC void vtkm::exec::arg::Fetch< FetchTag, AspectTag, ExecObjectType >::Store | ( | const ThreadIndicesType & | indices, |
const ExecObjectType & | execObject, | ||
const ValueType & | value | ||
) | const |
Store data from a work instance.
All Fetch
specializations are expected to have a constant method named Store
that takes a ThreadIndices
object containing thread-local indices, an execution object, and a value computed by the worklet call and stores that value into the execution object associated with this fetch. If the store is not applicable (for example for a read-only fetch), this method can be a no-op.