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>
104 typedef Kokkos::pair<int, size_t> pair_type;
107 return pair_type (errorCode, numBytes);
124 memcpy (outBuf, inBuf, numBytes);
125 return pair_type (errorCode, numBytes);
144 KOKKOS_INLINE_FUNCTION
145 static Kokkos::pair<int, size_t>
152 typedef Kokkos::pair<int, size_t> pair_type;
155 return pair_type (errorCode, numBytes);
174 memcpy ((
void*) outBuf, inBuf, numBytes);
175 return pair_type (errorCode, numBytes);
202 KOKKOS_INLINE_FUNCTION
218 KOKKOS_INLINE_FUNCTION
230 memcpy (outBuf, &inVal, numBytes);
245 KOKKOS_INLINE_FUNCTION
248 const size_t outBufIndex,
255 const size_t offset = outBufIndex * numBytes;
259 memcpy (outBuf + offset, &inVal, numBytes);
275 KOKKOS_INLINE_FUNCTION
286 memcpy ((
void*) &outVal, inBuf, numBytes);
294 #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 ...