88 const Teuchos::RCP <
const Teuchos::Comm<int> > &comm_,
89 const Teuchos::RCP <const MachineRep> &machine_,
90 const Teuchos::RCP <const Adapter> &adapter_,
92 const Teuchos::RCP <const Environment> &envConst):
93 nRanks(comm_->getSize()), myRank(comm_->getRank()),
94 nMyParts(0), myParts(
Teuchos::null)
98 const part_t *partList;
99 if (psoln_ != Teuchos::null) {
100 partList = psoln_->getPartListView();
103 adapter_->getPartsView(partList);
108 part_t minPart, maxPart;
110 if (partList == NULL) {
122 size_t nLocal = adapter_->getLocalNumIDs();
128 typedef Tpetra::Map<>::global_ordinal_type use_this_gno_t;
130 std::set<use_this_gno_t> unique;
131 for (
size_t i = 0; i < nLocal; i++)
132 unique.insert(partList[i]);
134 size_t nUnique = unique.size();
135 Array<use_this_gno_t> uniquePartList(nUnique);
137 for (
typename std::set<use_this_gno_t>::iterator it = unique.begin();
138 it != unique.end(); it++)
139 uniquePartList[k++] = *it;
144 Teuchos::OrdinalTraits<Tpetra::global_size_t>::invalid();
145 Tpetra::Map<lno_t, use_this_gno_t> tmap(nGlobalElts, uniquePartList(),
148 nParts = Teuchos::as<part_t>(tmap.getGlobalNumElements());
149 minPart = tmap.getMinAllGlobalIndex();
150 maxPart = tmap.getMaxAllGlobalIndex();
156 if ((minPart != 0) || (maxPart != nParts-1)) {
158 throw std::runtime_error(
"Cannot use mapping_algorithm = contiguous "
159 "unless parts are numbered from 0 to nParts-1");
210 if (myParts == Teuchos::null) {
211 myParts = arcp(
new part_t[nMyParts], 0, nMyParts,
true);
212 for (part_t i = 0; i < nMyParts; i++)
213 myParts[i] = firstPart(myRank) + i;
215 parts = myParts.getRawPtr();