Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | List of all members
Tpetra::Details::ScalarViewTraits< T, D > Struct Template Reference

Traits class for allocating a Kokkos::View<T*, D>. More...

#include <Tpetra_Details_ScalarViewTraits.hpp>

Static Public Member Functions

static Kokkos::View
< value_type *, device_type > 
allocateArray (const value_type &x, const size_t numEnt, const std::string &label="")
 Given an instance of value_type allocated with the right size, allocate and return a one-dimensional array of value_type. More...
 

Detailed Description

template<class T, class D>
struct Tpetra::Details::ScalarViewTraits< T, D >

Traits class for allocating a Kokkos::View<T*, D>.

Template Parameters
TThe type of the data to pack / unpack.
DThe Kokkos "device" type; where the data live.

Definition at line 29 of file Tpetra_Details_ScalarViewTraits.hpp.

Member Function Documentation

template<class T , class D >
static Kokkos::View<value_type*, device_type> Tpetra::Details::ScalarViewTraits< T, D >::allocateArray ( const value_type &  x,
const size_t  numEnt,
const std::string &  label = "" 
)
inlinestatic

Given an instance of value_type allocated with the right size, allocate and return a one-dimensional array of value_type.

This function lets the pack and unpack code that uses ScalarViewTraits correctly handle types that have a size specified at run time. In particular, it's helpful if that code needs to allocate temporary buffers of value_type. ScalarViewTraits still assumes that all instances of value_type in an input or output array have the same run-time size.

Parameters
x[in] Instance of value_type with the correct (run-time) size.
numEnt[in] Number of entries in the returned Kokkos::View.
label[in] Optional string label of the returned Kokkos::View. (Kokkos::View's constructor takes a string label, which Kokkos uses for debugging output.)
Returns
One-dimensional array of value_type, all instances of which have the same (run-time) size as x.
Note
To implementers of specializations: If the number of bytes to pack or unpack your type may be determined at run time, you might be able just to use this implementation as-is, and just reimplement numValuesPerScalar().

Definition at line 63 of file Tpetra_Details_ScalarViewTraits.hpp.


The documentation for this struct was generated from the following file: