Go to the documentation of this file.
10 #ifndef vtkm_rendering_raytracing_ChannelBuffer_Operations_h
11 #define vtkm_rendering_raytracing_ChannelBuffer_Operations_h
41 : NumChannels(numChannels)
44 using ControlSignature = void(FieldIn, WholeArrayIn, FieldIn, WholeArrayOut);
45 using ExecutionSignature = void(_1, _2, _3, _4, WorkIndex);
46 template <
typename InBufferPortalType,
typename OutBufferPortalType>
48 const InBufferPortalType& inBuffer,
50 OutBufferPortalType& outBuffer,
57 vtkm::Id inIndex = index * NumChannels;
58 vtkm::Id outIndex = offset * NumChannels;
63 outBuffer.Set(outIndex + i, inBuffer.Get(inIndex + i));
76 : NumChannels(numChannels)
79 using ControlSignature = void(FieldOut, WholeArrayIn);
80 using ExecutionSignature = void(_1, _2, WorkIndex);
81 template <
typename ValueType,
typename PortalType>
82 VTKM_EXEC void operator()(ValueType& outValue,
83 const PortalType& source,
86 outValue = source.Get(index % NumChannels);
96 template <
typename Precision>
111 dispatcher.Invoke(masks, buffer.
Buffer, offsets, compactedBuffer);
112 buffer.
Buffer = compactedBuffer;
113 buffer.
Size = newSize;
116 template <
typename Device,
typename Precision>
123 std::string msg =
"ChannelBuffer: number of bins in sourse signature must match NumChannels";
128 initBufferDispatcher.SetDevice(Device());
129 initBufferDispatcher.Invoke(buffer.
Buffer, sourceSignature);
132 template <
typename Device,
typename Precision>
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
Manages an array-worth of data.
Definition: ArrayHandle.h:283
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::Id GetBufferLength() const
VTKM_CONT 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:465
vtkm::Id Size
Definition: ChannelBuffer.h:49
static VTKM_CONT bool Copy(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:410
Mananges a buffer that contains many channels per value (e.g., RGBA values).
Definition: ChannelBuffer.h:45
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
static void InitChannels(ChannelBuffer< Precision > &buffer, vtkm::cont::ArrayHandle< Precision > sourceSignature, Device)
Definition: ChannelBufferOperations.h:117
Dispatcher for worklets that inherit from WorkletMapField.
Definition: DispatcherMapField.h:25
static VTKM_CONT T ScanExclusive(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:816
#define VTKM_CONT
Definition: ExportMacros.h:57
An array handle with a constant value.
Definition: ArrayHandleConstant.h:63
uint8_t UInt8
Definition: Types.h:157
static void InitConst(ChannelBuffer< Precision > &buffer, const Precision value, Device)
Definition: ChannelBufferOperations.h:133
#define BOUNDS_CHECK(HANDLE, INDEX)
Definition: RayTracingTypeDefs.h:31
vtkm::cont::ArrayHandle< Precision > Buffer
Definition: ChannelBuffer.h:54
static void Compact(ChannelBuffer< Precision > &buffer, vtkm::cont::ArrayHandle< UInt8 > &masks, const vtkm::Id &newSize)
Definition: ChannelBufferOperations.h:97
This class is thrown when a VTKm function or method encounters an invalid value that inhibits progres...
Definition: ErrorBadValue.h:25
Cast the values of an array to the specified type, on demand.
Definition: ArrayHandleCast.h:141
int32_t Int32
Definition: Types.h:160
vtkm::Int32 NumChannels
Definition: ChannelBuffer.h:48
Definition: ChannelBufferOperations.h:93
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38