Xpetra_BlockedMap.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Tobias Wiesner (tawiesn@sandia.gov)
42 // Ray Tuminaro (rstumin@sandia.gov)
43 //
44 // ***********************************************************************
45 //
46 // @HEADER
47 #ifndef PACKAGES_XPETRA_SUP_BLOCKEDMAP_XPETRA_BLOCKEDMAP_HPP_
48 #define PACKAGES_XPETRA_SUP_BLOCKEDMAP_XPETRA_BLOCKEDMAP_HPP_
49 
50 #include "Xpetra_ConfigDefs.hpp"
51 #include "Xpetra_Map.hpp"
52 //#include "Xpetra_MapFactory.hpp"
53 #include "Xpetra_ImportFactory.hpp"
54 //#include "Xpetra_MapUtils.hpp"
55 
56 namespace Xpetra {
57 
58 #ifndef DOXYGEN_SHOULD_SKIP_THIS
59  // forward declaration of Vector, needed to prevent circular inclusions
60 // template<class S, class LO, class GO, class N> class Vector;
61  template<class LO, class GO, class N> class MapFactory;
62 #endif
63 
64  template <class LocalOrdinal = Map<>::local_ordinal_type,
65  class GlobalOrdinal = typename Map<LocalOrdinal>::global_ordinal_type,
66  class Node = typename Map<LocalOrdinal, GlobalOrdinal>::node_type>
67  class BlockedMap
68  : public Map< LocalOrdinal, GlobalOrdinal, Node >
69  {
70  public:
71  typedef LocalOrdinal local_ordinal_type;
72  typedef GlobalOrdinal global_ordinal_type;
73  typedef Node node_type;
74 
75  private:
76 #undef XPETRA_BLOCKEDMAP_SHORT
78 
79  public:
81 
82 
84 
87  bThyraMode_ = false;
88  }
89 
102  BlockedMap(const RCP<const Map>& fullmap, const std::vector<RCP<const Map> >& maps, bool bThyraMode = false) {
103  bThyraMode_ = bThyraMode;
104 
105  if(bThyraMode == false) {
106  // use Xpetra-style numbering for sub-block maps
107  // That is, all sub-block maps have unique GIDs which may not be contiguous and start with GIDs different than zero.
108 
109  // plausibility check
110  size_t numAllElements = 0;
111  for(size_t v = 0; v < maps.size(); ++v) {
112  numAllElements += maps[v]->getGlobalNumElements();
113  }
114  TEUCHOS_TEST_FOR_EXCEPTION(fullmap->getGlobalNumElements() != numAllElements, std::logic_error,
115  "logic error. full map and sub maps have not same number of elements (" << fullmap->getGlobalNumElements() <<" versus " << numAllElements << "). We cannot build MapExtractor with Xpetra-style numbering. Please make sure that you want Xpetra-style numbering instead of Thyra-style numbering.");
116 
117  fullmap_ = fullmap;
118  maps_ = maps;
119  } else {
120  //std::cout << "Create Map Extractor in Thyra Mode!!! " << std::endl;
121  // use Thyra-style numbering for sub-block maps
122  // That is, all sub-block maps start with zero as GID and are contiguous
123 
124  // plausibility check
125  for(size_t v = 0; v < maps.size(); ++v) {
126  TEUCHOS_TEST_FOR_EXCEPTION(maps[v]->getMinAllGlobalIndex() != 0, std::logic_error,
127  "logic error. When using Thyra-style numbering all sub-block maps must start with zero as GID. Map block " << v << " starts with GID " << maps[v]->getMinAllGlobalIndex());
128  }
129 
130  // store submaps in Thyra-style ordering
131  thyraMaps_ = maps;
132 
133  // get offsets
134  std::vector<GlobalOrdinal> gidOffsets(maps.size(),0);
135  for(size_t v = 1; v < maps.size(); ++v) {
136  gidOffsets[v] = maps[v-1]->getMaxAllGlobalIndex() + gidOffsets[v-1] + 1;
137  }
138 
139  // build submaps
140  maps_.resize(maps.size());
141  std::vector<GlobalOrdinal> fullMapGids;
143  for(size_t v = 0; v < maps.size(); ++v) {
144  size_t myNumElements = maps[v]->getNodeNumElements();
145  std::vector<GlobalOrdinal> subMapGids(myNumElements,0);
146  for (LocalOrdinal l = 0; l < Teuchos::as<LocalOrdinal>(myNumElements); ++l) {
147  GlobalOrdinal myGid = maps[v]->getGlobalElement(l);
148  subMapGids[l] = myGid + gidOffsets[v];
149  fullMapGids.push_back(myGid + gidOffsets[v]);
150  }
151  //std::sort(subMapGids.begin(), subMapGids.end());
152  //subMapGids.erase(std::unique(subMapGids.begin(), subMapGids.end()), subMapGids.end());
153 
154  Teuchos::ArrayView<GlobalOrdinal> subMapGidsView(&subMapGids[0], subMapGids.size());
155  Teuchos::RCP<Map> mySubMap = Xpetra::MapFactory<LocalOrdinal,GlobalOrdinal,Node>::Build(maps[v]->lib(), INVALID, subMapGidsView, maps[v]->getIndexBase(), maps[v]->getComm());
156  maps_[v] = mySubMap;
157  }
158 
159  //const GO INVALID = Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid();
160  //std::sort(coarseMapGids.begin(), coarseMapGids.end());
161  //coarseMapGids.erase(std::unique(coarseMapGids.begin(), coarseMapGids.end()), coarseMapGids.end());
162  //Teuchos::ArrayView<GO> coarseMapGidsView(&coarseMapGids[0], coarseMapGids.size());
163  //std::sort(fullMapGids.begin(), fullMapGids.end());
164  //fullMapGids.erase(std::unique(fullMapGids.begin(), fullMapGids.end()), fullMapGids.end());
165 
166  Teuchos::ArrayView<GlobalOrdinal> fullMapGidsView(&fullMapGids[0], fullMapGids.size());
167  fullmap_ = Xpetra::MapFactory<LocalOrdinal,GlobalOrdinal,Node>::Build(fullmap->lib(), INVALID, fullMapGidsView, fullmap->getIndexBase(), fullmap->getComm());
168 
169  // plausibility check
170  size_t numAllElements = 0;
171  for(size_t v = 0; v < maps_.size(); ++v) {
172  numAllElements += maps_[v]->getGlobalNumElements();
173  }
174  TEUCHOS_TEST_FOR_EXCEPTION(fullmap_->getGlobalNumElements() != numAllElements, std::logic_error,
175  "logic error. full map and sub maps have not same number of elements. This cannot be. Please report the bug to the Xpetra developers!");
176  }
177 
178  // build importers for sub maps
179  importers_.resize(maps_.size());
180  for (unsigned i = 0; i < maps_.size(); ++i)
181  if (maps[i] != null)
183  TEUCHOS_TEST_FOR_EXCEPTION(CheckConsistency() == false, std::logic_error,
184  "logic error. full map and sub maps are inconsistently distributed over the processors.");
185 
186  }
187 
189  BlockedMap(const std::vector<RCP<const Map> >& maps, const std::vector<RCP<const Map> >& thyramaps) {
190  bThyraMode_ = true;
191 
192  // plausibility check
193  TEUCHOS_TEST_FOR_EXCEPTION(thyramaps.size() != maps.size(), std::logic_error, "logic error. The number of submaps must be identical!");
194  for(size_t v = 0; v < thyramaps.size(); ++v) {
195  TEUCHOS_TEST_FOR_EXCEPTION(thyramaps[v]->getMinAllGlobalIndex() != 0, std::logic_error,
196  "logic error. When using Thyra-style numbering all sub-block maps must start with zero as GID.");
197  XPETRA_TEST_FOR_EXCEPTION(thyramaps[v]->getNodeNumElements() != maps[v]->getNodeNumElements(), std::logic_error,
198  "logic error. The size of the submaps must be identical (same distribution, just different GIDs)");
199  }
200 
201  // store user-provided maps and thyramaps
202  thyraMaps_ = thyramaps;
203  maps_ = maps;
204 
205  fullmap_ = this->concatenateMaps(maps);
206 
207  // plausibility check
208  size_t numAllElements = 0;
209  for(size_t v = 0; v < maps_.size(); ++v) {
210  numAllElements += maps_[v]->getGlobalNumElements();
211  }
212  TEUCHOS_TEST_FOR_EXCEPTION(fullmap_->getGlobalNumElements() != numAllElements, std::logic_error,
213  "logic error. full map and sub maps have not same number of elements. This cannot be. Please report the bug to the Xpetra developers!");
214 
215  // build importers for sub maps
216  importers_.resize(maps_.size());
217  for (unsigned i = 0; i < maps_.size(); ++i)
218  if (maps[i] != null)
220  TEUCHOS_TEST_FOR_EXCEPTION(CheckConsistency() == false, std::logic_error,
221  "logic error. full map and sub maps are inconsistently distributed over the processors.");
222  }
223 
225  BlockedMap(const BlockedMap& input) {
226  bThyraMode_ = input.getThyraMode();
227  fullmap_ = Teuchos::null;
228  maps_.resize(input.getNumMaps(), Teuchos::null);
229  thyraMaps_.resize(input.getNumMaps(), Teuchos::null);
230  this->assign(input);
231  }
232 
234  virtual ~BlockedMap() {
235 
236  // make sure all RCP's are freed
237  for(size_t v = 0; v < maps_.size(); ++v) {
238  maps_[v] = Teuchos::null;
239  if(bThyraMode_ == true)
240  thyraMaps_[v] = Teuchos::null;
241  importers_[v] = Teuchos::null;
242  }
243 
244  fullmap_ = Teuchos::null;
245  }
246 
248 
249 
251  virtual global_size_t getGlobalNumElements() const { return fullmap_->getGlobalNumElements(); };
252 
254  virtual size_t getNodeNumElements() const { return fullmap_->getNodeNumElements(); };
255 
257  virtual GlobalOrdinal getIndexBase() const { return fullmap_->getIndexBase(); };
258 
260  virtual LocalOrdinal getMinLocalIndex() const { return fullmap_->getMinLocalIndex(); };
261 
263  virtual LocalOrdinal getMaxLocalIndex() const { return fullmap_->getMaxLocalIndex(); };
264 
266  virtual GlobalOrdinal getMinGlobalIndex() const { return fullmap_->getMinGlobalIndex(); };
267 
269  virtual GlobalOrdinal getMaxGlobalIndex() const { return fullmap_->getMaxGlobalIndex(); };
270 
272  virtual GlobalOrdinal getMinAllGlobalIndex() const { return fullmap_->getMinAllGlobalIndex(); };
273 
275  virtual GlobalOrdinal getMaxAllGlobalIndex() const { return fullmap_->getMaxAllGlobalIndex(); };
276 
278  virtual LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { return fullmap_->getLocalElement(globalIndex); };
279 
281  virtual GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { return fullmap_->getGlobalElement(localIndex); };
282 
285  throw Xpetra::Exceptions::RuntimeError("BlockedMap::getRemoteIndexList: routine not implemented.");
287  };
288 
291  throw Xpetra::Exceptions::RuntimeError("BlockedMap::getRemoteIndexList: routine not implemented.");
293  };
294 
297  return fullmap_->getNodeElementList();
298  };
299 
301 
303 
304 
306  virtual bool isNodeLocalElement(LocalOrdinal localIndex) const {return fullmap_->isNodeLocalElement(localIndex);};
307 
309  virtual bool isNodeGlobalElement(GlobalOrdinal globalIndex) const {return fullmap_->isNodeGlobalElement(globalIndex);};
310 
312  virtual bool isContiguous() const {
313  throw Xpetra::Exceptions::RuntimeError("BlockedMap::isContiguous: routine not implemented.");
315  };
316 
318  virtual bool isDistributed() const {return fullmap_->isDistributed();};
319 
322  RCP<const Map> rcpMap = Teuchos::rcpFromRef(map);
323  RCP<const BlockedMap> rcpBMap = Teuchos::rcp_dynamic_cast<const BlockedMap>(rcpMap);
324  if(rcpBMap.is_null() == true) return false;
325 
326  for(size_t v = 0; v < maps_.size(); ++v) {
327  bool bSame = getMap(v,false)->isCompatible(*(rcpBMap->getMap(v,false)));
328  if (bSame == false) return false;
329  if (bThyraMode_) {
330  bSame = getMap(v,true)->isCompatible(*(rcpBMap->getMap(v,true)));
331  }
332  }
333  return true;
334  };
335 
338  RCP<const Map> rcpMap = Teuchos::rcpFromRef(map);
339  RCP<const BlockedMap> rcpBMap = Teuchos::rcp_dynamic_cast<const BlockedMap>(rcpMap);
340  if(rcpBMap.is_null() == true) {
341  // If this is a blocked map with > 1 blocks but "map" is a plain map they can't be the same
342  if (this->getNumMaps() > 1)
343  return false;
344  // special case: this is a single blocked map and "map" is a plain map object
345  bool bSame = getMap(0,bThyraMode_)->isSameAs(*rcpMap);
346  return bSame;
347  }
348 
349  for(size_t v = 0; v < maps_.size(); ++v) {
350  bool bSame = getMap(v,false)->isSameAs(*(rcpBMap->getMap(v,false)));
351  if (bSame == false) return false;
352  if (bThyraMode_) {
353  bSame = getMap(v,true)->isSameAs(*(rcpBMap->getMap(v,true)));
354  if (bSame == false) return false;
355  }
356  }
357  return true;
358  };
359 
361 
363 
364 
366  virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { return fullmap_->getComm(); } ;
367 
369  virtual Teuchos::RCP< Node > getNode() const { return fullmap_->getNode();};
370 
372 
381  operator= (const BlockedMap& rhs) {
382  assign (rhs); // dispatch to protected virtual method
383  return *this;
384  }
385 
387 
389 
390  /*virtual size_t getLocalLength() const {
392  throw Xpetra::Exceptions::RuntimeError("BlockedMap::getLocalLength: routine not implemented.");
393  return 0;
394  }*/
395 
397  /*virtual global_size_t getGlobalLength() const {
398  throw Xpetra::Exceptions::RuntimeError("BlockedMap::getGlobalLength: routine not implemented.");
399  return 0;
400  }*/
401 
403  virtual bool getThyraMode() const {
404  return bThyraMode_;
405  }
407 
410 
413  throw Xpetra::Exceptions::RuntimeError("BlockedMap::removeEmptyProcesses: routine not implemented.");
414  }
415 
416 
419  throw Xpetra::Exceptions::RuntimeError("BlockedMap::replaceCommWithSubset: routine not implemented.");
420  }
421 
423 
425 
426 
428  virtual UnderlyingLib lib() const { return fullmap_->lib(); } ;
429 
430  // TODO: find a better solution for this hack
431  // The problem is that EpetraMap, TpetraMap and StridedMap all inherit Map. To have proper toEpetra() we
432  // need to understand the type of underlying matrix. But in src/Map we have no knowledge of StridedMaps, so
433  // we cannot check for it by casting. This function allows us to avoid the restriction, as StridedMap redefines
434  // it to return the base map.
436 
438 
439 
441  size_t getNumMaps() const { return maps_.size(); }
442 
447  const RCP<const Map> getMap(size_t i, bool bThyraMode = false) const {
448  XPETRA_TEST_FOR_EXCEPTION( i >= getNumMaps(), Xpetra::Exceptions::RuntimeError, "BlockedMap::getMap: tried to access block " << i << ", but BlockedMap has only " << getNumMaps() << " blocks! Block indices must be between 0 and " << getNumMaps() - 1 << ".");
449  if(bThyraMode_ == true && bThyraMode == true)
450  return thyraMaps_[i];
452  "BlockedMap::getMap: cannot return sub map in Thyra-style numbering if BlockedMap object is not created using Thyra-style numbered submaps.");
453  return maps_[i];
454  }
455 
457  const RCP<Import> getImporter(size_t i) const {
458  XPETRA_TEST_FOR_EXCEPTION( i >= getNumMaps(), Xpetra::Exceptions::RuntimeError, "BlockedMap::getImporter: tried to access block " << i << ", but BlockedMap has only " << getNumMaps() << " blocks! Block indices must be between 0 and " << getNumMaps() - 1 << ".");
459  return importers_[i];
460  }
461 
463  const RCP<const Map> getFullMap() const { return fullmap_; }
464 
466  size_t getMapIndexForGID(GlobalOrdinal gid) const {
467  for (size_t i = 0; i < getNumMaps(); i++)
468  if (getMap(i)->isNodeGlobalElement(gid) == true)
469  return i;
470 
472  "getMapIndexForGID: GID " << gid << " is not contained by a map in mapextractor." );
473  return 0;
474  }
475 
476 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
477 #ifdef HAVE_XPETRA_TPETRA
480  local_map_type getLocalMap () const {
481  return fullmap_->getLocalMap();
482  }
483 #else
484 #ifdef __GNUC__
485 #warning "Xpetra Kokkos interface for CrsMatrix is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
486 #endif
487 #endif
488 #endif
489 
491 
493 
494 
496  virtual std::string description() const {
497  return std::string("BlockedMap");
498  }
499 
502  out << "------------- Blocked Map -----------" << std::endl;
503  out << description() << std::endl;
504  out << "Thyra mode: " << getThyraMode() << std::endl;
505  out << "No of submaps: " << getNumMaps() << std::endl;
506  Teuchos::OSTab tab(out);
507  for(size_t r = 0; r < getNumMaps(); r++) {
508  std::cout << "MAP " << r << "/" << getNumMaps() - 1 << std::endl;
509  getMap(r,false)->describe(out, verbLevel);
510  }
511  if(getThyraMode() == true) {
512  for(size_t r = 0; r < getNumMaps(); r++) {
513  std::cout << "Thyra MAP " << r << "/" << getNumMaps() - 1 << std::endl;
514  getMap(r,true)->describe(out, verbLevel);
515  }
516  }
517  out << "-------------------------------------" << std::endl;
518  }
519 
520 
522 
523 
524  protected:
527  virtual void assign (const BlockedMap& input) {
528  // TODO check implementation, simplify copy constructor
529  bThyraMode_ = input.getThyraMode();
530 
532 
533  maps_.resize(input.getNumMaps(), Teuchos::null);
534  if(bThyraMode_ == true)
535  thyraMaps_.resize(input.getNumMaps(), Teuchos::null);
536  for(size_t i = 0; i < input.getNumMaps(); ++i) {
538  if(bThyraMode_ == true)
540  }
541 
542  // plausibility check
543  size_t numAllElements = 0;
544  for(size_t v = 0; v < maps_.size(); ++v) {
545  numAllElements += maps_[v]->getGlobalNumElements();
546  }
547  TEUCHOS_TEST_FOR_EXCEPTION(fullmap_->getGlobalNumElements() != numAllElements, std::logic_error,
548  "logic error. full map and sub maps have not same number of elements. This cannot be. Please report the bug to the Xpetra developers!");
549 
550  // build importers for sub maps
551  importers_.resize(maps_.size());
552  for (unsigned i = 0; i < maps_.size(); ++i)
553  if (maps_[i] != null)
555  TEUCHOS_TEST_FOR_EXCEPTION(CheckConsistency() == false, std::logic_error,
556  "logic error. full map and sub maps are inconsistently distributed over the processors.");
557  }
558 
574 
575  // merge submaps to global map
576  std::vector<GlobalOrdinal> gids;
577  for(size_t tt = 0; tt<subMaps.size(); ++tt) {
579 #if 1
580  Teuchos::ArrayView< const GlobalOrdinal > subMapGids = subMap->getNodeElementList();
581  gids.insert(gids.end(), subMapGids.begin(), subMapGids.end());
582 #else
583  size_t myNumElements = subMap->getNodeNumElements();
584  for(LocalOrdinal l = 0; l < Teuchos::as<LocalOrdinal>(myNumElements); ++l) {
585  GlobalOrdinal gid = subMap->getGlobalElement(l);
586  gids.push_back(gid);
587  }
588 #endif
589  }
590 
591  const GlobalOrdinal INVALID = Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid();
592  //std::sort(gids.begin(), gids.end());
593  //gids.erase(std::unique(gids.begin(), gids.end()), gids.end());
594  Teuchos::ArrayView<GlobalOrdinal> gidsView(&gids[0], gids.size());
596  return fullMap;
597  }
598 
599  private:
600  bool CheckConsistency() const {
601  const RCP<const Map> fullMap = getFullMap();
602 
603  for (size_t i = 0; i < getNumMaps(); i++) {
604  const RCP<const Map> map = getMap(i);
605 
606  ArrayView<const GlobalOrdinal> mapGids = map->getNodeElementList();
607  for (typename ArrayView< const GlobalOrdinal >::const_iterator it = mapGids.begin(); it != mapGids.end(); it++)
608  if (fullMap->isNodeGlobalElement(*it) == false)
609  return false; // Global ID (*it) not found locally on this proc in fullMap -> error
610  }
611  return true;
612  }
613 
614  private:
616  std::vector<RCP<const Map> > maps_;
617  std::vector<RCP<Import > > importers_;
618  bool bThyraMode_; //< boolean flag: use Thyra numbering for local sub-block maps. default = false (for Xpetra mode)
619  std::vector<RCP<const Map> > thyraMaps_; //< store Thyra-style numbering maps here in Thyra mode. In Xpetra mode this vector is empty.
620  }; // BlockedMap class
621 
622 } // Xpetra namespace
623 
624 #define XPETRA_BLOCKEDMAP_SHORT
625 
626 #endif /* PACKAGES_XPETRA_SUP_BLOCKEDMAP_XPETRA_BLOCKEDMAP_HPP_ */
Xpetra::BlockedMap::replaceCommWithSubset
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map's communicator with a subset communicator.
Definition: Xpetra_BlockedMap.hpp:418
Xpetra::BlockedMap::CheckConsistency
bool CheckConsistency() const
Definition: Xpetra_BlockedMap.hpp:600
Xpetra::BlockedMap::local_ordinal_type
LocalOrdinal local_ordinal_type
Definition: Xpetra_BlockedMap.hpp:71
Xpetra::BlockedMap::getMinGlobalIndex
virtual GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Definition: Xpetra_BlockedMap.hpp:266
Xpetra::BlockedMap::getMaxGlobalIndex
virtual GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
Definition: Xpetra_BlockedMap.hpp:269
Xpetra
Xpetra namespace
Definition: Xpetra_BlockedCrsMatrix.hpp:86
Xpetra::BlockedMap::getLocalElement
virtual LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
Definition: Xpetra_BlockedMap.hpp:278
Xpetra::BlockedMap::~BlockedMap
virtual ~BlockedMap()
Destructor.
Definition: Xpetra_BlockedMap.hpp:234
Xpetra::global_size_t
size_t global_size_t
Global size_t object.
Definition: Xpetra_ConfigDefs.hpp:170
Xpetra::BlockedMap::removeEmptyProcesses
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
Definition: Xpetra_BlockedMap.hpp:412
Xpetra_ImportFactory.hpp
Xpetra::BlockedMap::BlockedMap
BlockedMap(const RCP< const Map > &fullmap, const std::vector< RCP< const Map > > &maps, bool bThyraMode=false)
Definition: Xpetra_BlockedMap.hpp:102
Xpetra::BlockedMap::global_ordinal_type
GlobalOrdinal global_ordinal_type
Definition: Xpetra_BlockedMap.hpp:72
Xpetra::BlockedMap::getMinLocalIndex
virtual LocalOrdinal getMinLocalIndex() const
The minimum local index.
Definition: Xpetra_BlockedMap.hpp:260
Xpetra::BlockedMap::getNodeElementList
virtual Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.
Definition: Xpetra_BlockedMap.hpp:296
Xpetra::BlockedMap::getMap
const RCP< const Map > getMap(size_t i, bool bThyraMode=false) const
Definition: Xpetra_BlockedMap.hpp:447
Xpetra::ImportFactory::Build
static RCP< Import< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &source, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &target)
Constructor specifying the number of non-zeros for all rows.
Definition: Xpetra_ImportFactory.hpp:75
XPETRA_TEST_FOR_EXCEPTION
#define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Definition: Xpetra_ConfigDefs.hpp:139
Xpetra::BlockedMap::isNodeLocalElement
virtual bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on this process.
Definition: Xpetra_BlockedMap.hpp:306
Xpetra::BlockedMap::getIndexBase
virtual GlobalOrdinal getIndexBase() const
The index base for this Map.
Definition: Xpetra_BlockedMap.hpp:257
Xpetra::BlockedMap::operator=
BlockedMap< LocalOrdinal, GlobalOrdinal, Node > & operator=(const BlockedMap &rhs)
Assignment operator: Does a deep copy.
Definition: Xpetra_BlockedMap.hpp:381
Xpetra::BlockedMap::isContiguous
virtual bool isContiguous() const
True if this Map is distributed contiguously, else false.
Definition: Xpetra_BlockedMap.hpp:312
Xpetra::BlockedMap::getComm
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
Definition: Xpetra_BlockedMap.hpp:366
Xpetra::BlockedMap::getNode
virtual Teuchos::RCP< Node > getNode() const
Get this Map's Node object.
Definition: Xpetra_BlockedMap.hpp:369
Xpetra::BlockedMap::getNodeNumElements
virtual size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Definition: Xpetra_BlockedMap.hpp:254
Teuchos::EVerbosityLevel
EVerbosityLevel
Xpetra::BlockedMap::describe
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.
Definition: Xpetra_BlockedMap.hpp:501
Xpetra::BlockedMap::BlockedMap
BlockedMap()
Constructor.
Definition: Xpetra_BlockedMap.hpp:86
Xpetra::BlockedMap::thyraMaps_
std::vector< RCP< const Map > > thyraMaps_
Definition: Xpetra_BlockedMap.hpp:619
Xpetra::BlockedMap::getImporter
const RCP< Import > getImporter(size_t i) const
get the importer between full map and partial map
Definition: Xpetra_BlockedMap.hpp:457
Teuchos::ArrayView
Xpetra::Map
Definition: Xpetra_Map.hpp:90
Teuchos::RCP
Teuchos::ArrayView::begin
iterator begin() const
Xpetra::BlockedMap::importers_
std::vector< RCP< Import > > importers_
Definition: Xpetra_BlockedMap.hpp:617
Xpetra::BlockedMap::getFullMap
const RCP< const Map > getFullMap() const
the full map
Definition: Xpetra_BlockedMap.hpp:463
Xpetra::BlockedMap::getNumMaps
size_t getNumMaps() const
number of partial maps
Definition: Xpetra_BlockedMap.hpp:441
Xpetra::BlockedMap::getThyraMode
virtual bool getThyraMode() const
Local number of rows on the calling process.
Definition: Xpetra_BlockedMap.hpp:403
Teuchos::ArrayView::const_iterator
const_pointer const_iterator
Xpetra::BlockedMap::BlockedMap
BlockedMap(const BlockedMap &input)
copy constructor
Definition: Xpetra_BlockedMap.hpp:225
Xpetra::MapFactory::Build
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, const Teuchos::RCP< Node > &=Teuchos::null)
Map constructor with Xpetra-defined contiguous uniform distribution.
Definition: Xpetra_MapFactory.hpp:81
Xpetra::Exceptions::RuntimeError
Exception throws to report errors in the internal logical of the program.
Definition: Xpetra_Exceptions.hpp:101
Teuchos::basic_FancyOStream
Xpetra::BlockedMap::getMinAllGlobalIndex
virtual GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
Definition: Xpetra_BlockedMap.hpp:272
Xpetra::BlockedMap::isCompatible
virtual bool isCompatible(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
Definition: Xpetra_BlockedMap.hpp:321
Xpetra::BlockedMap::getRemoteIndexList
virtual LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const
Return the process ranks and corresponding local indices for the given global indices.
Definition: Xpetra_BlockedMap.hpp:284
Xpetra::BlockedMap::getGlobalNumElements
virtual global_size_t getGlobalNumElements() const
The number of elements in this Map.
Definition: Xpetra_BlockedMap.hpp:251
Xpetra::BlockedMap::isSameAs
virtual bool isSameAs(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
Definition: Xpetra_BlockedMap.hpp:337
Xpetra::BlockedMap::getMapIndexForGID
size_t getMapIndexForGID(GlobalOrdinal gid) const
returns map index in map extractor which contains GID
Definition: Xpetra_BlockedMap.hpp:466
Xpetra_ConfigDefs.hpp
Teuchos::RCP::is_null
bool is_null() const
Xpetra_UseShortNamesOrdinal.hpp
Xpetra::Map::global_ordinal_type
GlobalOrdinal global_ordinal_type
Definition: Xpetra_Map.hpp:95
Xpetra::BlockedMap::getMaxAllGlobalIndex
virtual GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
Definition: Xpetra_BlockedMap.hpp:275
Teuchos::ArrayView::end
iterator end() const
Xpetra::BlockedMap::isNodeGlobalElement
virtual bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is valid for this Map on this process.
Definition: Xpetra_BlockedMap.hpp:309
Xpetra::BlockedMap::getMap
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Definition: Xpetra_BlockedMap.hpp:435
Xpetra::BlockedMap::assign
virtual void assign(const BlockedMap &input)
Implementation of the assignment operator (operator=); does a deep copy.
Definition: Xpetra_BlockedMap.hpp:527
Xpetra::BlockedMap::isDistributed
virtual bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
Definition: Xpetra_BlockedMap.hpp:318
Xpetra::BlockedMap::maps_
std::vector< RCP< const Map > > maps_
Definition: Xpetra_BlockedMap.hpp:616
Xpetra::UnderlyingLib
UnderlyingLib
Definition: Xpetra_Map.hpp:81
Xpetra::BlockedMap::bThyraMode_
bool bThyraMode_
Definition: Xpetra_BlockedMap.hpp:618
Xpetra::BlockedMap::getMaxLocalIndex
virtual LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
Definition: Xpetra_BlockedMap.hpp:263
Teuchos::basic_OSTab
GO
GlobalOrdinal GO
Definition: Xpetra_UseShortNamesOrdinal.hpp:139
Xpetra::BlockedMap::getRemoteIndexList
virtual LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process ranks for the given global indices.
Definition: Xpetra_BlockedMap.hpp:290
Xpetra::BlockedMap::fullmap_
RCP< const Map > fullmap_
Definition: Xpetra_BlockedMap.hpp:615
Teuchos::OrdinalTraits::invalid
static T invalid()
Teuchos::Comm
Xpetra::Map::node_type
Node node_type
Definition: Xpetra_Map.hpp:96
Xpetra::BlockedMap::BlockedMap
BlockedMap(const std::vector< RCP< const Map > > &maps, const std::vector< RCP< const Map > > &thyramaps)
Expert constructor for Thyra maps.
Definition: Xpetra_BlockedMap.hpp:189
Xpetra::BlockedMap::concatenateMaps
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.
Definition: Xpetra_BlockedMap.hpp:573
Teuchos::Describable::verbLevel_default
static const EVerbosityLevel verbLevel_default
Xpetra::BlockedMap::lib
virtual UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
Definition: Xpetra_BlockedMap.hpp:428
TEUCHOS_TEST_FOR_EXCEPTION
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Xpetra::LookupStatus
LookupStatus
Definition: Xpetra_ConfigDefs.hpp:179
Xpetra::BlockedMap
Definition: Xpetra_BlockedMap.hpp:67
Xpetra::BlockedMap::node_type
Node node_type
Definition: Xpetra_BlockedMap.hpp:73
Xpetra::IDNotPresent
Definition: Xpetra_ConfigDefs.hpp:181
Xpetra::BlockedMap::getGlobalElement
virtual GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
Definition: Xpetra_BlockedMap.hpp:281
Xpetra_Map.hpp
Xpetra::BlockedMap::description
virtual std::string description() const
A simple one-line description of this object.
Definition: Xpetra_BlockedMap.hpp:496
TEUCHOS_UNREACHABLE_RETURN
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)