Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_BlockedMap_def.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Xpetra: A linear algebra interface package
4//
5// Copyright 2012 NTESS and the Xpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef PACKAGES_XPETRA_SUP_BLOCKEDMAP_XPETRA_BLOCKEDMAP_DEF_HPP_
11#define PACKAGES_XPETRA_SUP_BLOCKEDMAP_XPETRA_BLOCKEDMAP_DEF_HPP_
12
14
15#include "Xpetra_Exceptions.hpp"
17#include "Xpetra_MapFactory.hpp"
18
19namespace Xpetra {
20
21template <class LocalOrdinal, class GlobalOrdinal, class Node>
26
27template <class LocalOrdinal, class GlobalOrdinal, class Node>
29 BlockedMap(const RCP<const Map>& fullmap, const std::vector<RCP<const Map>>& maps, bool bThyraMode) {
30 bThyraMode_ = bThyraMode;
31
32 if (bThyraMode == false) {
33 // use Xpetra-style numbering for sub-block maps
34 // That is, all sub-block maps have unique GIDs which may not be contiguous and start with GIDs different than zero.
35
36 // plausibility check
37 size_t numAllElements = 0;
38 for (size_t v = 0; v < maps.size(); ++v) {
39 numAllElements += maps[v]->getGlobalNumElements();
40 }
41 TEUCHOS_TEST_FOR_EXCEPTION(fullmap->getGlobalNumElements() != numAllElements,
42 std::logic_error,
43 "logic error. full map and sub maps have not same number of elements ("
44 << fullmap->getGlobalNumElements() << " versus " << numAllElements
45 << "). We cannot build MapExtractor with Xpetra-style numbering. Please make sure that you want "
46 "Xpetra-style numbering instead of Thyra-style numbering.");
47
48 fullmap_ = fullmap;
49 maps_ = maps;
50 } else {
51 // std::cout << "Create Map Extractor in Thyra Mode!!! " << std::endl;
52 // use Thyra-style numbering for sub-block maps
53 // That is, all sub-block maps start with zero as GID and are contiguous
54
55 // plausibility check
56 for (size_t v = 0; v < maps.size(); ++v) {
57 TEUCHOS_TEST_FOR_EXCEPTION(maps[v]->getMinAllGlobalIndex() != 0,
58 std::logic_error,
59 "logic error. When using Thyra-style numbering all sub-block maps must start with zero as GID. Map block "
60 << v << " starts with GID " << maps[v]->getMinAllGlobalIndex());
61 }
62
63 // store submaps in Thyra-style ordering
64 thyraMaps_ = maps;
65
66 // get offsets
67 std::vector<GlobalOrdinal> gidOffsets(maps.size(), 0);
68 for (size_t v = 1; v < maps.size(); ++v) {
69 gidOffsets[v] = maps[v - 1]->getMaxAllGlobalIndex() + gidOffsets[v - 1] + 1;
70 }
71
72 // build submaps
73 maps_.resize(maps.size());
74 std::vector<GlobalOrdinal> fullMapGids;
76 for (size_t v = 0; v < maps.size(); ++v) {
77 size_t myNumElements = maps[v]->getLocalNumElements();
78 std::vector<GlobalOrdinal> subMapGids(myNumElements, 0);
79 for (LocalOrdinal l = 0; l < Teuchos::as<LocalOrdinal>(myNumElements); ++l) {
80 GlobalOrdinal myGid = maps[v]->getGlobalElement(l);
81 subMapGids[l] = myGid + gidOffsets[v];
82 fullMapGids.push_back(myGid + gidOffsets[v]);
83 }
84 // std::sort(subMapGids.begin(), subMapGids.end());
85 // subMapGids.erase(std::unique(subMapGids.begin(), subMapGids.end()), subMapGids.end());
86
87 Teuchos::ArrayView<GlobalOrdinal> subMapGidsView(&subMapGids[0], subMapGids.size());
88
90 maps[v]->lib(), INVALID, subMapGidsView, maps[v]->getIndexBase(), maps[v]->getComm());
91 maps_[v] = mySubMap;
92 }
93
94 // const GO INVALID = Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid();
95 // std::sort(coarseMapGids.begin(), coarseMapGids.end());
96 // coarseMapGids.erase(std::unique(coarseMapGids.begin(), coarseMapGids.end()), coarseMapGids.end());
97 // Teuchos::ArrayView<GO> coarseMapGidsView(&coarseMapGids[0], coarseMapGids.size());
98 // std::sort(fullMapGids.begin(), fullMapGids.end());
99 // fullMapGids.erase(std::unique(fullMapGids.begin(), fullMapGids.end()), fullMapGids.end());
100
101 Teuchos::ArrayView<GlobalOrdinal> fullMapGidsView(&fullMapGids[0], fullMapGids.size());
102
104 fullmap->lib(), INVALID, fullMapGidsView, fullmap->getIndexBase(), fullmap->getComm());
105
106 // plausibility check
107 size_t numAllElements = 0;
108 for (size_t v = 0; v < maps_.size(); ++v) {
109 numAllElements += maps_[v]->getGlobalNumElements();
110 }
112 fullmap_->getGlobalNumElements() != numAllElements,
113 std::logic_error,
114 "logic error. full map and sub maps have not same number of elements. This cannot be. Please report the bug to the Xpetra developers!");
115 }
116
117 // build importers for sub maps
118 importers_.resize(maps_.size());
119 for (unsigned i = 0; i < maps_.size(); ++i) {
120 if (maps[i] != null) {
121 importers_[i] = Xpetra::ImportFactory<LocalOrdinal, GlobalOrdinal, Node>::Build(fullmap_, maps_[i]);
122 }
123 }
125 CheckConsistency() == false, std::logic_error, "logic error. full map and sub maps are inconsistently distributed over the processors.");
126}
127
128template <class LocalOrdinal, class GlobalOrdinal, class Node>
130 BlockedMap(const std::vector<RCP<const Map>>& maps, const std::vector<RCP<const Map>>& thyramaps) {
131 bThyraMode_ = true;
132
133 // plausibility check
134 TEUCHOS_TEST_FOR_EXCEPTION(thyramaps.size() != maps.size(), std::logic_error, "logic error. The number of submaps must be identical!");
135 for (size_t v = 0; v < thyramaps.size(); ++v) {
136 TEUCHOS_TEST_FOR_EXCEPTION(thyramaps[v]->getMinAllGlobalIndex() != 0,
137 std::logic_error,
138 "logic error. When using Thyra-style numbering all sub-block maps must start with zero as GID.");
139
140 XPETRA_TEST_FOR_EXCEPTION(thyramaps[v]->getLocalNumElements() != maps[v]->getLocalNumElements(),
141 std::logic_error,
142 "logic error. The size of the submaps must be identical (same distribution, just different GIDs)");
143 }
144
145 // store user-provided maps and thyramaps
146 thyraMaps_ = thyramaps;
147 maps_ = maps;
148 fullmap_ = this->concatenateMaps(maps);
149
150 // plausibility check
151 size_t numAllElements = 0;
152 for (size_t v = 0; v < maps_.size(); ++v) {
153 numAllElements += maps_[v]->getGlobalNumElements();
154 }
156 fullmap_->getGlobalNumElements() != numAllElements,
157 std::logic_error,
158 "logic error. full map and sub maps have not same number of elements. This cannot be. Please report the bug to the Xpetra developers!");
159
160 // build importers for sub maps
161 importers_.resize(maps_.size());
162 for (unsigned i = 0; i < maps_.size(); ++i) {
163 if (maps[i] != null) {
164 importers_[i] = Xpetra::ImportFactory<LocalOrdinal, GlobalOrdinal, Node>::Build(fullmap_, maps_[i]);
165 }
166 }
168 CheckConsistency() == false, std::logic_error, "logic error. full map and sub maps are inconsistently distributed over the processors.");
169}
170
171template <class LocalOrdinal, class GlobalOrdinal, class Node>
173 BlockedMap(const BlockedMap& input) {
174 bThyraMode_ = input.getThyraMode();
175 fullmap_ = Teuchos::null;
176 maps_.resize(input.getNumMaps(), Teuchos::null);
177 thyraMaps_.resize(input.getNumMaps(), Teuchos::null);
178 this->assign(input);
179}
180
181template <class LocalOrdinal, class GlobalOrdinal, class Node>
183 ~BlockedMap() {
184 // make sure all RCP's are freed
185 for (size_t v = 0; v < maps_.size(); ++v) {
186 maps_[v] = Teuchos::null;
187 if (bThyraMode_ == true)
188 thyraMaps_[v] = Teuchos::null;
189 importers_[v] = Teuchos::null;
190 }
191
192 fullmap_ = Teuchos::null;
193}
194
195template <class LocalOrdinal, class GlobalOrdinal, class Node>
198 getGlobalNumElements() const {
199 return fullmap_->getGlobalNumElements();
200}
201
202template <class LocalOrdinal, class GlobalOrdinal, class Node>
203size_t
205 return fullmap_->getLocalNumElements();
206}
207
208template <class LocalOrdinal, class GlobalOrdinal, class Node>
209GlobalOrdinal
211 getIndexBase() const {
212 return fullmap_->getIndexBase();
213}
214
215template <class LocalOrdinal, class GlobalOrdinal, class Node>
216LocalOrdinal
218 getMinLocalIndex() const {
219 return fullmap_->getMinLocalIndex();
220}
221
222template <class LocalOrdinal, class GlobalOrdinal, class Node>
223LocalOrdinal
225 getMaxLocalIndex() const {
226 return fullmap_->getMaxLocalIndex();
227}
228
229template <class LocalOrdinal, class GlobalOrdinal, class Node>
230GlobalOrdinal
232 getMinGlobalIndex() const {
233 return fullmap_->getMinGlobalIndex();
234}
235
236template <class LocalOrdinal, class GlobalOrdinal, class Node>
237GlobalOrdinal
239 getMaxGlobalIndex() const {
240 return fullmap_->getMaxGlobalIndex();
241}
242
243template <class LocalOrdinal, class GlobalOrdinal, class Node>
244GlobalOrdinal
246 getMinAllGlobalIndex() const {
247 return fullmap_->getMinAllGlobalIndex();
248}
249
250template <class LocalOrdinal, class GlobalOrdinal, class Node>
251GlobalOrdinal
253 getMaxAllGlobalIndex() const {
254 return fullmap_->getMaxAllGlobalIndex();
255}
256
257template <class LocalOrdinal, class GlobalOrdinal, class Node>
258LocalOrdinal
260 getLocalElement(GlobalOrdinal globalIndex) const {
261 return fullmap_->getLocalElement(globalIndex);
262}
263
264template <class LocalOrdinal, class GlobalOrdinal, class Node>
265GlobalOrdinal
267 getGlobalElement(LocalOrdinal localIndex) const {
268 return fullmap_->getGlobalElement(localIndex);
269}
270
271template <class LocalOrdinal, class GlobalOrdinal, class Node>
275 const Teuchos::ArrayView<int>& /* nodeIDList */,
276 const Teuchos::ArrayView<LocalOrdinal>& /* LIDList */) const {
277 throw Xpetra::Exceptions::RuntimeError("BlockedMap::getRemoteIndexList: routine not implemented.");
279}
280
281template <class LocalOrdinal, class GlobalOrdinal, class Node>
285 const Teuchos::ArrayView<int>& /* nodeIDList */) const {
286 throw Xpetra::Exceptions::RuntimeError("BlockedMap::getRemoteIndexList: routine not implemented.");
288}
289
290template <class LocalOrdinal, class GlobalOrdinal, class Node>
293 getLocalElementList() const {
294 return fullmap_->getLocalElementList();
295}
296
297template <class LocalOrdinal, class GlobalOrdinal, class Node>
301 return fullmap_->getMyGlobalIndicesDevice();
302}
303
304template <class LocalOrdinal, class GlobalOrdinal, class Node>
306 isNodeLocalElement(LocalOrdinal localIndex) const {
307 return fullmap_->isNodeLocalElement(localIndex);
308}
309
310template <class LocalOrdinal, class GlobalOrdinal, class Node>
312 isNodeGlobalElement(GlobalOrdinal globalIndex) const {
313 return fullmap_->isNodeGlobalElement(globalIndex);
314}
315
316template <class LocalOrdinal, class GlobalOrdinal, class Node>
318 isContiguous() const {
319 throw Xpetra::Exceptions::RuntimeError("BlockedMap::isContiguous: routine not implemented.");
321}
322
323template <class LocalOrdinal, class GlobalOrdinal, class Node>
325 isDistributed() const {
326 return fullmap_->isDistributed();
327}
328
329template <class LocalOrdinal, class GlobalOrdinal, class Node>
332 RCP<const Map> rcpMap = Teuchos::rcpFromRef(map);
333 RCP<const BlockedMap> rcpBMap = Teuchos::rcp_dynamic_cast<const BlockedMap>(rcpMap);
334 if (rcpBMap.is_null() == true)
335 return false;
336
337 for (size_t v = 0; v < maps_.size(); ++v) {
338 bool bSame = getMap(v, false)->isCompatible(*(rcpBMap->getMap(v, false)));
339 if (bSame == false)
340 return false;
341 if (bThyraMode_) {
342 bSame = getMap(v, true)->isCompatible(*(rcpBMap->getMap(v, true)));
343 }
344 }
345 return true;
346}
347
348template <class LocalOrdinal, class GlobalOrdinal, class Node>
351 RCP<const Map> rcpMap = Teuchos::rcpFromRef(map);
352 RCP<const BlockedMap> rcpBMap = Teuchos::rcp_dynamic_cast<const BlockedMap>(rcpMap);
353 if (rcpBMap.is_null() == true) {
354 // If this is a blocked map with > 1 blocks but "map" is a plain map they can't be the same
355 if (this->getNumMaps() > 1) {
356 return false;
357 }
358
359 // special case: this is a single blocked map and "map" is a plain map object
360 bool bSame = getMap(0, bThyraMode_)->isSameAs(*rcpMap);
361 return bSame;
362 }
363
364 for (size_t v = 0; v < maps_.size(); ++v) {
365 bool bSame = getMap(v, false)->isSameAs(*(rcpBMap->getMap(v, false)));
366 if (bSame == false) {
367 return false;
368 }
369 if (bThyraMode_) {
370 bSame = getMap(v, true)->isSameAs(*(rcpBMap->getMap(v, true)));
371 if (bSame == false) {
372 return false;
373 }
374 }
375 }
376 return true;
377}
378
379template <class LocalOrdinal, class GlobalOrdinal, class Node>
382 getComm() const {
383 return fullmap_->getComm();
384}
385
386template <class LocalOrdinal, class GlobalOrdinal, class Node>
389operator=(const BlockedMap& rhs) {
390 assign(rhs); // dispatch to protected virtual method
391 return *this;
392}
393
394template <class LocalOrdinal, class GlobalOrdinal, class Node>
396 return bThyraMode_;
397}
398
399template <class LocalOrdinal, class GlobalOrdinal, class Node>
402 removeEmptyProcesses() const {
403 throw Xpetra::Exceptions::RuntimeError("BlockedMap::removeEmptyProcesses: routine not implemented.");
404}
405
406template <class LocalOrdinal, class GlobalOrdinal, class Node>
409 replaceCommWithSubset(const Teuchos::RCP<const Teuchos::Comm<int>>& /* newComm */) const {
410 throw Xpetra::Exceptions::RuntimeError("BlockedMap::replaceCommWithSubset: routine not implemented.");
411}
412
413template <class LocalOrdinal, class GlobalOrdinal, class Node>
416 return fullmap_->lib();
417}
418
419template <class LocalOrdinal, class GlobalOrdinal, class Node>
422 getMap() const {
423 return getFullMap();
424}
425
426template <class LocalOrdinal, class GlobalOrdinal, class Node>
427size_t
429 getNumMaps() const {
430 return maps_.size();
431}
432
433template <class LocalOrdinal, class GlobalOrdinal, class Node>
436 getMap(size_t i,
437 bool bThyraMode) const {
438 XPETRA_TEST_FOR_EXCEPTION(i >= getNumMaps(),
440 "BlockedMap::getMap: tried to access block " << i << ", but BlockedMap has only " << getNumMaps()
441 << " blocks! Block indices must be between 0 and " << getNumMaps() - 1
442 << ".");
443 if (bThyraMode_ == true && bThyraMode == true) {
444 return thyraMaps_[i];
445 }
446
447 XPETRA_TEST_FOR_EXCEPTION(bThyraMode_ == false && bThyraMode == true,
449 "BlockedMap::getMap: cannot return sub map in Thyra-style numbering if BlockedMap object is not created using "
450 "Thyra-style numbered submaps.");
451 return maps_[i];
452}
453
454template <class LocalOrdinal, class GlobalOrdinal, class Node>
457 getImporter(size_t i) const {
458 XPETRA_TEST_FOR_EXCEPTION(i >= getNumMaps(),
460 "BlockedMap::getImporter: tried to access block " << i << ", but BlockedMap has only " << getNumMaps()
461 << " blocks! Block indices must be between 0 and " << getNumMaps() - 1
462 << ".");
463 return importers_[i];
464}
465
466template <class LocalOrdinal, class GlobalOrdinal, class Node>
472
473template <class LocalOrdinal, class GlobalOrdinal, class Node>
474size_t
476 getMapIndexForGID(GlobalOrdinal gid) const {
477 for (size_t i = 0; i < getNumMaps(); i++)
478 if (getMap(i)->isNodeGlobalElement(gid) == true)
479 return i;
480
482 false, Xpetra::Exceptions::RuntimeError, "getMapIndexForGID: GID " << gid << " is not contained by a map in mapextractor.");
483 return 0;
484}
485
486template <class LocalOrdinal, class GlobalOrdinal, class Node>
487std::string
489 description() const {
490 return std::string("BlockedMap");
491}
492
493template <class LocalOrdinal, class GlobalOrdinal, class Node>
495 describe(Teuchos::FancyOStream& out, const Teuchos::EVerbosityLevel verbLevel) const {
496 out << "------------- Blocked Map -----------" << std::endl;
497 out << description() << std::endl;
498 out << "Thyra mode: " << getThyraMode() << std::endl;
499 out << "No of submaps: " << getNumMaps() << std::endl;
500 Teuchos::OSTab tab(out);
501 for (size_t r = 0; r < getNumMaps(); r++) {
502 std::cout << "MAP " << r << "/" << getNumMaps() - 1 << std::endl;
503 getMap(r, false)->describe(out, verbLevel);
504 }
505 if (getThyraMode() == true) {
506 for (size_t r = 0; r < getNumMaps(); r++) {
507 std::cout << "Thyra MAP " << r << "/" << getNumMaps() - 1 << std::endl;
508 getMap(r, true)->describe(out, verbLevel);
509 }
510 }
511 out << "-------------------------------------" << std::endl;
512}
513
514template <class LocalOrdinal, class GlobalOrdinal, class Node>
516 assign(const BlockedMap& input) {
517 // TODO check implementation, simplify copy constructor
518 bThyraMode_ = input.getThyraMode();
519
521
522 maps_.resize(input.getNumMaps(), Teuchos::null);
523 if (bThyraMode_ == true)
524 thyraMaps_.resize(input.getNumMaps(), Teuchos::null);
525 for (size_t i = 0; i < input.getNumMaps(); ++i) {
527 if (bThyraMode_ == true)
529 }
530
531 // plausibility check
532 size_t numAllElements = 0;
533 for (size_t v = 0; v < maps_.size(); ++v) {
534 numAllElements += maps_[v]->getGlobalNumElements();
535 }
537 fullmap_->getGlobalNumElements() != numAllElements,
538 std::logic_error,
539 "logic error. full map and sub maps have not same number of elements. This cannot be. Please report the bug to the Xpetra developers!");
540
541 // build importers for sub maps
542 importers_.resize(maps_.size());
543 for (unsigned i = 0; i < maps_.size(); ++i)
544 if (maps_[i] != null)
545 importers_[i] = Xpetra::ImportFactory<LocalOrdinal, GlobalOrdinal, Node>::Build(fullmap_, maps_[i]);
547 CheckConsistency() == false, std::logic_error, "logic error. full map and sub maps are inconsistently distributed over the processors.");
548}
549
550template <class LocalOrdinal, class GlobalOrdinal, class Node>
554 // merge submaps to global map
555 std::vector<GlobalOrdinal> gids;
556 for (size_t tt = 0; tt < subMaps.size(); ++tt) {
558
559#if 1 // WCMCLEN : IS THIS NECESSARY TO HANG ONTO?
560 Teuchos::ArrayView<const GlobalOrdinal> subMapGids = subMap->getLocalElementList();
561 gids.insert(gids.end(), subMapGids.begin(), subMapGids.end());
562#else
563 size_t myNumElements = subMap->getLocalNumElements();
564 for (LocalOrdinal l = 0; l < Teuchos::as<LocalOrdinal>(myNumElements); ++l) {
565 GlobalOrdinal gid = subMap->getGlobalElement(l);
566 gids.push_back(gid);
567 }
568#endif
569 }
570
571 const GlobalOrdinal INVALID = Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid();
572 // std::sort(gids.begin(), gids.end());
573 // gids.erase(std::unique(gids.begin(), gids.end()), gids.end());
574 Teuchos::ArrayView<GlobalOrdinal> gidsView(&gids[0], gids.size());
575
577 Build(subMaps[0]->lib(), INVALID, gidsView, subMaps[0]->getIndexBase(), subMaps[0]->getComm());
578
579 return fullMap;
580}
581
582template <class LocalOrdinal, class GlobalOrdinal, class Node>
584 CheckConsistency() const {
585 const RCP<const Map> fullMap = getFullMap();
586
587 for (size_t i = 0; i < getNumMaps(); i++) {
588 const RCP<const Map> map = getMap(i);
589
590 ArrayView<const GlobalOrdinal> mapGids = map->getLocalElementList();
591 for (typename ArrayView<const GlobalOrdinal>::const_iterator it = mapGids.begin(); it != mapGids.end(); it++) {
592 if (fullMap->isNodeGlobalElement(*it) == false) {
593 return false; // Global ID (*it) not found locally on this proc in fullMap -> error
594 }
595 }
596 }
597 return true;
598}
599
600} // namespace Xpetra
601#endif /* PACKAGES_XPETRA_SUP_BLOCKEDMAP_XPETRA_BLOCKEDMAP_DECL_HPP_ */
#define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
GlobalOrdinal GO
iterator end() const
iterator begin() const
const_pointer const_iterator
bool is_null() const
virtual GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
virtual global_size_t getGlobalNumElements() const
The number of elements in this Map.
virtual GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
BlockedMap< LocalOrdinal, GlobalOrdinal, Node > & operator=(const BlockedMap &rhs)
Assignment operator: Does a deep copy.
virtual GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
virtual GlobalOrdinal getIndexBase() const
The index base for this Map.
virtual bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is valid for this Map on this process.
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
const RCP< Xpetra::Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter(size_t i) const
get the importer between full map and partial map
static Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > concatenateMaps(const std::vector< Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > > &subMaps)
Helper function to concatenate several maps.
virtual Teuchos::ArrayView< const GlobalOrdinal > getLocalElementList() const
Return a view of the global indices owned by this process.
virtual GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
virtual bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
size_t getMapIndexForGID(GlobalOrdinal gid) const
returns map index in map extractor which contains GID
virtual bool isSameAs(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
virtual bool isCompatible(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
const RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getFullMap() const
the full map
virtual global_indices_array_device_type getMyGlobalIndicesDevice() const
Return a view of the global indices owned by this process.
size_t getNumMaps() const
number of partial maps
virtual GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
virtual LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
virtual bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on this process.
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
virtual ~BlockedMap()
Destructor.
virtual bool getThyraMode() const
Local number of rows on the calling process.
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &) const
Replace this Map's communicator with a subset communicator.
virtual bool isContiguous() const
True if this Map is distributed contiguously, else false.
virtual UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
virtual LocalOrdinal getMinLocalIndex() const
The minimum local index.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
virtual LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
virtual std::string description() const
A simple one-line description of this object.
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
virtual size_t getLocalNumElements() const
The number of elements belonging to the calling process.
virtual void assign(const BlockedMap &input)
Implementation of the assignment operator (operator=); does a deep copy.
virtual LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &, const Teuchos::ArrayView< int > &, const Teuchos::ArrayView< LocalOrdinal > &) const
Return the process ranks and corresponding local indices for the given global indices.
Exception throws to report errors in the internal logical of the program.
static RCP< Import< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &source, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &target, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying the number of non-zeros for all rows.
static Teuchos::RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=Xpetra::GloballyDistributed)
Map constructor with Xpetra-defined contiguous uniform distribution.
Kokkos::View< const global_ordinal_type *, typename Node::device_type > global_indices_array_device_type
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
size_t global_size_t
Global size_t object.