157 const RCP<const Adapter> &ia,
158 const RCP<const Environment> &env,
159 const RCP<
const Comm<int> > &comm,
161 numGlobalIdentifiers_(), env_(env), comm_(comm),
162 gids_(), adapter_(ia), nUserWeights_(0), weights_()
165 size_t nLocalIds = ia->getLocalNumIDs();
166 gno_t lsum = nLocalIds;
167 reduceAll<int, gno_t>(*comm_, Teuchos::REDUCE_SUM, 1, &lsum,
168 &numGlobalIdentifiers_);
171 int tmp = ia->getNumWeightsPerID();
173 Teuchos::reduceAll<int, int>(*comm, Teuchos::REDUCE_MAX, 1,
174 &tmp, &nUserWeights_);
179 Array<const scalar_t *> wgts(nUserWeights_, (
const scalar_t *)NULL);
180 Array<int> wgtStrides(nUserWeights_, 0);
182 if (nUserWeights_ > 0){
183 input_t *w =
new input_t [nUserWeights_];
184 weights_ = arcp<input_t>(w, 0, nUserWeights_);
187 const gno_t *gids=NULL;
191 ia->getIDsView(gids);
192 for (
int idx=0; idx < nUserWeights_; idx++)
193 ia->getWeightsView(wgts[idx], wgtStrides[idx], idx);
198 gids_ = arcp(gids, 0, nLocalIds,
false);
200 if (nUserWeights_ > 0){
201 for (
int idx=0; idx < nUserWeights_; idx++){
202 ArrayRCP<const scalar_t> wgtArray(wgts[idx], 0,
203 nLocalIds*wgtStrides[idx],
false);
204 weights_[idx] = input_t(wgtArray, wgtStrides[idx]);
209 env_->memory(
"After construction of identifier model");