Xpetra_EpetraMap.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 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef XPETRA_EPETRAMAP_HPP
47 #define XPETRA_EPETRAMAP_HPP
48 
49 
51 
52 #include "Xpetra_Map.hpp"
53 
54 #include <Epetra_Map.h>
55 #include <Epetra_BlockMap.h>
56 
57 #include "Xpetra_Utils.hpp"
58 #include "Xpetra_EpetraUtils.hpp"
60 
61 #include "Xpetra_ConfigDefs.hpp"
62 
63 namespace Xpetra {
64 
65  // TODO: move that elsewhere
66  template<class GlobalOrdinal, class Node>
67  const Epetra_Map & toEpetra(const Map<int,GlobalOrdinal, Node> &);
68 
69  template<class GlobalOrdinal, class Node>
70  const Epetra_Map & toEpetra(const RCP< const Map<int, GlobalOrdinal, Node> > &);
71 
72  //template<class GlobalOrdinal>
73  //const RCP< const Map<int, GlobalOrdinal> > toXpetra(const RCP< const Epetra_Map > &);
74 
75  template<class GlobalOrdinal, class Node>
76  const RCP< const Map<int, GlobalOrdinal, Node> > toXpetra(const Epetra_BlockMap &);
77 
78  // stub implementation for EpetraMapT
79  template<class GlobalOrdinal, class Node>
80  class EpetraMapT
81  : public virtual Map<int, GlobalOrdinal, Node>
82  {
83  typedef int LocalOrdinal;
84 
85  public:
86  typedef int local_ordinal_type;
87  typedef GlobalOrdinal global_ordinal_type;
88  typedef Node node_type;
89 
91 
92 
94 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
95  TPETRA_DEPRECATED
96  EpetraMapT(global_size_t numGlobalElements,
97  GlobalOrdinal indexBase,
98  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
99  LocalGlobal lg,
100  const Teuchos::RCP< Node > &/*node*/)
101  : EpetraMapT(numGlobalElements, indexBase, comm, lg)
102  {}
103 #endif // TPETRA_ENABLE_DEPRECATED_CODE
104  EpetraMapT(global_size_t numGlobalElements,
105  GlobalOrdinal indexBase,
106  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
108  {
110  "Xpetra::EpetraMap only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
111  }
112 
114 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
115  TPETRA_DEPRECATED
116  EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node)
117  : EpetraMapT(numGlobalElements, numLocalElements, indexBase, comm)
118  {}
119 #endif // TPETRA_ENABLE_DEPRECATED_CODE
120  EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm) {
122  "Xpetra::EpetraMap only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
123  }
124 
126 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
127  TPETRA_DEPRECATED
128  EpetraMapT(global_size_t numGlobalElements,
130  GlobalOrdinal indexBase,
131  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
132  const Teuchos::RCP< Node > &node)
133  : EpetraMapT(numGlobalElements, elementList, indexBase, comm)
134  {}
135 #endif // TPETRA_ENABLE_DEPRECATED_CODE
136  EpetraMapT(global_size_t numGlobalElements,
138  GlobalOrdinal indexBase,
139  const Teuchos::RCP< const Teuchos::Comm< int > > &comm) {
141  "Xpetra::EpetraMap only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
142  }
143 
145 
147 
148 
150  global_size_t getGlobalNumElements() const { return 0; }
151 
153  size_t getNodeNumElements() const { return 0; }
154 
156  GlobalOrdinal getIndexBase() const { return 0; }
157 
159  LocalOrdinal getMinLocalIndex() const { return 0; }
160 
162  LocalOrdinal getMaxLocalIndex() const { return 0; }
163 
165  GlobalOrdinal getMinGlobalIndex() const { return 0; }
166 
168  GlobalOrdinal getMaxGlobalIndex() const { return 0; }
169 
171  GlobalOrdinal getMinAllGlobalIndex() const { return 0; }
172 
174  GlobalOrdinal getMaxAllGlobalIndex() const { return 0; }
175 
177  LocalOrdinal getLocalElement(GlobalOrdinal /* globalIndex */) const { return 0; }
178 
181 
184 
186  //Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const;
187 
190 
192 
193 
195  bool isNodeLocalElement(LocalOrdinal /* localIndex */) const { return false; }
196 
198  bool isNodeGlobalElement(GlobalOrdinal /* globalIndex */) const { return false; }
199 
201  bool isContiguous() const { return false; }
202 
204  bool isDistributed() const { return false; }
205 
207  bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &/* map */) const { return false; }
208 
210  bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &/* map */) const { return false; }
211 
213 
215 
216 
218  Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { return Teuchos::null; }
219 
220 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
221  Teuchos::RCP< Node > getNode() const {
223  XPETRA_MONITOR("EpetraMapT<GlobalOrdinal>::getNode");
224  return Teuchos::rcp (new Node);
225  }
226 #endif // TPETRA_ENABLE_DEPRECATED_CODE
227 
229 
231 
232 
234  std::string description() const { return std::string(""); }
235 
238 
240 
242 
243 
246 
248  RCP<const Map<int,GlobalOrdinal,Node> > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &/* newComm */) const { return Teuchos::null; }
249 
251 
253  GlobalOrdinal getGlobalElement(LocalOrdinal /* localIndex */) const { return -1; }
254 
256 
257 
259  virtual ~EpetraMapT() {}
260 
263  : map_(map) {
265  "Xpetra::EpetraMap only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
266  }
267 
269  UnderlyingLib lib() const { return Xpetra::UseEpetra; }
270 
272  //const RCP< const Epetra_Map > & getEpetra_Map() const { return map_; }
273  const Epetra_BlockMap& getEpetra_BlockMap() const { return *map_; }
274  const Epetra_Map& getEpetra_Map() const { return (Epetra_Map &)*map_; } // Ugly, but the same is done in Epetra_CrsMatrix.h to get the map.
275 
276 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
277 #ifdef HAVE_XPETRA_TPETRA
278  using local_map_type = typename Map<LocalOrdinal, GlobalOrdinal, Node>::local_map_type;
280  local_map_type getLocalMap () const {
281  throw std::runtime_error("Xpetra::EpetraMap::getLocalMap is not implemented.");
282  }
283 #else
284 #ifdef __GNUC__
285 #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."
286 #endif
287 #endif
288 #endif
289 
291 
292  protected:
293 
295  }; // EpetraMapT class
296 
297  // specialization on GO=int and EpetraNode
298 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
299  template<>
300  class EpetraMapT<int, EpetraNode>
301  : public virtual Map<int, int, EpetraNode>
302  {
303  typedef int LocalOrdinal;
304  typedef int GlobalOrdinal;
305  typedef EpetraNode Node;
306 
307  public:
310  typedef Node node_type;
311 
313 
314 
316 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
317  TPETRA_DEPRECATED
318  EpetraMapT(global_size_t numGlobalElements,
319  GlobalOrdinal indexBase,
320  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
321  LocalGlobal lg,
322  const Teuchos::RCP< Node > &/* node */)
323  : EpetraMapT(numGlobalElements, indexBase, comm, lg)
324  {}
325 #endif // TPETRA_ENABLE_DEPRECATED_CODE
326  EpetraMapT(global_size_t numGlobalElements,
327  GlobalOrdinal indexBase,
328  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
330  {
331  // This test come from Tpetra (Epetra doesn't check if numGlobalElements,indexBase are equivalent across images).
332  // In addition, for the test TEST_THROW(M map((myImageID == 0 ? GSTI : 0),0,comm), std::invalid_argument), only one node throw an exception and there is a dead lock.
333  std::string errPrefix;
334  errPrefix = Teuchos::typeName(*this) + "::constructor(numGlobal,indexBase,comm,lOrG): ";
335 
336  if (lg == GloballyDistributed) {
337  const int myImageID = comm->getRank();
338 
339  // check that numGlobalElements,indexBase is equivalent across images
340  global_size_t rootNGE = numGlobalElements;
341  GlobalOrdinal rootIB = indexBase;
342  Teuchos::broadcast<int,global_size_t>(*comm,0,&rootNGE);
343  Teuchos::broadcast<int,GlobalOrdinal>(*comm,0,&rootIB);
344  int localChecks[2], globalChecks[2];
345  localChecks[0] = -1; // fail or pass
346  localChecks[1] = 0; // fail reason
347  if (numGlobalElements != rootNGE) {
348  localChecks[0] = myImageID;
349  localChecks[1] = 1;
350  }
351  else if (indexBase != rootIB) {
352  localChecks[0] = myImageID;
353  localChecks[1] = 2;
354  }
355  // REDUCE_MAX will give us the image ID of the highest rank proc that DID NOT pass, as well as the reason
356  // these will be -1 and 0 if all procs passed
357  Teuchos::reduceAll<int,int>(*comm,Teuchos::REDUCE_MAX,2,localChecks,globalChecks);
358  if (globalChecks[0] != -1) {
359  if (globalChecks[1] == 1) {
360  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
361  errPrefix << "numGlobal must be the same on all nodes (examine node " << globalChecks[0] << ").");
362  }
363  else if (globalChecks[1] == 2) {
364  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
365  errPrefix << "indexBase must be the same on all nodes (examine node " << globalChecks[0] << ").");
366  }
367  else {
368  // logic error on our part
369  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
370  errPrefix << "logic error. Please contact the Tpetra team.");
371  }
372  }
373  }
374 
375  // Note: validity of numGlobalElements checked by Epetra.
376 
377  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(static_cast<GlobalOrdinal>(numGlobalElements), 1, indexBase, *toEpetra(comm))))));
378  }
379 
381 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
382  TPETRA_DEPRECATED
383  EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &/* node */)
384  : EpetraMapT(numGlobalElements, numLocalElements, indexBase, comm)
385  {}
386 #endif // TPETRA_ENABLE_DEPRECATED_CODE
387  EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
388  {
389  // This test come from Tpetra
390  using Teuchos::outArg;
391 
392  const size_t L0 = Teuchos::OrdinalTraits<size_t>::zero();
393  const size_t L1 = Teuchos::OrdinalTraits<size_t>::one();
397 
398  std::string errPrefix;
399  errPrefix = Teuchos::typeName(*this) + "::constructor(numGlobal,numLocal,indexBase,platform): ";
400 
401  // get a internodal communicator from the Platform
402  const int myImageID = comm->getRank();
403 
404  global_size_t global_sum;
405  { // begin scoping block
406  // for communicating failures
407  int localChecks[2], globalChecks[2];
408  /* compute the global size
409  we are computing the number of global elements because exactly ONE of the following is true:
410  - the user didn't specify it, and we need it
411  - the user did specify it, but we need to
412  + validate it against the sum of the local sizes, and
413  + ensure that it is the same on all nodes
414  */
415  Teuchos::reduceAll<int,global_size_t>(*comm,Teuchos::REDUCE_SUM,
416  Teuchos::as<global_size_t>(numLocalElements),outArg(global_sum));
417  /* there are three errors we should be detecting:
418  - numGlobalElements != invalid() and it is incorrect/invalid
419  - numLocalElements invalid (<0)
420  */
421  localChecks[0] = -1;
422  localChecks[1] = 0;
423  if (numLocalElements < L1 && numLocalElements != L0) {
424  // invalid
425  localChecks[0] = myImageID;
426  localChecks[1] = 1;
427  }
428  else if (numGlobalElements < GST1 && numGlobalElements != GST0 && numGlobalElements != GSTI) {
429  // invalid
430  localChecks[0] = myImageID;
431  localChecks[1] = 2;
432  }
433  else if (numGlobalElements != GSTI && numGlobalElements != global_sum) {
434  // incorrect
435  localChecks[0] = myImageID;
436  localChecks[1] = 3;
437  }
438  // now check that indexBase is equivalent across images
439  GlobalOrdinal rootIB = indexBase;
440  Teuchos::broadcast<int,GlobalOrdinal>(*comm,0,&rootIB); // broadcast one ordinal from node 0
441  if (indexBase != rootIB) {
442  localChecks[0] = myImageID;
443  localChecks[1] = 4;
444  }
445  // REDUCE_MAX will give us the image ID of the highest rank proc that DID NOT pass
446  // this will be -1 if all procs passed
447  Teuchos::reduceAll<int,int>(*comm,Teuchos::REDUCE_MAX,2,localChecks,globalChecks);
448  if (globalChecks[0] != -1) {
449  if (globalChecks[1] == 1) {
450  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
451  errPrefix << "numLocal is not valid on at least one node (possibly node "
452  << globalChecks[0] << ").");
453  }
454  else if (globalChecks[1] == 2) {
455  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
456  errPrefix << "numGlobal is not valid on at least one node (possibly node "
457  << globalChecks[0] << ").");
458  }
459  else if (globalChecks[1] == 3) {
460  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
461  errPrefix << "numGlobal doesn't match sum of numLocal (== "
462  << global_sum << ") on at least one node (possibly node "
463  << globalChecks[0] << ").");
464  }
465  else if (globalChecks[1] == 4) {
466  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
467  errPrefix << "indexBase is not the same on all nodes (examine node "
468  << globalChecks[0] << ").");
469  }
470  else {
471  // logic error on my part
472  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
473  errPrefix << "logic error. Please contact the Tpetra team.");
474  }
475  }
476 
477  }
478 
479  // set numGlobalElements
480  if (numGlobalElements == GSTI) {
481  numGlobalElements = global_sum;}
482 
483  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(static_cast<GlobalOrdinal>(numGlobalElements), static_cast<int>(numLocalElements), 1, indexBase, *toEpetra(comm))))));
484  }
485 
487 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
488  TPETRA_DEPRECATED
489  EpetraMapT(global_size_t numGlobalElements,
491  GlobalOrdinal indexBase,
492  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
493  const Teuchos::RCP< Node > &/* node */)
494  : EpetraMapT(numGlobalElements, elementList, indexBase, comm)
495  {}
496 #endif // TPETRA_ENABLE_DEPRECATED_CODE
497  EpetraMapT(global_size_t numGlobalElements,
499  GlobalOrdinal indexBase,
500  const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
501  {
502  if (numGlobalElements == Teuchos::OrdinalTraits<global_size_t>::invalid()) {
503  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(-1, static_cast<int>(elementList.size()), elementList.getRawPtr(), 1, indexBase, *toEpetra(comm))))));
504  } else {
505  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(static_cast<int>(numGlobalElements), static_cast<int>(elementList.size()), elementList.getRawPtr(), 1, indexBase, *toEpetra(comm))))));
506  }
507  }
508 
510 
512 
513 
515  global_size_t getGlobalNumElements() const { XPETRA_MONITOR("EpetraMapT::getGlobalNumElements"); return map_->NumGlobalElements64(); }
516 
518  size_t getNodeNumElements() const { XPETRA_MONITOR("EpetraMapT::getNodeNumElements"); return map_->NumMyElements(); }
519 
521  GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("EpetraMapT::getIndexBase"); return (GlobalOrdinal) map_->IndexBase64(); }
522 
524  LocalOrdinal getMinLocalIndex() const { XPETRA_MONITOR("EpetraMapT::getMinLocalIndex"); return map_->MinLID(); }
525 
527  LocalOrdinal getMaxLocalIndex() const { XPETRA_MONITOR("EpetraMapT::getMaxLocalIndex"); return map_->MaxLID(); }
528 
530  GlobalOrdinal getMinGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMinGlobalIndex"); return (GlobalOrdinal) map_->MinMyGID64(); }
531 
533  GlobalOrdinal getMaxGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMaxGlobalIndex"); return (GlobalOrdinal) map_->MaxMyGID64(); }
534 
536  GlobalOrdinal getMinAllGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMinAllGlobalIndex"); return (GlobalOrdinal) map_->MinAllGID64(); }
537 
539  GlobalOrdinal getMaxAllGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMaxAllGlobalIndex"); return (GlobalOrdinal) map_->MaxAllGID64(); }
540 
542  LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("EpetraMapT::getLocalElement"); return map_->LID(globalIndex); }
543 
544 
547  const Teuchos::ArrayView< int > &nodeIDList,
548  const Teuchos::ArrayView< LocalOrdinal > &LIDList) const
549  {
550  XPETRA_MONITOR("EpetraMapT::getRemoteIndexList");
551  return toXpetra(map_->RemoteIDList(static_cast<int>(GIDList.size()), GIDList.getRawPtr(), nodeIDList.getRawPtr(), LIDList.getRawPtr()));
552  }
553 
554 
557  const Teuchos::ArrayView< int > &nodeIDList) const
558  {
559  XPETRA_MONITOR("EpetraMapT::getRemoteIndexList");
560  return toXpetra(map_->RemoteIDList(static_cast<int>(GIDList.size()), GIDList.getRawPtr(), nodeIDList.getRawPtr(), 0));
561  }
562 
563 
565  Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const { XPETRA_MONITOR("EpetraMapT::getNodeElementList"); return ArrayView< const int >(map_->MyGlobalElements(), map_->NumMyElements()); }
567 
569 
570 
572  bool isNodeLocalElement(LocalOrdinal localIndex) const { XPETRA_MONITOR("EpetraMapT::isNodeLocalElement"); return map_->MyLID(localIndex); }
573 
575  bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("EpetraMapT::isNodeGlobalElement"); return map_->MyGID(globalIndex); }
576 
578  bool isContiguous() const { XPETRA_MONITOR("EpetraMapT::isContiguous"); return map_->LinearMap(); }
579 
581  bool isDistributed() const { XPETRA_MONITOR("EpetraMapT::isDistributed"); return map_->DistributedGlobal(); }
582 
584  bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("EpetraMapT::isCompatible"); return map_->PointSameAs(toEpetra<GlobalOrdinal,Node>(map)); }
585 
587  bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("EpetraMapT::isSameAs"); return map_->SameAs(toEpetra<GlobalOrdinal,Node>(map)); }
588 
590 
592 
593 
596  {
597  XPETRA_MONITOR("EpetraMapT::getComm");
598  return toXpetra(map_->Comm());
599  }
600 
601 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
602  Teuchos::RCP< Node > getNode() const {
604  XPETRA_MONITOR("EpetraMapT<GlobalOrdinal>::getNode");
605  return Teuchos::rcp (new Node);
606  }
607 #endif // TPETRA_ENABLE_DEPRECATED_CODE
608 
610 
612 
613 
615  std::string description() const {
616  XPETRA_MONITOR("EpetraMapT::description");
617 
618  // This implementation come from Tpetra_Map_def.hpp (without modification)
619  std::ostringstream oss;
621  oss << "{getGlobalNumElements() = " << getGlobalNumElements()
622  << ", getNodeNumElements() = " << getNodeNumElements()
623  << ", isContiguous() = " << isContiguous()
624  << ", isDistributed() = " << isDistributed()
625  << "}";
626  return oss.str();
627  }
628 
631  XPETRA_MONITOR("EpetraMapT::describe");
632 
634 
635  // This implementation come from Tpetra_Map_def.hpp (without modification)
636  using std::endl;
637  using std::setw;
638  using Teuchos::VERB_DEFAULT;
639  using Teuchos::VERB_NONE;
640  using Teuchos::VERB_LOW;
641  using Teuchos::VERB_MEDIUM;
642  using Teuchos::VERB_HIGH;
643  using Teuchos::VERB_EXTREME;
644 
645  const size_t nME = getNodeNumElements();
647  int myImageID = comm_->getRank();
648  int numImages = comm_->getSize();
649 
650  Teuchos::EVerbosityLevel vl = verbLevel;
651  if (vl == VERB_DEFAULT) vl = VERB_LOW;
652 
653  size_t width = 1;
654  for (size_t dec=10; dec<getGlobalNumElements(); dec *= 10) {
655  ++width;
656  }
657  width = ::std::max<size_t>(width, (size_t) 12) + 2; // casting to size_t to avoid ambiguity error when compiling Sacado.
658 
659  Teuchos::OSTab tab(out);
660 
661  if (vl == VERB_NONE) {
662  // do nothing
663  }
664  else if (vl == VERB_LOW) {
665  out << this->description() << endl;
666  }
667  else { // MEDIUM, HIGH or EXTREME
668  for (int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
669  if (myImageID == imageCtr) {
670  if (myImageID == 0) { // this is the root node (only output this info once)
671  out << endl
672  << "Number of Global Entries = " << getGlobalNumElements() << endl
673  << "Maximum of all GIDs = " << getMaxAllGlobalIndex() << endl
674  << "Minimum of all GIDs = " << getMinAllGlobalIndex() << endl
675  << "Index Base = " << getIndexBase() << endl;
676  }
677  out << endl;
678  if (vl == VERB_HIGH || vl == VERB_EXTREME) {
679  out << "Number of Local Elements = " << nME << endl
680  << "Maximum of my GIDs = " << getMaxGlobalIndex() << endl
681  << "Minimum of my GIDs = " << getMinGlobalIndex() << endl;
682  out << endl;
683  }
684  if (vl == VERB_EXTREME) {
685  out << std::setw(width) << "Node ID"
686  << std::setw(width) << "Local Index"
687  << std::setw(width) << "Global Index"
688  << endl;
689  for (size_t i=0; i < nME; i++) {
690  out << std::setw(width) << myImageID
691  << std::setw(width) << i
692  << std::setw(width) << myEntries[i]
693  << endl;
694  }
695  out << std::flush;
696  }
697  }
698  // Do a few global ops to give I/O a chance to complete
699  comm_->barrier();
700  comm_->barrier();
701  comm_->barrier();
702  }
703  }
704  }
705 
707 
709 
710 
713  const Epetra_BlockMap * NewMap = map_->RemoveEmptyProcesses();
714  if (!NewMap) {
715  return Teuchos::null;
716  } else {
717  const RCP< const Map<int, GlobalOrdinal, Node> > NewMapX = toXpetra<GlobalOrdinal, Node>(*NewMap);
718  delete NewMap; // NOTE: toXpetra *copys* the epetra map rather than wrapping it, so we have to delete NewMap to avoid a memory leak.
719  return NewMapX;
720  }
721  }
722 
725  throw std::runtime_error("Xpetra::EpetraMapT::replaceCommWithSubset has not yet been implemented.");
726  TEUCHOS_UNREACHABLE_RETURN(Teuchos::null);
727  }
728 
730 
733  XPETRA_MONITOR("EpetraMapT::getGlobalElement");
734 
735  GlobalOrdinal gid = (GlobalOrdinal) map_->GID64(localIndex);
736  if (gid == map_->IndexBase64()-1) return (-1);
737  else return (gid);
738  }
739 
741 
742 
744  virtual ~EpetraMapT() {}
745 
748  : map_(map) {
749  TEUCHOS_TEST_FOR_EXCEPTION(!map->GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraMapT: GlobalOrdinal mismatch.");
750  }
751 
753  UnderlyingLib lib() const { return Xpetra::UseEpetra; }
754 
756  //const RCP< const Epetra_Map > & getEpetra_Map() const { return map_; }
757  const Epetra_BlockMap& getEpetra_BlockMap() const { return *map_; }
758  const Epetra_Map& getEpetra_Map() const { return (Epetra_Map &)*map_; } // Ugly, but the same is done in Epetra_CrsMatrix.h to get the map.
759 
761 
762 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
763 #ifdef HAVE_XPETRA_TPETRA
764  using local_map_type = typename Map<LocalOrdinal, GlobalOrdinal, Node>::local_map_type;
766  local_map_type getLocalMap () const {
767  throw std::runtime_error("Xpetra::EpetraMap::getLocalMap is not implemented.");
768  }
769 
770  private:
771  mutable local_map_type localMap_;
772 #else
773 #ifdef __GNUC__
774 #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."
775 #endif
776 #endif
777 #endif
778 
779  protected:
780 
782 }; // EpetraMapT class
783 #endif // #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
784 
785 // specialization on GO=long long and EpetraNode
786 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
787  template<>
788  class EpetraMapT<long long, EpetraNode>
789  : public virtual Map<int, long long, EpetraNode>
790  {
791  typedef int LocalOrdinal;
792  typedef long long GlobalOrdinal;
793  typedef EpetraNode Node;
794 
795  public:
798  typedef Node node_type;
799 
801 
802 
804 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
805  TPETRA_DEPRECATED
806  EpetraMapT(global_size_t numGlobalElements,
807  GlobalOrdinal indexBase,
808  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
809  LocalGlobal lg,
810  const Teuchos::RCP< Node > &/* node */)
811  : EpetraMapT(numGlobalElements, indexBase, comm, lg)
812  {}
813 #endif // TPETRA_ENABLE_DEPRECATED_CODE
814  EpetraMapT(global_size_t numGlobalElements,
815  GlobalOrdinal indexBase,
816  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
818  {
819  // This test come from Tpetra (Epetra doesn't check if numGlobalElements,indexBase are equivalent across images).
820  // In addition, for the test TEST_THROW(M map((myImageID == 0 ? GSTI : 0),0,comm), std::invalid_argument), only one node throw an exception and there is a dead lock.
821  std::string errPrefix;
822  errPrefix = Teuchos::typeName(*this) + "::constructor(numGlobal,indexBase,comm,lOrG): ";
823 
824  if (lg == GloballyDistributed) {
825  const int myImageID = comm->getRank();
826 
827  // check that numGlobalElements,indexBase is equivalent across images
828  global_size_t rootNGE = numGlobalElements;
829  GlobalOrdinal rootIB = indexBase;
830  Teuchos::broadcast<int,global_size_t>(*comm,0,&rootNGE);
831  Teuchos::broadcast<int,GlobalOrdinal>(*comm,0,&rootIB);
832  int localChecks[2], globalChecks[2];
833  localChecks[0] = -1; // fail or pass
834  localChecks[1] = 0; // fail reason
835  if (numGlobalElements != rootNGE) {
836  localChecks[0] = myImageID;
837  localChecks[1] = 1;
838  }
839  else if (indexBase != rootIB) {
840  localChecks[0] = myImageID;
841  localChecks[1] = 2;
842  }
843  // REDUCE_MAX will give us the image ID of the highest rank proc that DID NOT pass, as well as the reason
844  // these will be -1 and 0 if all procs passed
845  Teuchos::reduceAll<int,int>(*comm,Teuchos::REDUCE_MAX,2,localChecks,globalChecks);
846  if (globalChecks[0] != -1) {
847  if (globalChecks[1] == 1) {
848  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
849  errPrefix << "numGlobal must be the same on all nodes (examine node " << globalChecks[0] << ").");
850  }
851  else if (globalChecks[1] == 2) {
852  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
853  errPrefix << "indexBase must be the same on all nodes (examine node " << globalChecks[0] << ").");
854  }
855  else {
856  // logic error on our part
857  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
858  errPrefix << "logic error. Please contact the Tpetra team.");
859  }
860  }
861  }
862 
863  // Note: validity of numGlobalElements checked by Epetra.
864 
865  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(static_cast<GlobalOrdinal>(numGlobalElements), 1, indexBase, *toEpetra(comm))))));
866  }
867 
869 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
870  TPETRA_DEPRECATED
871  EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &/* node */)
872  : EpetraMapT(numGlobalElements, numLocalElements, indexBase, comm)
873  {}
874 #endif // TPETRA_ENABLE_DEPRECATED_CODE
875  EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm) {
876  // This test come from Tpetra
877  using Teuchos::outArg;
878 
879  const size_t L0 = Teuchos::OrdinalTraits<size_t>::zero();
880  const size_t L1 = Teuchos::OrdinalTraits<size_t>::one();
884 
885  std::string errPrefix;
886  errPrefix = Teuchos::typeName(*this) + "::constructor(numGlobal,numLocal,indexBase,platform): ";
887 
888  // get a internodal communicator from the Platform
889  const int myImageID = comm->getRank();
890 
891  global_size_t global_sum;
892  { // begin scoping block
893  // for communicating failures
894  int localChecks[2], globalChecks[2];
895  /* compute the global size
896  we are computing the number of global elements because exactly ONE of the following is true:
897  - the user didn't specify it, and we need it
898  - the user did specify it, but we need to
899  + validate it against the sum of the local sizes, and
900  + ensure that it is the same on all nodes
901  */
902  Teuchos::reduceAll<int,global_size_t>(*comm,Teuchos::REDUCE_SUM,
903  Teuchos::as<global_size_t>(numLocalElements),outArg(global_sum));
904  /* there are three errors we should be detecting:
905  - numGlobalElements != invalid() and it is incorrect/invalid
906  - numLocalElements invalid (<0)
907  */
908  localChecks[0] = -1;
909  localChecks[1] = 0;
910  if (numLocalElements < L1 && numLocalElements != L0) {
911  // invalid
912  localChecks[0] = myImageID;
913  localChecks[1] = 1;
914  }
915  else if (numGlobalElements < GST1 && numGlobalElements != GST0 && numGlobalElements != GSTI) {
916  // invalid
917  localChecks[0] = myImageID;
918  localChecks[1] = 2;
919  }
920  else if (numGlobalElements != GSTI && numGlobalElements != global_sum) {
921  // incorrect
922  localChecks[0] = myImageID;
923  localChecks[1] = 3;
924  }
925  // now check that indexBase is equivalent across images
926  GlobalOrdinal rootIB = indexBase;
927  Teuchos::broadcast<int,GlobalOrdinal>(*comm,0,&rootIB); // broadcast one ordinal from node 0
928  if (indexBase != rootIB) {
929  localChecks[0] = myImageID;
930  localChecks[1] = 4;
931  }
932  // REDUCE_MAX will give us the image ID of the highest rank proc that DID NOT pass
933  // this will be -1 if all procs passed
934  Teuchos::reduceAll<int,int>(*comm,Teuchos::REDUCE_MAX,2,localChecks,globalChecks);
935  if (globalChecks[0] != -1) {
936  if (globalChecks[1] == 1) {
937  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
938  errPrefix << "numLocal is not valid on at least one node (possibly node "
939  << globalChecks[0] << ").");
940  }
941  else if (globalChecks[1] == 2) {
942  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
943  errPrefix << "numGlobal is not valid on at least one node (possibly node "
944  << globalChecks[0] << ").");
945  }
946  else if (globalChecks[1] == 3) {
947  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
948  errPrefix << "numGlobal doesn't match sum of numLocal (== "
949  << global_sum << ") on at least one node (possibly node "
950  << globalChecks[0] << ").");
951  }
952  else if (globalChecks[1] == 4) {
953  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
954  errPrefix << "indexBase is not the same on all nodes (examine node "
955  << globalChecks[0] << ").");
956  }
957  else {
958  // logic error on my part
959  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
960  errPrefix << "logic error. Please contact the Tpetra team.");
961  }
962  }
963 
964  }
965 
966  // set numGlobalElements
967  if (numGlobalElements == GSTI) {
968  numGlobalElements = global_sum;}
969 
970  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(static_cast<GlobalOrdinal>(numGlobalElements), numLocalElements, 1, indexBase, *toEpetra(comm))))));
971  }
972 
974 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
975  TPETRA_DEPRECATED
976  EpetraMapT(global_size_t numGlobalElements,
978  GlobalOrdinal indexBase,
979  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
980  const Teuchos::RCP< Node > &/* node */)
981  : EpetraMapT(numGlobalElements, elementList, indexBase, comm)
982  {}
983 #endif // TPETRA_ENABLE_DEPRECATED_CODE
984  EpetraMapT(global_size_t numGlobalElements,
986  GlobalOrdinal indexBase,
987  const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
988  {
989  if (numGlobalElements == Teuchos::OrdinalTraits<global_size_t>::invalid()) {
990  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(-1, elementList.size(), elementList.getRawPtr(), 1, indexBase, *toEpetra(comm))))));
991  } else {
992  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(numGlobalElements, elementList.size(), elementList.getRawPtr(), 1, indexBase, *toEpetra(comm))))));
993  }
994  }
995 
997 
999 
1000 
1002  global_size_t getGlobalNumElements() const { XPETRA_MONITOR("EpetraMapT::getGlobalNumElements"); return map_->NumGlobalElements64(); }
1003 
1005  size_t getNodeNumElements() const { XPETRA_MONITOR("EpetraMapT::getNodeNumElements"); return map_->NumMyElements(); }
1006 
1008  GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("EpetraMapT::getIndexBase"); return (GlobalOrdinal) map_->IndexBase64(); }
1009 
1011  LocalOrdinal getMinLocalIndex() const { XPETRA_MONITOR("EpetraMapT::getMinLocalIndex"); return map_->MinLID(); }
1012 
1014  LocalOrdinal getMaxLocalIndex() const { XPETRA_MONITOR("EpetraMapT::getMaxLocalIndex"); return map_->MaxLID(); }
1015 
1017  GlobalOrdinal getMinGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMinGlobalIndex"); return (GlobalOrdinal) map_->MinMyGID64(); }
1018 
1020  GlobalOrdinal getMaxGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMaxGlobalIndex"); return (GlobalOrdinal) map_->MaxMyGID64(); }
1021 
1023  GlobalOrdinal getMinAllGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMinAllGlobalIndex"); return (GlobalOrdinal) map_->MinAllGID64(); }
1024 
1026  GlobalOrdinal getMaxAllGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMaxAllGlobalIndex"); return (GlobalOrdinal) map_->MaxAllGID64(); }
1027 
1029  LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("EpetraMapT::getLocalElement"); return map_->LID(globalIndex); }
1030 
1032  LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const { XPETRA_MONITOR("EpetraMapT::getRemoteIndexList"); return toXpetra(map_->RemoteIDList(GIDList.size(), GIDList.getRawPtr(), nodeIDList.getRawPtr(), LIDList.getRawPtr())); }
1033 
1035  LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const { XPETRA_MONITOR("EpetraMapT::getRemoteIndexList"); return toXpetra(map_->RemoteIDList(GIDList.size(), GIDList.getRawPtr(), nodeIDList.getRawPtr(), 0)); }
1036 
1038  Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const { XPETRA_MONITOR("EpetraMapT::getNodeElementList"); return ArrayView< const long long >(map_->MyGlobalElements64(), map_->NumMyElements()); }
1040 
1042 
1043 
1045  bool isNodeLocalElement(LocalOrdinal localIndex) const { XPETRA_MONITOR("EpetraMapT::isNodeLocalElement"); return map_->MyLID(localIndex); }
1046 
1048  bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("EpetraMapT::isNodeGlobalElement"); return map_->MyGID(globalIndex); }
1049 
1051  bool isContiguous() const { XPETRA_MONITOR("EpetraMapT::isContiguous"); return map_->LinearMap(); }
1052 
1054  bool isDistributed() const { XPETRA_MONITOR("EpetraMapT::isDistributed"); return map_->DistributedGlobal(); }
1055 
1057  bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("EpetraMapT::isCompatible"); return map_->PointSameAs(toEpetra<GlobalOrdinal,Node>(map)); }
1058 
1060  bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("EpetraMapT::isSameAs"); return map_->SameAs(toEpetra<GlobalOrdinal,Node>(map)); }
1061 
1063 
1065 
1066 
1068  Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { XPETRA_MONITOR("EpetraMapT::getComm"); return toXpetra(map_->Comm()); }
1069 
1070 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1071  Teuchos::RCP< Node > getNode() const {
1073  XPETRA_MONITOR("EpetraMapT<GlobalOrdinal>::getNode");
1074  return Teuchos::rcp (new Node);
1075  }
1076 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1077 
1079 
1081 
1082 
1084  std::string description() const {
1085  XPETRA_MONITOR("EpetraMapT::description");
1086 
1087  // This implementation come from Tpetra_Map_def.hpp (without modification)
1088  std::ostringstream oss;
1090  oss << "{getGlobalNumElements() = " << getGlobalNumElements()
1091  << ", getNodeNumElements() = " << getNodeNumElements()
1092  << ", isContiguous() = " << isContiguous()
1093  << ", isDistributed() = " << isDistributed()
1094  << "}";
1095  return oss.str();
1096  }
1097 
1100  XPETRA_MONITOR("EpetraMapT::describe");
1101 
1103 
1104  // This implementation come from Tpetra_Map_def.hpp (without modification)
1105  using std::endl;
1106  using std::setw;
1107  using Teuchos::VERB_DEFAULT;
1108  using Teuchos::VERB_NONE;
1109  using Teuchos::VERB_LOW;
1110  using Teuchos::VERB_MEDIUM;
1111  using Teuchos::VERB_HIGH;
1112  using Teuchos::VERB_EXTREME;
1113 
1114  const size_t nME = getNodeNumElements();
1116  int myImageID = comm_->getRank();
1117  int numImages = comm_->getSize();
1118 
1119  Teuchos::EVerbosityLevel vl = verbLevel;
1120  if (vl == VERB_DEFAULT) vl = VERB_LOW;
1121 
1122  size_t width = 1;
1123  for (size_t dec=10; dec<getGlobalNumElements(); dec *= 10) {
1124  ++width;
1125  }
1126  width = ::std::max<size_t>(width, (size_t) 12) + 2; // casting to size_t to avoid ambiguity error when compiling Sacado.
1127 
1128  Teuchos::OSTab tab(out);
1129 
1130  if (vl == VERB_NONE) {
1131  // do nothing
1132  }
1133  else if (vl == VERB_LOW) {
1134  out << this->description() << endl;
1135  }
1136  else { // MEDIUM, HIGH or EXTREME
1137  for (int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1138  if (myImageID == imageCtr) {
1139  if (myImageID == 0) { // this is the root node (only output this info once)
1140  out << endl
1141  << "Number of Global Entries = " << getGlobalNumElements() << endl
1142  << "Maximum of all GIDs = " << getMaxAllGlobalIndex() << endl
1143  << "Minimum of all GIDs = " << getMinAllGlobalIndex() << endl
1144  << "Index Base = " << getIndexBase() << endl;
1145  }
1146  out << endl;
1147  if (vl == VERB_HIGH || vl == VERB_EXTREME) {
1148  out << "Number of Local Elements = " << nME << endl
1149  << "Maximum of my GIDs = " << getMaxGlobalIndex() << endl
1150  << "Minimum of my GIDs = " << getMinGlobalIndex() << endl;
1151  out << endl;
1152  }
1153  if (vl == VERB_EXTREME) {
1154  out << std::setw(width) << "Node ID"
1155  << std::setw(width) << "Local Index"
1156  << std::setw(width) << "Global Index"
1157  << endl;
1158  for (size_t i=0; i < nME; i++) {
1159  out << std::setw(width) << myImageID
1160  << std::setw(width) << i
1161  << std::setw(width) << myEntries[i]
1162  << endl;
1163  }
1164  out << std::flush;
1165  }
1166  }
1167  // Do a few global ops to give I/O a chance to complete
1168  comm_->barrier();
1169  comm_->barrier();
1170  comm_->barrier();
1171  }
1172  }
1173  }
1174 
1176 
1178 
1179 
1182  const Epetra_BlockMap * NewMap = map_->RemoveEmptyProcesses();
1183  if (!NewMap) {
1184  return Teuchos::null;
1185  } else {
1186  const RCP< const Map<int, GlobalOrdinal, Node> > NewMapX = toXpetra<GlobalOrdinal, Node>(*NewMap);
1187  delete NewMap; // NOTE: toXpetra *copys* the epetra map rather than wrapping it, so we have to delete NewMap to avoid a memory leak.
1188  return NewMapX;
1189  }
1190  }
1191 
1194  throw std::runtime_error("Xpetra::EpetraMapT::replaceCommWithSubset has not yet been implemented.");
1195  // return Teuchos::null; // unreachable
1196  }
1197 
1199 
1202  XPETRA_MONITOR("EpetraMapT::getGlobalElement");
1203 
1204  GlobalOrdinal gid = (GlobalOrdinal) map_->GID64(localIndex);
1205  if (gid == map_->IndexBase64()-1) return (-1);
1206  else return (gid);
1207  }
1208 
1210 
1211 
1213  virtual ~EpetraMapT() {}
1214 
1217  : map_(map) {
1218  TEUCHOS_TEST_FOR_EXCEPTION(!map->GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraMapT: GlobalOrdinal mismatch.");
1219  }
1220 
1223 
1225  //const RCP< const Epetra_Map > & getEpetra_Map() const { return map_; }
1226  const Epetra_BlockMap& getEpetra_BlockMap() const { return *map_; }
1227  const Epetra_Map& getEpetra_Map() const { return (Epetra_Map &)*map_; } // Ugly, but the same is done in Epetra_CrsMatrix.h to get the map.
1228 
1229 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1230 #ifdef HAVE_XPETRA_TPETRA
1231  using local_map_type = typename Map<LocalOrdinal, GlobalOrdinal, Node>::local_map_type;
1233  local_map_type getLocalMap () const {
1234  throw std::runtime_error("Xpetra::EpetraMap::getLocalMap is not implemented.");
1235  }
1236 
1237  private:
1238  mutable local_map_type localMap_;
1239 #else
1240 #ifdef __GNUC__
1241 #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."
1242 #endif
1243 #endif
1244 #endif
1245 
1247 
1248  protected:
1249 
1251 }; // EpetraMapT class
1252 #endif // #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
1253 
1254 } // Xpetra namespace
1255 
1256 #endif // XPETRA_EPETRAMAP_HPP
Xpetra::EpetraMapT< int, EpetraNode >::Node
EpetraNode Node
Definition: Xpetra_EpetraMap.hpp:305
Xpetra::EpetraMapT< int, EpetraNode >::local_ordinal_type
LocalOrdinal local_ordinal_type
Definition: Xpetra_EpetraMap.hpp:308
Kokkos::Compat::KokkosSerialWrapperNode
Definition: Kokkos_SerialNode.hpp:57
Xpetra_EpetraExceptions.hpp
Xpetra::EpetraMapT::node_type
Node node_type
Definition: Xpetra_EpetraMap.hpp:88
Xpetra::LocalGlobal
LocalGlobal
Definition: Xpetra_ConfigDefs.hpp:177
Xpetra::EpetraMapT< long long, EpetraNode >::description
std::string description() const
Return a simple one-line description of this object.
Definition: Xpetra_EpetraMap.hpp:1084
Xpetra::EpetraMapT::getEpetra_BlockMap
const Epetra_BlockMap & getEpetra_BlockMap() const
Get the underlying Epetra map.
Definition: Xpetra_EpetraMap.hpp:273
Xpetra
Xpetra namespace
Definition: Xpetra_BlockedCrsMatrix.hpp:88
Xpetra::EpetraMapT::getEpetra_Map
const Epetra_Map & getEpetra_Map() const
Definition: Xpetra_EpetraMap.hpp:274
Xpetra::EpetraMapT< long long, EpetraNode >::getRemoteIndexList
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_EpetraMap.hpp:1035
Xpetra::EpetraMapT::isNodeLocalElement
bool isNodeLocalElement(LocalOrdinal) const
Whether the given local index is valid for this Map on this process.
Definition: Xpetra_EpetraMap.hpp:195
Xpetra::EpetraMapT::getLocalElement
LocalOrdinal getLocalElement(GlobalOrdinal) const
The local index corresponding to the given global index.
Definition: Xpetra_EpetraMap.hpp:177
Teuchos::VERB_NONE
VERB_NONE
Xpetra::global_size_t
size_t global_size_t
Global size_t object.
Definition: Xpetra_ConfigDefs.hpp:174
Xpetra::EpetraMapT< int, EpetraNode >::isNodeLocalElement
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on this process.
Definition: Xpetra_EpetraMap.hpp:572
Xpetra::EpetraMapT< int, EpetraNode >::getLocalElement
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
Definition: Xpetra_EpetraMap.hpp:542
Xpetra::EpetraMapT< long long, EpetraNode >::global_ordinal_type
GlobalOrdinal global_ordinal_type
Definition: Xpetra_EpetraMap.hpp:797
Xpetra::EpetraMapT< long long, EpetraNode >::getMaxAllGlobalIndex
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
Definition: Xpetra_EpetraMap.hpp:1026
Xpetra::EpetraMapT< int, EpetraNode >::isSameAs
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
Definition: Xpetra_EpetraMap.hpp:587
Xpetra::EpetraMapT::getGlobalElement
GlobalOrdinal getGlobalElement(LocalOrdinal) const
Return the global index for a given local index. Note that this returns -1 if not found on this proce...
Definition: Xpetra_EpetraMap.hpp:253
Xpetra::EpetraMapT< long long, EpetraNode >::isNodeLocalElement
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on this process.
Definition: Xpetra_EpetraMap.hpp:1045
Xpetra::EpetraMapT< long long, EpetraNode >::describe
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print this object with the given verbosity level to the given Teuchos::FancyOStream.
Definition: Xpetra_EpetraMap.hpp:1099
Xpetra::EpetraMapT< long long, EpetraNode >::getLocalElement
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
Definition: Xpetra_EpetraMap.hpp:1029
Teuchos::Describable::description
virtual std::string description() const
Xpetra::EpetraMapT< long long, EpetraNode >::getEpetra_Map
const Epetra_Map & getEpetra_Map() const
Definition: Xpetra_EpetraMap.hpp:1227
Xpetra::EpetraMapT::EpetraMapT
EpetraMapT(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
Definition: Xpetra_EpetraMap.hpp:136
Xpetra::EpetraMapT< long long, EpetraNode >::getMinGlobalIndex
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Definition: Xpetra_EpetraMap.hpp:1017
Teuchos::VERB_DEFAULT
VERB_DEFAULT
Xpetra::EpetraMapT< int, EpetraNode >::getMaxLocalIndex
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
Definition: Xpetra_EpetraMap.hpp:527
Xpetra::EpetraMapT< int, EpetraNode >::getGlobalNumElements
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Definition: Xpetra_EpetraMap.hpp:515
Xpetra::EpetraMapT< int, EpetraNode >::getComm
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
Definition: Xpetra_EpetraMap.hpp:595
Xpetra::EpetraMapT::EpetraMapT
EpetraMapT(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed)
Constructor with Tpetra-defined contiguous uniform distribution.
Definition: Xpetra_EpetraMap.hpp:104
Xpetra::EpetraMapT::getGlobalNumElements
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Definition: Xpetra_EpetraMap.hpp:150
Xpetra::EpetraMapT< int, EpetraNode >::getEpetra_BlockMap
const Epetra_BlockMap & getEpetra_BlockMap() const
Get the underlying Epetra map.
Definition: Xpetra_EpetraMap.hpp:757
Xpetra::EpetraMapT::EpetraMapT
EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with a user-defined contiguous distribution.
Definition: Xpetra_EpetraMap.hpp:120
Xpetra::EpetraMapT< long long, EpetraNode >::Node
EpetraNode Node
Definition: Xpetra_EpetraMap.hpp:793
Teuchos::OrdinalTraits
Xpetra::EpetraMapT< int, EpetraNode >::removeEmptyProcesses
RCP< const Map< int, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
Definition: Xpetra_EpetraMap.hpp:712
Xpetra::toXpetra
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
Definition: Xpetra_EpetraCrsGraph.cpp:168
Xpetra::EpetraMapT< long long, EpetraNode >::EpetraMapT
EpetraMapT(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
Definition: Xpetra_EpetraMap.hpp:984
Teuchos::VERB_LOW
VERB_LOW
Xpetra::EpetraMapT::getMinLocalIndex
LocalOrdinal getMinLocalIndex() const
The minimum local index.
Definition: Xpetra_EpetraMap.hpp:159
Teuchos::rcp
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG
#define IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG(sourceCode)
Definition: Xpetra_EpetraExceptions.hpp:61
Teuchos::EVerbosityLevel
EVerbosityLevel
Xpetra::EpetraMapT< int, EpetraNode >::isNodeGlobalElement
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is valid for this Map on this process.
Definition: Xpetra_EpetraMap.hpp:575
Xpetra_Utils.hpp
Xpetra::GloballyDistributed
@ GloballyDistributed
Definition: Xpetra_ConfigDefs.hpp:179
Xpetra::EpetraMapT< long long, EpetraNode >::getIndexBase
GlobalOrdinal getIndexBase() const
The index base for this Map.
Definition: Xpetra_EpetraMap.hpp:1008
Xpetra::EpetraMapT< int, EpetraNode >::getMinLocalIndex
LocalOrdinal getMinLocalIndex() const
The minimum local index.
Definition: Xpetra_EpetraMap.hpp:524
Teuchos::typeName
std::string typeName(const T &t)
Xpetra::EpetraMapT< long long, EpetraNode >::map_
RCP< const Epetra_BlockMap > map_
Definition: Xpetra_EpetraMap.hpp:1250
Xpetra::EpetraMapT< long long, EpetraNode >::getGlobalNumElements
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Definition: Xpetra_EpetraMap.hpp:1002
Xpetra::EpetraMapT< long long, EpetraNode >::isContiguous
bool isContiguous() const
True if this Map is distributed contiguously, else false.
Definition: Xpetra_EpetraMap.hpp:1051
Xpetra::EpetraMapT< int, EpetraNode >::getRemoteIndexList
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_EpetraMap.hpp:546
Xpetra::EpetraMapT< int, EpetraNode >::map_
RCP< const Epetra_BlockMap > map_
Definition: Xpetra_EpetraMap.hpp:781
Xpetra::EpetraMapT::getIndexBase
GlobalOrdinal getIndexBase() const
The index base for this Map.
Definition: Xpetra_EpetraMap.hpp:156
Teuchos::ArrayView
Xpetra::Map
Definition: Xpetra_Map_decl.hpp:91
Xpetra::EpetraMapT< long long, EpetraNode >::~EpetraMapT
virtual ~EpetraMapT()
Destructor.
Definition: Xpetra_EpetraMap.hpp:1213
Xpetra::EpetraMapT< int, EpetraNode >::EpetraMapT
EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with a user-defined contiguous distribution.
Definition: Xpetra_EpetraMap.hpp:387
Xpetra::EpetraMapT< int, EpetraNode >::getIndexBase
GlobalOrdinal getIndexBase() const
The index base for this Map.
Definition: Xpetra_EpetraMap.hpp:521
Teuchos::RCP
Xpetra::EpetraMapT< long long, EpetraNode >::getMaxGlobalIndex
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
Definition: Xpetra_EpetraMap.hpp:1020
Xpetra::EpetraMapT::getMinGlobalIndex
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Definition: Xpetra_EpetraMap.hpp:165
Xpetra::EpetraMapT< long long, EpetraNode >::getMinAllGlobalIndex
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
Definition: Xpetra_EpetraMap.hpp:1023
Xpetra::EpetraMapT< int, EpetraNode >::global_ordinal_type
GlobalOrdinal global_ordinal_type
Definition: Xpetra_EpetraMap.hpp:309
Teuchos::VERB_HIGH
VERB_HIGH
Xpetra::EpetraMapT< int, EpetraNode >::replaceCommWithSubset
RCP< const Map< int, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &) const
Replace this Map's communicator with a subset communicator.
Definition: Xpetra_EpetraMap.hpp:724
Xpetra::EpetraMapT::getRemoteIndexList
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.
Definition: Xpetra_EpetraMap.hpp:180
Xpetra::EpetraMapT< int, EpetraNode >::getNodeElementList
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.
Definition: Xpetra_EpetraMap.hpp:565
Xpetra::EpetraMapT::replaceCommWithSubset
RCP< const Map< int, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &) const
Replace this Map's communicator with a subset communicator.
Definition: Xpetra_EpetraMap.hpp:248
Xpetra::EpetraMapT::getNodeNumElements
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Definition: Xpetra_EpetraMap.hpp:153
Xpetra::EpetraMapT< int, EpetraNode >::getEpetra_Map
const Epetra_Map & getEpetra_Map() const
Definition: Xpetra_EpetraMap.hpp:758
Xpetra::EpetraMapT::global_ordinal_type
GlobalOrdinal global_ordinal_type
Definition: Xpetra_EpetraMap.hpp:87
Xpetra::EpetraMapT< long long, EpetraNode >::isNodeGlobalElement
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is valid for this Map on this process.
Definition: Xpetra_EpetraMap.hpp:1048
Xpetra::EpetraMapT::map_
RCP< const Epetra_BlockMap > map_
Definition: Xpetra_EpetraMap.hpp:294
Xpetra::EpetraMapT< int, EpetraNode >::getNodeNumElements
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Definition: Xpetra_EpetraMap.hpp:518
Xpetra::EpetraMapT::describe
void describe(Teuchos::FancyOStream &, const Teuchos::EVerbosityLevel=Teuchos::Describable::verbLevel_default) const
Print this object with the given verbosity level to the given Teuchos::FancyOStream.
Definition: Xpetra_EpetraMap.hpp:237
Xpetra_EpetraUtils.hpp
Teuchos::VERB_MEDIUM
VERB_MEDIUM
Xpetra::EpetraMapT< int, EpetraNode >::isDistributed
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
Definition: Xpetra_EpetraMap.hpp:581
Xpetra::EpetraMapT::~EpetraMapT
virtual ~EpetraMapT()
Destructor.
Definition: Xpetra_EpetraMap.hpp:259
Xpetra::EpetraMapT< int, EpetraNode >::getMinAllGlobalIndex
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
Definition: Xpetra_EpetraMap.hpp:536
Xpetra::EpetraMapT< int, EpetraNode >::EpetraMapT
EpetraMapT(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
Definition: Xpetra_EpetraMap.hpp:497
Xpetra::Exceptions::RuntimeError
Exception throws to report errors in the internal logical of the program.
Definition: Xpetra_Exceptions.hpp:102
Teuchos::basic_FancyOStream
Teuchos::ArrayView::size
size_type size() const
Teuchos::OrdinalTraits::one
static T one()
Xpetra::EpetraMapT< int, EpetraNode >::node_type
Node node_type
Definition: Xpetra_EpetraMap.hpp:310
Xpetra::EpetraMapT::getRemoteIndexList
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &, const Teuchos::ArrayView< int > &) const
Return the process ranks for the given global indices.
Definition: Xpetra_EpetraMap.hpp:183
Xpetra::EpetraMapT< long long, EpetraNode >::EpetraMapT
EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with a user-defined contiguous distribution.
Definition: Xpetra_EpetraMap.hpp:875
Xpetra::EpetraMapT< int, EpetraNode >::description
std::string description() const
Return a simple one-line description of this object.
Definition: Xpetra_EpetraMap.hpp:615
Xpetra::EpetraMapT::description
std::string description() const
Return a simple one-line description of this object.
Definition: Xpetra_EpetraMap.hpp:234
Xpetra::EpetraMapT::getMinAllGlobalIndex
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
Definition: Xpetra_EpetraMap.hpp:171
Teuchos::ArrayView::getRawPtr
T * getRawPtr() const
Xpetra::EpetraMapT< int, EpetraNode >::EpetraMapT
EpetraMapT(const Teuchos::RCP< const Epetra_BlockMap > &map)
EpetraMapT constructor to wrap a Epetra_Map object.
Definition: Xpetra_EpetraMap.hpp:747
Xpetra::EpetraMapT< int, EpetraNode >::describe
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print this object with the given verbosity level to the given Teuchos::FancyOStream.
Definition: Xpetra_EpetraMap.hpp:630
Epetra_BlockMap
Teuchos::OrdinalTraits::zero
static T zero()
Xpetra::EpetraMapT::isDistributed
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
Definition: Xpetra_EpetraMap.hpp:204
Xpetra::EpetraMapT< long long, EpetraNode >::getNodeNumElements
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Definition: Xpetra_EpetraMap.hpp:1005
Xpetra::EpetraMapT< int, EpetraNode >::EpetraMapT
EpetraMapT(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed)
Constructor with Tpetra-defined contiguous uniform distribution.
Definition: Xpetra_EpetraMap.hpp:326
Xpetra_ConfigDefs.hpp
Xpetra::EpetraMapT< int, EpetraNode >::isContiguous
bool isContiguous() const
True if this Map is distributed contiguously, else false.
Definition: Xpetra_EpetraMap.hpp:578
Xpetra::EpetraMapT::LocalOrdinal
int LocalOrdinal
Definition: Xpetra_EpetraMap.hpp:83
Xpetra::EpetraMapT< long long, EpetraNode >::lib
UnderlyingLib lib() const
Get the library used by this object (Epetra or Epetra?)
Definition: Xpetra_EpetraMap.hpp:1222
Xpetra::EpetraMapT::removeEmptyProcesses
RCP< const Map< int, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
Definition: Xpetra_EpetraMap.hpp:245
Xpetra::EpetraMapT< long long, EpetraNode >::local_ordinal_type
LocalOrdinal local_ordinal_type
Definition: Xpetra_EpetraMap.hpp:796
Xpetra::EpetraMapT< long long, EpetraNode >::replaceCommWithSubset
RCP< const Map< int, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &) const
Replace this Map's communicator with a subset communicator.
Definition: Xpetra_EpetraMap.hpp:1193
Xpetra::EpetraMapT< long long, EpetraNode >::getMaxLocalIndex
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
Definition: Xpetra_EpetraMap.hpp:1014
Xpetra::EpetraMapT< int, EpetraNode >::~EpetraMapT
virtual ~EpetraMapT()
Destructor.
Definition: Xpetra_EpetraMap.hpp:744
Xpetra::toEpetra
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
Definition: Xpetra_EpetraCrsGraph.cpp:57
Xpetra::EpetraMapT< int, EpetraNode >::GlobalOrdinal
int GlobalOrdinal
Definition: Xpetra_EpetraMap.hpp:304
Xpetra::EpetraMapT::isSameAs
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &) const
True if and only if map is identical to this Map.
Definition: Xpetra_EpetraMap.hpp:210
Xpetra::EpetraMapT< long long, EpetraNode >::isCompatible
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
Definition: Xpetra_EpetraMap.hpp:1057
Xpetra::EpetraMapT< long long, EpetraNode >::getEpetra_BlockMap
const Epetra_BlockMap & getEpetra_BlockMap() const
Get the underlying Epetra map.
Definition: Xpetra_EpetraMap.hpp:1226
Xpetra::EpetraMapT< long long, EpetraNode >::removeEmptyProcesses
RCP< const Map< int, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
Definition: Xpetra_EpetraMap.hpp:1181
Xpetra::EpetraMapT
Definition: Xpetra_EpetraMap.hpp:82
Xpetra::EpetraMapT::getMaxAllGlobalIndex
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
Definition: Xpetra_EpetraMap.hpp:174
Xpetra::EpetraMapT::lib
UnderlyingLib lib() const
Get the library used by this object (Epetra or Epetra?)
Definition: Xpetra_EpetraMap.hpp:269
Xpetra::EpetraMapT::getMaxGlobalIndex
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
Definition: Xpetra_EpetraMap.hpp:168
Xpetra::EpetraMapT< long long, EpetraNode >::getGlobalElement
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
Return the global index for a given local index. Note that this returns -1 if not found on this proce...
Definition: Xpetra_EpetraMap.hpp:1201
Xpetra::UnderlyingLib
UnderlyingLib
Definition: Xpetra_Map_decl.hpp:79
Xpetra::UseEpetra
@ UseEpetra
Definition: Xpetra_Map_decl.hpp:80
Xpetra::EpetraMapT< long long, EpetraNode >::node_type
Node node_type
Definition: Xpetra_EpetraMap.hpp:798
Teuchos::basic_OSTab
Xpetra::EpetraMapT< long long, EpetraNode >::getComm
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
Definition: Xpetra_EpetraMap.hpp:1068
Xpetra::EpetraMapT::local_ordinal_type
int local_ordinal_type
Definition: Xpetra_EpetraMap.hpp:86
Xpetra::EpetraMapT< int, EpetraNode >::getGlobalElement
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
Return the global index for a given local index. Note that this returns -1 if not found on this proce...
Definition: Xpetra_EpetraMap.hpp:732
Xpetra::EpetraMapT< long long, EpetraNode >::GlobalOrdinal
long long GlobalOrdinal
Definition: Xpetra_EpetraMap.hpp:792
Teuchos::OrdinalTraits::invalid
static T invalid()
Xpetra::EpetraMapT::isContiguous
bool isContiguous() const
True if this Map is distributed contiguously, else false.
Definition: Xpetra_EpetraMap.hpp:201
Xpetra::EpetraMapT< long long, EpetraNode >::isDistributed
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
Definition: Xpetra_EpetraMap.hpp:1054
Xpetra::EpetraMapT< int, EpetraNode >::getRemoteIndexList
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_EpetraMap.hpp:556
Xpetra::EpetraMapT< long long, EpetraNode >::EpetraMapT
EpetraMapT(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed)
Constructor with Tpetra-defined contiguous uniform distribution.
Definition: Xpetra_EpetraMap.hpp:814
Xpetra::EpetraMapT< int, EpetraNode >::isCompatible
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
Definition: Xpetra_EpetraMap.hpp:584
Teuchos::Comm
Xpetra::EpetraMapT< int, EpetraNode >::getMaxGlobalIndex
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
Definition: Xpetra_EpetraMap.hpp:533
Xpetra::EpetraMapT::getNodeElementList
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.
Definition: Xpetra_EpetraMap.hpp:188
Xpetra_EpetraConfigDefs.hpp
Xpetra::EpetraMapT< long long, EpetraNode >::isSameAs
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
Definition: Xpetra_EpetraMap.hpp:1060
Xpetra::EpetraMapT::isCompatible
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &) const
True if and only if map is compatible with this Map.
Definition: Xpetra_EpetraMap.hpp:207
Xpetra::EpetraMapT< int, EpetraNode >::getMinGlobalIndex
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Definition: Xpetra_EpetraMap.hpp:530
Xpetra::EpetraMapT< int, EpetraNode >::getMaxAllGlobalIndex
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
Definition: Xpetra_EpetraMap.hpp:539
Teuchos::VERB_EXTREME
VERB_EXTREME
Teuchos::Describable::verbLevel_default
static const EVerbosityLevel verbLevel_default
Xpetra::EpetraMapT::isNodeGlobalElement
bool isNodeGlobalElement(GlobalOrdinal) const
Whether the given global index is valid for this Map on this process.
Definition: Xpetra_EpetraMap.hpp:198
Xpetra::EpetraMapT< int, EpetraNode >::LocalOrdinal
int LocalOrdinal
Definition: Xpetra_EpetraMap.hpp:303
Epetra_Map
Xpetra::EpetraMapT< long long, EpetraNode >::getRemoteIndexList
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_EpetraMap.hpp:1032
TEUCHOS_TEST_FOR_EXCEPTION
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Xpetra::LookupStatus
LookupStatus
Definition: Xpetra_ConfigDefs.hpp:183
XPETRA_MONITOR
#define XPETRA_MONITOR(funcName)
Definition: Xpetra_ConfigDefs.hpp:132
Xpetra::EpetraMapT< long long, EpetraNode >::getNodeElementList
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.
Definition: Xpetra_EpetraMap.hpp:1038
Xpetra::EpetraMapT::getComm
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
Definition: Xpetra_EpetraMap.hpp:218
Xpetra::EpetraMapT< long long, EpetraNode >::LocalOrdinal
int LocalOrdinal
Definition: Xpetra_EpetraMap.hpp:791
Xpetra::EpetraMapT< long long, EpetraNode >::EpetraMapT
EpetraMapT(const Teuchos::RCP< const Epetra_BlockMap > &map)
EpetraMapT constructor to wrap a Epetra_Map object.
Definition: Xpetra_EpetraMap.hpp:1216
Xpetra::EpetraMapT::getMaxLocalIndex
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
Definition: Xpetra_EpetraMap.hpp:162
Xpetra::EpetraMapT< int, EpetraNode >::lib
UnderlyingLib lib() const
Get the library used by this object (Epetra or Epetra?)
Definition: Xpetra_EpetraMap.hpp:753
Xpetra::IDNotPresent
@ IDNotPresent
Definition: Xpetra_ConfigDefs.hpp:185
Xpetra::EpetraMapT::EpetraMapT
EpetraMapT(const Teuchos::RCP< const Epetra_BlockMap > &map)
EpetraMapT constructor to wrap a Epetra_Map object.
Definition: Xpetra_EpetraMap.hpp:262
Xpetra::EpetraMapT< long long, EpetraNode >::getMinLocalIndex
LocalOrdinal getMinLocalIndex() const
The minimum local index.
Definition: Xpetra_EpetraMap.hpp:1011
TEUCHOS_UNREACHABLE_RETURN
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)