121 const RCP<const Adapter> &ia,
122 const RCP<const Environment> &env,
123 const RCP<
const Comm<int> > &comm,
125 numGlobalIdentifiers_(), env_(env), comm_(comm),
126 gids_(), adapter_(ia), nUserWeights_(0), weights_()
129 size_t nLocalIds = ia->getLocalNumIDs();
130 gno_t lsum = nLocalIds;
131 reduceAll<int, gno_t>(*comm_, Teuchos::REDUCE_SUM, 1, &lsum,
132 &numGlobalIdentifiers_);
135 int tmp = ia->getNumWeightsPerID();
137 Teuchos::reduceAll<int, int>(*comm, Teuchos::REDUCE_MAX, 1,
138 &tmp, &nUserWeights_);
143 Array<const scalar_t *> wgts(nUserWeights_, (
const scalar_t *)NULL);
144 Array<int> wgtStrides(nUserWeights_, 0);
146 if (nUserWeights_ > 0){
147 input_t *w =
new input_t [nUserWeights_];
148 weights_ = arcp<input_t>(w, 0, nUserWeights_);
151 const gno_t *gids=NULL;
155 ia->getIDsView(gids);
156 for (
int idx=0; idx < nUserWeights_; idx++)
157 ia->getWeightsView(wgts[idx], wgtStrides[idx], idx);
162 gids_ = arcp(gids, 0, nLocalIds,
false);
164 if (nUserWeights_ > 0){
165 for (
int idx=0; idx < nUserWeights_; idx++){
166 ArrayRCP<const scalar_t> wgtArray(wgts[idx], 0,
167 nLocalIds*wgtStrides[idx],
false);
168 weights_[idx] = input_t(wgtArray, wgtStrides[idx]);
173 env_->memory(
"After construction of identifier model");