10 #ifndef TPETRA_DETAILS_PACKTRAITS_HPP
11 #define TPETRA_DETAILS_PACKTRAITS_HPP
19 #include "Tpetra_ConfigDefs.hpp"
20 #include "Kokkos_Core.hpp"
74 KOKKOS_INLINE_FUNCTION
79 return static_cast<size_t>(1);
96 KOKKOS_INLINE_FUNCTION
97 static Kokkos::pair<int, size_t>
100 const size_t numEnt) {
103 typedef Kokkos::pair<int, size_t> pair_type;
106 return pair_type(errorCode, numBytes);
122 memcpy(outBuf, inBuf, numBytes);
123 return pair_type(errorCode, numBytes);
142 KOKKOS_INLINE_FUNCTION
143 static Kokkos::pair<int, size_t>
146 const size_t numEnt) {
149 typedef Kokkos::pair<int, size_t> pair_type;
152 return pair_type(errorCode, numBytes);
170 memcpy((
void*)outBuf, inBuf, numBytes);
171 return pair_type(errorCode, numBytes);
198 KOKKOS_INLINE_FUNCTION
213 KOKKOS_INLINE_FUNCTION
224 memcpy(outBuf, &inVal, numBytes);
239 KOKKOS_INLINE_FUNCTION
242 const size_t outBufIndex,
248 const size_t offset = outBufIndex * numBytes;
252 memcpy(outBuf + offset, &inVal, numBytes);
268 KOKKOS_INLINE_FUNCTION
278 memcpy((
void*)&outVal, inBuf, numBytes);
286 #endif // TPETRA_DETAILS_PACKTRAITS_HPP
LO value_type
The type of data to pack or unpack.
Kokkos::View< char *, Kokkos::AnonymousSpace > output_buffer_type
The type of an output buffer of bytes.
static KOKKOS_INLINE_FUNCTION size_t numValuesPerScalar(const value_type &)
Given an instance of value_type allocated with the right size, return the "number of values" that mak...
static KOKKOS_INLINE_FUNCTION size_t unpackValue(T &outVal, const char inBuf[])
Unpack the given value from the given output buffer.
Traits class for packing / unpacking data of type T.
static KOKKOS_INLINE_FUNCTION Kokkos::pair< int, size_t > packArray(char outBuf[], const value_type inBuf[], const size_t numEnt)
Pack the first numEnt entries of the given input buffer of value_type, into the output buffer of byte...
static const bool compileTimeSize
Whether the number of bytes required to pack one instance of value_type is fixed at compile time...
static KOKKOS_INLINE_FUNCTION size_t packValue(char outBuf[], const size_t outBufIndex, const T &inVal)
Pack the given value of type value_type into the given output buffer of bytes (char).
static KOKKOS_INLINE_FUNCTION size_t packValue(char outBuf[], const T &inVal)
Pack the given value of type value_type into the given output buffer of bytes (char).
Kokkos::View< const char *, Kokkos::AnonymousSpace > input_buffer_type
The type of an input buffer of bytes.
Kokkos::View< const value_type *, Kokkos::AnonymousSpace > input_array_type
The type of an input array of value_type.
Kokkos::View< value_type *, Kokkos::AnonymousSpace > output_array_type
The type of an output array of value_type.
static KOKKOS_INLINE_FUNCTION size_t packValueCount(const T &)
Number of bytes required to pack or unpack the given value of type value_type.
static KOKKOS_INLINE_FUNCTION Kokkos::pair< int, size_t > unpackArray(value_type outBuf[], const char inBuf[], const size_t numEnt)
Unpack numEnt value_type entries from the given input buffer of bytes, to the given output buffer of ...