38#ifndef DOXYGEN_SHOULD_SKIP_THIS
39 typedef typename Adapter::scalar_t scalar_t;
40 typedef typename Adapter::gno_t
gno_t;
41 typedef typename Adapter::lno_t
lno_t;
42 typedef typename Adapter::node_t
node_t;
54 const RCP<const Environment> &env,
55 const RCP<
const Comm<int> > &comm,
modelFlag_t &modelFlags);
64 return numGlobalIdentifiers_;
76 ArrayView<input_t> &wgts)
const
78 Ids = ArrayView<const gno_t>();
79 wgts = weights_.view(0, nUserWeights_);
82 Ids = ArrayView<const gno_t>(
83 reinterpret_cast<const gno_t*
>(gids_.getRawPtr()), n);
89 Kokkos::View<const gno_t *, typename node_t::device_type> &Ids,
90 Kokkos::View<scalar_t **, typename node_t::device_type> &wgts)
const {
92 adapter_->getIDsKokkosView(Ids);
93 adapter_->getWeightsKokkosView(wgts);
109 gno_t numGlobalIdentifiers_;
110 const RCP<const Environment> env_;
111 const RCP<const Comm<int> > comm_;
112 ArrayRCP<const gno_t> gids_;
113 const RCP<const Adapter> adapter_;
115 ArrayRCP<input_t> weights_;
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");