45 #ifndef _ZOLTAN2_STRIDEDDATA_HPP_ 46 #define _ZOLTAN2_STRIDEDDATA_HPP_ 75 template<
typename lno_t,
typename scalar_t>
78 ArrayRCP<const scalar_t> vec_;
90 vec_(x), stride_(stride) { }
120 template <
typename T>
void getInputArray(ArrayRCP<const T> &array)
const;
143 vec = vec_.getRawPtr();
158 template<
typename lno_t,
typename scalar_t>
161 ArrayRCP<const T> &array)
const 163 if (vec_.size() < 1){
164 array = ArrayRCP<const T>();
166 else if (stride_==1 &&
typeid(T()) ==
typeid(
scalar_t())){
171 size_t n = vec_.size() / stride_;
174 for (
size_t i=0,j=0; i < n; i++,j+=stride_){
175 tmp[i] =
static_cast<T
>(vec_[j]);
177 array = arcp(tmp, 0, n);
scalar_t operator[](lno_t idx) const
Access an element of the input array.
lno_t size() const
Return the length of the strided array.
void localMemoryAssertion(const char *file, int lineNum, size_t nobj, bool ok) const
Test for successful memory allocation on local process only.
StridedData()
Default constructor. A zero-length strided array.
void getInputArray(ArrayRCP< const T > &array) const
Create a contiguous array of the required type, perhaps for a TPL.
The StridedData class manages lists of weights or coordinates.
The user parameters, debug, timing and memory profiling output objects, and error checking methods...
void getStridedList(ArrayRCP< const scalar_t > &vec, int &stride) const
Get a reference counted pointer to the input.
Gathering definitions used in software development.
Defines the Environment class.
StridedData & operator=(const StridedData &sInput)
Assignment operator.
void getStridedList(size_t &len, const scalar_t *&vec, int &stride) const
Get the raw input information.
StridedData(ArrayRCP< const scalar_t > x, int stride)
Constructor.