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