50 #ifndef _ZOLTAN2_BASICIDENTIFIERADAPTER_HPP_ 51 #define _ZOLTAN2_BASICIDENTIFIERADAPTER_HPP_ 82 template <
typename User>
110 std::vector<const scalar_t *> &
weights, std::vector<int> &weightStrides);
124 if (idx < 0 || idx >= weights_.size()) {
125 std::ostringstream emsg;
126 emsg << __FILE__ <<
":" << __LINE__
127 <<
" Invalid weight index " << idx << std::endl;
128 throw std::runtime_error(emsg.str());
131 weights_[idx].getStridedList(length,
weights, stride);
137 const gno_t *idList_;
138 ArrayRCP<StridedData<lno_t, scalar_t> > weights_;
145 template <
typename User>
148 std::vector<const scalar_t *> &
weights, std::vector<int> &weightStrides):
149 numIds_(numIds), idList_(idPtr), weights_()
152 size_t numWeights =
weights.size();
155 weights_ = arcp(
new input_t [numWeights], 0, numWeights,
true);
158 for (
size_t i=0; i < numWeights; i++){
159 int stride = weightStrides.size() ? weightStrides[i] : 1;
160 ArrayRCP<const scalar_t> wgtV(
weights[i], 0, stride*numIds,
false);
161 weights_[i] = input_t(wgtV, stride);
IdentifierAdapter defines the interface for identifiers.
InputTraits< User >::gno_t gno_t
Defines the IdentifierAdapter interface.
int getNumWeightsPerID() const
Returns the number of weights per object. Number of weights per object should be zero or greater...
InputTraits< User >::scalar_t scalar_t
This class represents a collection of global Identifiers and their associated weights, if any.
size_t getLocalNumIDs() const
Returns the number of objects on this process.
void getIDsView(const gno_t *&Ids) const
Provide a pointer to this process' identifiers.
The StridedData class manages lists of weights or coordinates.
InputTraits< User >::lno_t lno_t
InputTraits< User >::part_t part_t
InputTraits< User >::gno_t gno_t
BasicIdentifierAdapter(lno_t numIds, const gno_t *idPtr, std::vector< const scalar_t *> &weights, std::vector< int > &weightStrides)
Constructor.
void getWeightsView(const scalar_t *&weights, int &stride, int idx) const
Provide pointer to a weight array with stride.
InputTraits< User >::node_t node_t
This file defines the StridedData class.