Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
Zoltan2::StridedData< lno_t, scalar_t > Class Template Reference

The StridedData class manages lists of weights or coordinates. More...

#include <Zoltan2_StridedData.hpp>

Public Member Functions

 StridedData (ArrayRCP< const scalar_t > x, int stride)
 Constructor. More...
 
 StridedData ()
 Default constructor. A zero-length strided array. More...
 
lno_t size () const
 Return the length of the strided array. More...
 
scalar_t operator[] (lno_t idx) const
 Access an element of the input array. More...
 
template<typename T >
void getInputArray (ArrayRCP< const T > &array) const
 Create a contiguous array of the required type, perhaps for a TPL. More...
 
void getStridedList (ArrayRCP< const scalar_t > &vec, int &stride) const
 Get a reference counted pointer to the input. More...
 
void getStridedList (size_t &len, const scalar_t *&vec, int &stride) const
 Get the raw input information. More...
 
StridedDataoperator= (const StridedData &sInput)
 Assignment operator. More...
 

Detailed Description

template<typename lno_t, typename scalar_t>
class Zoltan2::StridedData< lno_t, scalar_t >

The StridedData class manages lists of weights or coordinates.

A likely representation for multi-dimensional weights or coordinates is an array ordered by identifier by dimension, or vice versa. The purposes of this class:

If we need to modify weights (say convert floating point weights to integers for a third party library) methods to do this could be added here.

Definition at line 76 of file Zoltan2_StridedData.hpp.

Constructor & Destructor Documentation

template<typename lno_t , typename scalar_t >
Zoltan2::StridedData< lno_t, scalar_t >::StridedData ( ArrayRCP< const scalar_t >  x,
int  stride 
)
inline

Constructor.

Parameters
xx[0] is the first element of the array. The subsequent elements are at x[i * stride].
stridethe stride of the elements in the strided array.

Definition at line 89 of file Zoltan2_StridedData.hpp.

template<typename lno_t , typename scalar_t >
Zoltan2::StridedData< lno_t, scalar_t >::StridedData ( )
inline

Default constructor. A zero-length strided array.

Definition at line 95 of file Zoltan2_StridedData.hpp.

Member Function Documentation

template<typename lno_t , typename scalar_t >
lno_t Zoltan2::StridedData< lno_t, scalar_t >::size ( ) const
inline

Return the length of the strided array.

The length may be longer than the number of values because the stride may be greater than one.

Definition at line 103 of file Zoltan2_StridedData.hpp.

template<typename lno_t , typename scalar_t >
scalar_t Zoltan2::StridedData< lno_t, scalar_t >::operator[] ( lno_t  idx) const
inline

Access an element of the input array.

Parameters
idxThe logical index of the element in the strided array.

For performance, this is inline and no error checking.

Definition at line 111 of file Zoltan2_StridedData.hpp.

template<typename lno_t , typename scalar_t >
template<typename T >
void Zoltan2::StridedData< lno_t, scalar_t >::getInputArray ( ArrayRCP< const T > &  array) const

Create a contiguous array of the required type, perhaps for a TPL.

TODO: if are there particular conversions we would like to do for TPLs, we can add methods to do that. Here we just essentially cast. If the cast is not valid (like double to float) an exception is thrown.

Definition at line 201 of file Zoltan2_StridedData.hpp.

template<typename lno_t , typename scalar_t >
void Zoltan2::StridedData< lno_t, scalar_t >::getStridedList ( ArrayRCP< const scalar_t > &  vec,
int &  stride 
) const
inline

Get a reference counted pointer to the input.

Parameters
vecon return is a reference counted pointer to the input. Element k is at vec[k*stride].
strideis describes the layout of the input in vec.

Definition at line 129 of file Zoltan2_StridedData.hpp.

template<typename lno_t , typename scalar_t >
void Zoltan2::StridedData< lno_t, scalar_t >::getStridedList ( size_t &  len,
const scalar_t *&  vec,
int &  stride 
) const
inline

Get the raw input information.

Parameters
lenon return is the length of storage at vec. This will be some multiple of stride.
vecon return is a pointer to the input. Element k is at vec[k*stride].
strideis describes the layout of the input in vec.

Definition at line 142 of file Zoltan2_StridedData.hpp.

template<typename lno_t , typename scalar_t >
StridedData& Zoltan2::StridedData< lno_t, scalar_t >::operator= ( const StridedData< lno_t, scalar_t > &  sInput)
inline

Assignment operator.

Definition at line 152 of file Zoltan2_StridedData.hpp.


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