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 /* this file is automatically generated - do not edit (see script/epetra.py) */
50 
52 
53 #include "Xpetra_Map.hpp"
54 
55 #include <Epetra_Map.h>
56 #include <Epetra_BlockMap.h>
57 
58 #include "Xpetra_Utils.hpp"
59 #include "Xpetra_EpetraUtils.hpp"
61 
62 #include "Xpetra_ConfigDefs.hpp"
63 
64 namespace Xpetra {
65 
66  // TODO: move that elsewhere
67  template<class GlobalOrdinal>
68  const Epetra_Map & toEpetra(const Map<int,GlobalOrdinal> &);
69  template<class GlobalOrdinal>
70  const Epetra_Map & toEpetra(const RCP< const Map<int, GlobalOrdinal> > &);
71  //template<class GlobalOrdinal>
72  //const RCP< const Map<int, GlobalOrdinal> > toXpetra(const RCP< const Epetra_Map > &);
73  template<class GlobalOrdinal>
74  const RCP< const Map<int, GlobalOrdinal> > toXpetra(const Epetra_BlockMap &);
75  //
76 
77  template<class EpetraGlobalOrdinal>
78  class EpetraMapT
79  : public virtual Map<int, EpetraGlobalOrdinal>
80  {
81  typedef int LocalOrdinal;
82  typedef EpetraGlobalOrdinal GlobalOrdinal;
84 
85  public:
86  typedef int local_ordinal_type;
87  typedef int global_ordinal_type;
89 
91  // Workaround function for a deferred visual studio bug
92  // http://connect.microsoft.com/VisualStudio/feedback/details/719847/erroneous-error-c2783-could-not-deduce-template-argument
93  // Use this function for default arguments rather than calling
94  // what is the return value below. Also helps in reducing
95  // duplication in various constructors.
96  return KokkosClassic::Details::getNode<Node>();
97  }
98 
100 
101 
103  EpetraMapT(global_size_t numGlobalElements,
104  GlobalOrdinal indexBase,
105  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
107  const Teuchos::RCP< Node > &node = defaultArgNode());
108 
110  EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode());
111 
113  EpetraMapT(global_size_t numGlobalElements,
115  GlobalOrdinal indexBase,
116  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
117  const Teuchos::RCP< Node > &node = defaultArgNode());
118 
120 
122 
123 
125  global_size_t getGlobalNumElements() const { XPETRA_MONITOR("EpetraMapT::getGlobalNumElements"); return map_->NumGlobalElements64(); }
126 
128  size_t getNodeNumElements() const { XPETRA_MONITOR("EpetraMapT::getNodeNumElements"); return map_->NumMyElements(); }
129 
131  GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("EpetraMapT::getIndexBase"); return (GlobalOrdinal) map_->IndexBase64(); }
132 
134  LocalOrdinal getMinLocalIndex() const { XPETRA_MONITOR("EpetraMapT::getMinLocalIndex"); return map_->MinLID(); }
135 
137  LocalOrdinal getMaxLocalIndex() const { XPETRA_MONITOR("EpetraMapT::getMaxLocalIndex"); return map_->MaxLID(); }
138 
140  GlobalOrdinal getMinGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMinGlobalIndex"); return (GlobalOrdinal) map_->MinMyGID64(); }
141 
143  GlobalOrdinal getMaxGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMaxGlobalIndex"); return (GlobalOrdinal) map_->MaxMyGID64(); }
144 
146  GlobalOrdinal getMinAllGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMinAllGlobalIndex"); return (GlobalOrdinal) map_->MinAllGID64(); }
147 
149  GlobalOrdinal getMaxAllGlobalIndex() const { XPETRA_MONITOR("EpetraMapT::getMaxAllGlobalIndex"); return (GlobalOrdinal) map_->MaxAllGID64(); }
150 
152  LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("EpetraMapT::getLocalElement"); return map_->LID(globalIndex); }
153 
156 
159 
162 
164 
166 
167 
169  bool isNodeLocalElement(LocalOrdinal localIndex) const { XPETRA_MONITOR("EpetraMapT::isNodeLocalElement"); return map_->MyLID(localIndex); }
170 
172  bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("EpetraMapT::isNodeGlobalElement"); return map_->MyGID(globalIndex); }
173 
175  bool isContiguous() const { XPETRA_MONITOR("EpetraMapT::isContiguous"); return map_->LinearMap(); }
176 
178  bool isDistributed() const { XPETRA_MONITOR("EpetraMapT::isDistributed"); return map_->DistributedGlobal(); }
179 
181  bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("EpetraMapT::isCompatible"); return map_->PointSameAs(toEpetra(map)); }
182 
184  bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("EpetraMapT::isSameAs"); return map_->SameAs(toEpetra(map)); }
185 
187 
189 
190 
192  Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { XPETRA_MONITOR("EpetraMapT::getComm"); return toXpetra(map_->Comm()); }
193 
196 
198 
200 
201 
203  std::string description() const;
204 
207 
209 
211 
212 
215 
218 
220 
222  GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const {
223  XPETRA_MONITOR("EpetraMapT::getGlobalElement");
224 
225  GlobalOrdinal gid = (GlobalOrdinal) map_->GID64(localIndex);
226  if (gid == map_->IndexBase64()-1) return (-1);
227  else return (gid);
228  }
229 
231 
232 
234  virtual ~EpetraMapT() {}
235 
238  : map_(map) {
239  TEUCHOS_TEST_FOR_EXCEPTION(!map->GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraMapT: GlobalOrdinal mismatch.");
240  }
241 
243  UnderlyingLib lib() const { return Xpetra::UseEpetra; }
244 
246  //const RCP< const Epetra_Map > & getEpetra_Map() const { return map_; }
247  const Epetra_BlockMap& getEpetra_BlockMap() const { return *map_; }
248  const Epetra_Map& getEpetra_Map() const { return (Epetra_Map &)*map_; } // Ugly, but the same is done in Epetra_CrsMatrix.h to get the map.
249 
251 
252  protected:
253 
255  //const RCP< const Epetra_BlockMap > map_;
256  //const RCP< const Epetra::Map< LocalOrdinal, GlobalOrdinal, Node > > map_;
257 
258  }; // EpetraMapT class
259 
260 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
262 #endif
263 
264 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
266 #endif
267 
268 // Moving here from cpp since some compilers don't have public visibility of virtual thunks.
269 // https://software.sandia.gov/bugzilla/show_bug.cgi?id=6232
270 
271  // Implementation note for constructors: the Epetra_Comm is cloned in the constructor of Epetra_BlockMap. We don't need to keep a reference on it.
272  // TODO: use toEpetra() function here.
273  template<class EpetraGlobalOrdinal>
275  LocalGlobal lg, const Teuchos::RCP<Node> &node)
276  {
277  // This test come from Tpetra (Epetra doesn't check if numGlobalElements,indexBase are equivalent across images).
278  // 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.
279  std::string errPrefix;
280  errPrefix = Teuchos::typeName(*this) + "::constructor(numGlobal,indexBase,comm,lOrG): ";
281 
282  if (lg == GloballyDistributed) {
283  const int myImageID = comm->getRank();
284 
285  // check that numGlobalElements,indexBase is equivalent across images
286  global_size_t rootNGE = numGlobalElements;
287  GlobalOrdinal rootIB = indexBase;
288  Teuchos::broadcast<int,global_size_t>(*comm,0,&rootNGE);
289  Teuchos::broadcast<int,GlobalOrdinal>(*comm,0,&rootIB);
290  int localChecks[2], globalChecks[2];
291  localChecks[0] = -1; // fail or pass
292  localChecks[1] = 0; // fail reason
293  if (numGlobalElements != rootNGE) {
294  localChecks[0] = myImageID;
295  localChecks[1] = 1;
296  }
297  else if (indexBase != rootIB) {
298  localChecks[0] = myImageID;
299  localChecks[1] = 2;
300  }
301  // REDUCE_MAX will give us the image ID of the highest rank proc that DID NOT pass, as well as the reason
302  // these will be -1 and 0 if all procs passed
303  Teuchos::reduceAll<int,int>(*comm,Teuchos::REDUCE_MAX,2,localChecks,globalChecks);
304  if (globalChecks[0] != -1) {
305  if (globalChecks[1] == 1) {
306  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
307  errPrefix << "numGlobal must be the same on all nodes (examine node " << globalChecks[0] << ").");
308  }
309  else if (globalChecks[1] == 2) {
310  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
311  errPrefix << "indexBase must be the same on all nodes (examine node " << globalChecks[0] << ").");
312  }
313  else {
314  // logic error on our part
315  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
316  errPrefix << "logic error. Please contact the Tpetra team.");
317  }
318  }
319  }
320 
321  // Note: validity of numGlobalElements checked by Epetra.
322 
323  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(static_cast<GlobalOrdinal>(numGlobalElements), 1, indexBase, *toEpetra(comm))))));
324  }
325 
326  template<class EpetraGlobalOrdinal>
327  EpetraMapT<EpetraGlobalOrdinal>::EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase,
328  const Teuchos::RCP<const Teuchos::Comm<int> > &comm, const Teuchos::RCP<Node> &node)
329  {
330  // This test come from Tpetra
331  using Teuchos::outArg;
332 
333  const size_t L0 = Teuchos::OrdinalTraits<size_t>::zero();
334  const size_t L1 = Teuchos::OrdinalTraits<size_t>::one();
338 
339  std::string errPrefix;
340  errPrefix = Teuchos::typeName(*this) + "::constructor(numGlobal,numLocal,indexBase,platform): ";
341 
342  // get a internodal communicator from the Platform
343  const int myImageID = comm->getRank();
344 
345  global_size_t global_sum;
346  { // begin scoping block
347  // for communicating failures
348  int localChecks[2], globalChecks[2];
349  /* compute the global size
350  we are computing the number of global elements because exactly ONE of the following is true:
351  - the user didn't specify it, and we need it
352  - the user did specify it, but we need to
353  + validate it against the sum of the local sizes, and
354  + ensure that it is the same on all nodes
355  */
356  Teuchos::reduceAll<int,global_size_t>(*comm,Teuchos::REDUCE_SUM,
357  Teuchos::as<global_size_t>(numLocalElements),outArg(global_sum));
358  /* there are three errors we should be detecting:
359  - numGlobalElements != invalid() and it is incorrect/invalid
360  - numLocalElements invalid (<0)
361  */
362  localChecks[0] = -1;
363  localChecks[1] = 0;
364  if (numLocalElements < L1 && numLocalElements != L0) {
365  // invalid
366  localChecks[0] = myImageID;
367  localChecks[1] = 1;
368  }
369  else if (numGlobalElements < GST1 && numGlobalElements != GST0 && numGlobalElements != GSTI) {
370  // invalid
371  localChecks[0] = myImageID;
372  localChecks[1] = 2;
373  }
374  else if (numGlobalElements != GSTI && numGlobalElements != global_sum) {
375  // incorrect
376  localChecks[0] = myImageID;
377  localChecks[1] = 3;
378  }
379  // now check that indexBase is equivalent across images
380  GlobalOrdinal rootIB = indexBase;
381  Teuchos::broadcast<int,GlobalOrdinal>(*comm,0,&rootIB); // broadcast one ordinal from node 0
382  if (indexBase != rootIB) {
383  localChecks[0] = myImageID;
384  localChecks[1] = 4;
385  }
386  // REDUCE_MAX will give us the image ID of the highest rank proc that DID NOT pass
387  // this will be -1 if all procs passed
388  Teuchos::reduceAll<int,int>(*comm,Teuchos::REDUCE_MAX,2,localChecks,globalChecks);
389  if (globalChecks[0] != -1) {
390  if (globalChecks[1] == 1) {
391  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
392  errPrefix << "numLocal is not valid on at least one node (possibly node "
393  << globalChecks[0] << ").");
394  }
395  else if (globalChecks[1] == 2) {
396  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
397  errPrefix << "numGlobal is not valid on at least one node (possibly node "
398  << globalChecks[0] << ").");
399  }
400  else if (globalChecks[1] == 3) {
401  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
402  errPrefix << "numGlobal doesn't match sum of numLocal (== "
403  << global_sum << ") on at least one node (possibly node "
404  << globalChecks[0] << ").");
405  }
406  else if (globalChecks[1] == 4) {
407  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
408  errPrefix << "indexBase is not the same on all nodes (examine node "
409  << globalChecks[0] << ").");
410  }
411  else {
412  // logic error on my part
413  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
414  errPrefix << "logic error. Please contact the Tpetra team.");
415  }
416  }
417 
418  }
419 
420  // set numGlobalElements
421  if (numGlobalElements == GSTI) {
422  numGlobalElements = global_sum;}
423 
424  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(static_cast<GlobalOrdinal>(numGlobalElements), numLocalElements, 1, indexBase, *toEpetra(comm))))));
425  }
426 
427  // TODO: UnitTest FAILED
428  template<class EpetraGlobalOrdinal>
430  const Teuchos::RCP<const Teuchos::Comm<int> > &comm, const Teuchos::RCP<Node> &node)
431  {
432  if (numGlobalElements == Teuchos::OrdinalTraits<global_size_t>::invalid()) {
433  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(-1, elementList.size(), elementList.getRawPtr(), 1, indexBase, *toEpetra(comm))))));
434  } else {
435  IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG((map_ = (rcp(new Epetra_BlockMap(numGlobalElements, elementList.size(), elementList.getRawPtr(), 1, indexBase, *toEpetra(comm))))));
436  }
437  }
438 
439 
440  template<class EpetraGlobalOrdinal>
441  LookupStatus EpetraMapT<EpetraGlobalOrdinal>::getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< int > &LIDList) const { XPETRA_MONITOR("EpetraMapT::getRemoteIndexList"); return toXpetra(map_->RemoteIDList(GIDList.size(), GIDList.getRawPtr(), nodeIDList.getRawPtr(), LIDList.getRawPtr())); }
442 
443  template<class EpetraGlobalOrdinal>
444  LookupStatus EpetraMapT<EpetraGlobalOrdinal>::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)); }
445 
446 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
447  template<> inline
448  Teuchos::ArrayView< const int > EpetraMapT<int>::getNodeElementList() const { XPETRA_MONITOR("EpetraMapT::getNodeElementList"); return ArrayView< const GlobalOrdinal >(map_->MyGlobalElements(), map_->NumMyElements()); /* Note: this method return a const array, so it is safe to use directly the internal array. */ }
449 #endif
450 
451 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
452  template<> inline
453  Teuchos::ArrayView< const long long > EpetraMapT<long long>::getNodeElementList() const { XPETRA_MONITOR("EpetraMapT::getNodeElementList"); return ArrayView< const GlobalOrdinal >(map_->MyGlobalElements64(), map_->NumMyElements()); /* Note: this method return a const array, so it is safe to use directly the internal array. */ }
454 #endif
455 
456  template<class EpetraGlobalOrdinal>
459  {
460  XPETRA_MONITOR("EpetraMapT<EpetraGlobalOrdinal>::getNode");
462  } //removed &
463 
464  template<class EpetraGlobalOrdinal>
466  const Epetra_BlockMap * NewMap = map_->RemoveEmptyProcesses();
467  if (!NewMap) {
468  return Teuchos::null;
469  } else {
470  const RCP< const Map<int, GlobalOrdinal> > NewMapX = toXpetra<GlobalOrdinal>(*NewMap);
471  delete NewMap; // NOTE: toXpetra *copys* the epetra map rather than wrapping it, so we have to delete NewMap to avoid a memory leak.
472  return NewMapX;
473  }
474  }
475 
476  template<class EpetraGlobalOrdinal>
478  throw std::runtime_error("Xpetra::EpetraMapT::replaceCommWithSubset has not yet been implemented.");
479  return Teuchos::null;
480  }
481 
482  template<class EpetraGlobalOrdinal>
484  XPETRA_MONITOR("EpetraMapT::description");
485 
486  // This implementation come from Tpetra_Map_def.hpp (without modification)
487  std::ostringstream oss;
489  oss << "{getGlobalNumElements() = " << getGlobalNumElements()
490  << ", getNodeNumElements() = " << getNodeNumElements()
491  << ", isContiguous() = " << isContiguous()
492  << ", isDistributed() = " << isDistributed()
493  << "}";
494  return oss.str();
495  }
496 
497  template<class EpetraGlobalOrdinal>
499  XPETRA_MONITOR("EpetraMapT::describe");
500 
502 
503  // This implementation come from Tpetra_Map_def.hpp (without modification)
504  using std::endl;
505  using std::setw;
506  using Teuchos::VERB_DEFAULT;
507  using Teuchos::VERB_NONE;
508  using Teuchos::VERB_LOW;
509  using Teuchos::VERB_MEDIUM;
510  using Teuchos::VERB_HIGH;
511  using Teuchos::VERB_EXTREME;
512 
513  const size_t nME = getNodeNumElements();
515  int myImageID = comm_->getRank();
516  int numImages = comm_->getSize();
517 
518  Teuchos::EVerbosityLevel vl = verbLevel;
519  if (vl == VERB_DEFAULT) vl = VERB_LOW;
520 
521  size_t width = 1;
522  for (size_t dec=10; dec<getGlobalNumElements(); dec *= 10) {
523  ++width;
524  }
525  width = ::std::max<size_t>(width, (size_t) 12) + 2; // casting to size_t to avoid ambiguity error when compiling Sacado.
526 
527  Teuchos::OSTab tab(out);
528 
529  if (vl == VERB_NONE) {
530  // do nothing
531  }
532  else if (vl == VERB_LOW) {
533  out << this->description() << endl;
534  }
535  else { // MEDIUM, HIGH or EXTREME
536  for (int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
537  if (myImageID == imageCtr) {
538  if (myImageID == 0) { // this is the root node (only output this info once)
539  out << endl
540  << "Number of Global Entries = " << getGlobalNumElements() << endl
541  << "Maximum of all GIDs = " << getMaxAllGlobalIndex() << endl
542  << "Minimum of all GIDs = " << getMinAllGlobalIndex() << endl
543  << "Index Base = " << getIndexBase() << endl;
544  }
545  out << endl;
546  if (vl == VERB_HIGH || vl == VERB_EXTREME) {
547  out << "Number of Local Elements = " << nME << endl
548  << "Maximum of my GIDs = " << getMaxGlobalIndex() << endl
549  << "Minimum of my GIDs = " << getMinGlobalIndex() << endl;
550  out << endl;
551  }
552  if (vl == VERB_EXTREME) {
553  out << std::setw(width) << "Node ID"
554  << std::setw(width) << "Local Index"
555  << std::setw(width) << "Global Index"
556  << endl;
557  for (size_t i=0; i < nME; i++) {
558  out << std::setw(width) << myImageID
559  << std::setw(width) << i
560  << std::setw(width) << myEntries[i]
561  << endl;
562  }
563  out << std::flush;
564  }
565  }
566  // Do a few global ops to give I/O a chance to complete
567  comm_->barrier();
568  comm_->barrier();
569  comm_->barrier();
570  }
571  }
572  }
573 
574 
575 
576 
577 } // Xpetra namespace
578 
579 #endif // XPETRA_EPETRAMAP_HPP
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...
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is valid for this Map on this process.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal > > &graph)
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Map< int, GlobalOrdinal >::node_type Node
Node node_type
Definition: Xpetra_Map.hpp:72
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Xpetra namespace
size_type size() const
static Teuchos::RCP< Node > defaultArgNode()
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.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
RCP< const CrsGraph< int, GlobalOrdinal > > toXpetra(const Epetra_CrsGraph &g)
GlobalOrdinal getIndexBase() const
The index base for this Map.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
std::string description() const
Return a simple one-line description of this object.
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.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
EpetraMapT(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed, const Teuchos::RCP< Node > &node=defaultArgNode())
Constructor with Tpetra-defined contiguous uniform distribution.
#define IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG(sourceCode)
EpetraGlobalOrdinal GlobalOrdinal
virtual std::string description() const
EpetraMapT(const Teuchos::RCP< const Epetra_BlockMap > &map)
EpetraMapT constructor to wrap a Epetra_Map object.
RCP< const Map< int, GlobalOrdinal > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map&#39;s communicator with a subset communicator.
Teuchos::RCP< Node > getNode() const
Get this Map&#39;s Node object.
T * getRawPtr() const
RCP< const Epetra_BlockMap > map_
EpetraMapT< long long > EpetraMap64
UnderlyingLib lib() const
Get the library used by this object (Epetra or Epetra?)
RCP< const Map< int, GlobalOrdinal > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
size_t global_size_t
Global size_t object.
static const EVerbosityLevel verbLevel_default
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on this process.
EpetraMapT< int > EpetraMap
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
static Teuchos::RCP< DefaultNodeType > getDefaultNode()
LocalOrdinal getMinLocalIndex() const
The minimum local index.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map&#39;s Comm object.
#define XPETRA_MONITOR(funcName)
Map< int, int >::node_type node_type
const Epetra_Map & getEpetra_Map() const
virtual ~EpetraMapT()
Destructor.
const Epetra_BlockMap & getEpetra_BlockMap() const
Get the underlying Epetra map.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
std::string typeName(const T &t)
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.