14 #ifndef _ZOLTAN2_BASICIDENTIFIERADAPTER_HPP_
15 #define _ZOLTAN2_BASICIDENTIFIERADAPTER_HPP_
45 template <
typename User>
71 std::vector<const scalar_t *> &
weights, std::vector<int> &weightStrides);
81 numIds_(numIds), idList_(idPtr), weights_() {}
94 if (idx < 0 || idx >= weights_.size()) {
95 std::ostringstream emsg;
96 emsg << __FILE__ <<
":" << __LINE__
97 <<
" Invalid weight index " << idx << std::endl;
98 throw std::runtime_error(emsg.str());
101 weights_[idx].getStridedList(length, weights, stride);
106 const gno_t *idList_;
107 ArrayRCP<StridedData<lno_t, scalar_t> > weights_;
114 template <
typename User>
117 std::vector<const scalar_t *> &
weights, std::vector<int> &weightStrides):
118 numIds_(numIds), idList_(idPtr), weights_()
121 size_t numWeights = weights.
size();
124 weights_ = arcp(
new input_t [numWeights], 0, numWeights,
true);
127 for (
size_t i = 0; i < numWeights; i++){
128 int stride = weightStrides.size() ? weightStrides[i] : 1;
129 ArrayRCP<const scalar_t> wgtV(weights[i], 0, stride * numIds,
false);
130 weights_[i] = input_t(wgtV, stride);
BasicIdentifierAdapter(lno_t numIds, const gno_t *idPtr, std::vector< const scalar_t * > &weights, std::vector< int > &weightStrides)
Constructor.
IdentifierAdapter defines the interface for identifiers.
void getIDsView(const gno_t *&Ids) const
Provide a pointer to this process' identifiers.
lno_t size() const
Return the length of the strided array.
map_t::global_ordinal_type gno_t
Defines the IdentifierAdapter interface.
InputTraits< User >::scalar_t scalar_t
This class represents a collection of global Identifiers and their associated weights, if any.
typename InputTraits< User >::gno_t gno_t
The StridedData class manages lists of weights or coordinates.
map_t::local_ordinal_type lno_t
InputTraits< User >::lno_t lno_t
InputTraits< User >::part_t part_t
BasicIdentifierAdapter(lno_t numIds, const gno_t *idPtr)
Constructor.
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater...
void getWeightsView(const scalar_t *&weights, int &stride, int idx) const
InputTraits< User >::gno_t gno_t
InputTraits< User >::node_t node_t
size_t getLocalNumIDs() const
Returns the number of objects on this process.
This file defines the StridedData class.