143 const RCP<const Adapter> &ia,
144 const RCP<const Environment> &env,
145 const RCP<
const Comm<int> > &comm,
147 numGlobalIdentifiers_(), env_(env), comm_(comm),
148 gids_(), nUserWeights_(0), weights_()
151 size_t nLocalIds = ia->getLocalNumIDs();
152 gno_t lsum = nLocalIds;
153 reduceAll<int, gno_t>(*comm_, Teuchos::REDUCE_SUM, 1, &lsum,
154 &numGlobalIdentifiers_);
157 int tmp = ia->getNumWeightsPerID();
159 Teuchos::reduceAll<int, int>(*comm, Teuchos::REDUCE_MAX, 1,
160 &tmp, &nUserWeights_);
165 Array<const scalar_t *> wgts(nUserWeights_, (
const scalar_t *)NULL);
166 Array<int> wgtStrides(nUserWeights_, 0);
168 if (nUserWeights_ > 0){
169 input_t *w =
new input_t [nUserWeights_];
170 weights_ = arcp<input_t>(w, 0, nUserWeights_);
173 const gno_t *gids=NULL;
177 ia->getIDsView(gids);
178 for (
int idx=0; idx < nUserWeights_; idx++)
179 ia->getWeightsView(wgts[idx], wgtStrides[idx], idx);
184 gids_ = arcp(gids, 0, nLocalIds,
false);
186 if (nUserWeights_ > 0){
187 for (
int idx=0; idx < nUserWeights_; idx++){
188 ArrayRCP<const scalar_t> wgtArray(wgts[idx], 0,
189 nLocalIds*wgtStrides[idx],
false);
190 weights_[idx] = input_t(wgtArray, wgtStrides[idx]);
195 env_->memory(
"After construction of identifier model");