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. 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.");
286  return IDNotPresent;
287  };
288 
291  throw Xpetra::Exceptions::RuntimeError("BlockedMap::getRemoteIndexList: routine not implemented.");
292  return IDNotPresent;
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.");
314  return false;
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 
477 
479 
480 
482  virtual std::string description() const {
483  return std::string("BlockedMap");
484  }
485 
488  out << "------------- Blocked Map -----------" << std::endl;
489  out << description() << std::endl;
490  out << "Thyra mode: " << getThyraMode() << std::endl;
491  out << "No of submaps: " << getNumMaps() << std::endl;
492  Teuchos::OSTab tab(out);
493  for(size_t r = 0; r < getNumMaps(); r++) {
494  std::cout << "MAP " << r << "/" << getNumMaps() - 1 << std::endl;
495  getMap(r,false)->describe(out, verbLevel);
496  }
497  if(getThyraMode() == true) {
498  for(size_t r = 0; r < getNumMaps(); r++) {
499  std::cout << "Thyra MAP " << r << "/" << getNumMaps() - 1 << std::endl;
500  getMap(r,true)->describe(out, verbLevel);
501  }
502  }
503  out << "-------------------------------------" << std::endl;
504  }
505 
506 
508 
509 
510  protected:
513  virtual void assign (const BlockedMap& input) {
514  // TODO check implementation, simplify copy constructor
515  bThyraMode_ = input.getThyraMode();
516 
518 
519  maps_.resize(input.getNumMaps(), Teuchos::null);
520  if(bThyraMode_ == true)
521  thyraMaps_.resize(input.getNumMaps(), Teuchos::null);
522  for(size_t i = 0; i < input.getNumMaps(); ++i) {
524  if(bThyraMode_ == true)
526  }
527 
528  // plausibility check
529  size_t numAllElements = 0;
530  for(size_t v = 0; v < maps_.size(); ++v) {
531  numAllElements += maps_[v]->getGlobalNumElements();
532  }
533  TEUCHOS_TEST_FOR_EXCEPTION(fullmap_->getGlobalNumElements() != numAllElements, std::logic_error,
534  "logic error. full map and sub maps have not same number of elements. This cannot be. Please report the bug to the Xpetra developers!");
535 
536  // build importers for sub maps
537  importers_.resize(maps_.size());
538  for (unsigned i = 0; i < maps_.size(); ++i)
539  if (maps_[i] != null)
541  TEUCHOS_TEST_FOR_EXCEPTION(CheckConsistency() == false, std::logic_error,
542  "logic error. full map and sub maps are inconsistently distributed over the processors.");
543  }
544 
560 
561  // merge submaps to global map
562  std::vector<GlobalOrdinal> gids;
563  for(size_t tt = 0; tt<subMaps.size(); ++tt) {
565 #if 1
566  Teuchos::ArrayView< const GlobalOrdinal > subMapGids = subMap->getNodeElementList();
567  gids.insert(gids.end(), subMapGids.begin(), subMapGids.end());
568 #else
569  size_t myNumElements = subMap->getNodeNumElements();
570  for(LocalOrdinal l = 0; l < Teuchos::as<LocalOrdinal>(myNumElements); ++l) {
571  GlobalOrdinal gid = subMap->getGlobalElement(l);
572  gids.push_back(gid);
573  }
574 #endif
575  }
576 
577  const GlobalOrdinal INVALID = Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid();
578  //std::sort(gids.begin(), gids.end());
579  //gids.erase(std::unique(gids.begin(), gids.end()), gids.end());
580  Teuchos::ArrayView<GlobalOrdinal> gidsView(&gids[0], gids.size());
582  return fullMap;
583  }
584 
585  private:
586  bool CheckConsistency() const {
587  const RCP<const Map> fullMap = getFullMap();
588 
589  for (size_t i = 0; i < getNumMaps(); i++) {
590  const RCP<const Map> map = getMap(i);
591 
592  ArrayView<const GlobalOrdinal> mapGids = map->getNodeElementList();
593  for (typename ArrayView< const GlobalOrdinal >::const_iterator it = mapGids.begin(); it != mapGids.end(); it++)
594  if (fullMap->isNodeGlobalElement(*it) == false)
595  return false; // Global ID (*it) not found locally on this proc in fullMap -> error
596  }
597  return true;
598  }
599 
600  private:
602  std::vector<RCP<const Map> > maps_;
603  std::vector<RCP<Import > > importers_;
604  bool bThyraMode_; //< boolean flag: use Thyra numbering for local sub-block maps. default = false (for Xpetra mode)
605  std::vector<RCP<const Map> > thyraMaps_; //< store Thyra-style numbering maps here in Thyra mode. In Xpetra mode this vector is empty.
606  }; // BlockedMap class
607 
608 } // Xpetra namespace
609 
610 #define XPETRA_BLOCKEDMAP_SHORT
611 
612 #endif /* PACKAGES_XPETRA_SUP_BLOCKEDMAP_XPETRA_BLOCKEDMAP_HPP_ */
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 LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process ranks for the given global indices.
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.
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 > &node=defaultArgNode())
Map constructor with Xpetra-defined contiguous uniform distribution.
virtual size_t getNodeNumElements() const
The number of elements belonging to the calling process.
size_t getNumMaps() const
number of partial maps
GlobalOrdinal global_ordinal_type
Definition: Xpetra_Map.hpp:86
GlobalOrdinal GO
virtual bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
Node node_type
Definition: Xpetra_Map.hpp:87
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is valid for this Map on this process.
const_pointer const_iterator
size_t getMapIndexForGID(GlobalOrdinal gid) const
returns map index in map extractor which contains GID
Xpetra namespace
std::vector< RCP< const Map > > maps_
virtual GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Exception throws to report errors in the internal logical of the program.
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::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.
const RCP< const Map > getMap(size_t i, bool bThyraMode=false) const
bool is_null() const
virtual LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
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.
iterator begin() const
virtual GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
virtual Teuchos::RCP< Node > getNode() const
Get this Map&#39;s Node object.
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
BlockedMap(const std::vector< RCP< const Map > > &maps, const std::vector< RCP< const Map > > &thyramaps)
Expert constructor for Thyra maps.
RCP< const Map > fullmap_
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
virtual ~BlockedMap()
Destructor.
bool CheckConsistency() const
BlockedMap()
Constructor.
GlobalOrdinal global_ordinal_type
virtual bool getThyraMode() const
Local number of rows on the calling process.
virtual global_size_t getGlobalNumElements() const
The number of elements in this Map.
std::vector< RCP< Import > > importers_
virtual void assign(const BlockedMap &input)
Implementation of the assignment operator (operator=); does a deep copy.
virtual bool isContiguous() const
True if this Map is distributed contiguously, else false.
size_t global_size_t
Global size_t object.
static const EVerbosityLevel verbLevel_default
virtual std::string description() const
A simple one-line description of this object.
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 LocalOrdinal getMinLocalIndex() const
The minimum local index.
LocalOrdinal local_ordinal_type
#define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
const RCP< const Map > getFullMap() const
the full map
const RCP< Import > getImporter(size_t i) const
get the importer between full map and partial map
virtual GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map&#39;s communicator with a subset communicator.
BlockedMap< LocalOrdinal, GlobalOrdinal, Node > & operator=(const BlockedMap &rhs)
Assignment operator: Does a deep copy.
virtual GlobalOrdinal getIndexBase() const
The index base for this Map.
iterator end() const
virtual UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
BlockedMap(const RCP< const Map > &fullmap, const std::vector< RCP< const Map > > &maps, bool bThyraMode=false)
virtual bool isSameAs(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
std::vector< RCP< const Map > > thyraMaps_
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map&#39;s Comm object.
virtual GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
BlockedMap(const BlockedMap &input)
copy constructor
virtual bool isCompatible(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
virtual GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.