All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Xpetra_TpetraMap.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_TPETRAMAP_HPP
47 #define XPETRA_TPETRAMAP_HPP
48 
49 /* this file is automatically generated - do not edit (see script/tpetra.py) */
50 
52 
53 #include <Tpetra_Map.hpp>
54 
55 #include "Xpetra_Map.hpp"
56 #include "Xpetra_Utils.hpp"
57 
58 #include "Xpetra_Exceptions.hpp"
59 
60 namespace Xpetra {
61 
62  // TODO: move that elsewhere
63  template <class LocalOrdinal, class GlobalOrdinal, class Node>
64  const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node>& toTpetra(const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node>&);
65 
66  template <class LocalOrdinal, class GlobalOrdinal, class Node>
67  const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node > > toTpetra(const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >&);
68 
69  template <class LocalOrdinal, class GlobalOrdinal, class Node>
70  const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node > > toXpetra(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >&);
71 
72  template <class LocalOrdinal, class GlobalOrdinal, class Node>
73  const RCP<Map<LocalOrdinal,GlobalOrdinal,Node > > toXpetraNonConst(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >&);
74  //
75 
76  template <class LocalOrdinal = Map<>::local_ordinal_type,
77  class GlobalOrdinal = typename Map<LocalOrdinal>::global_ordinal_type,
78  class Node = typename Map<LocalOrdinal, GlobalOrdinal>::node_type>
79  class TpetraMap
80  : public virtual Map<LocalOrdinal,GlobalOrdinal,Node> {
81 
82  public:
83 
85 
86 
88 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
89  TPETRA_DEPRECATED
90  TpetraMap (global_size_t numGlobalElements,
91  GlobalOrdinal indexBase,
92  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
93  LocalGlobal lg,
94  const Teuchos::RCP< Node > & /* node */)
95  : TpetraMap(numGlobalElements, indexBase, comm, lg)
96  {}
97 #endif // TPETRA_ENABLE_DEPRECATED_CODE
98  TpetraMap (global_size_t numGlobalElements,
99  GlobalOrdinal indexBase,
100  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
102  : map_ (Teuchos::rcp (new Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > (numGlobalElements,
103  indexBase, comm,
104  toTpetra(lg))))
105  {}
106 
108 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
109  TPETRA_DEPRECATED
110  TpetraMap (global_size_t numGlobalElements,
111  size_t numLocalElements,
112  GlobalOrdinal indexBase,
113  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
114  const Teuchos::RCP< Node > & /* node */)
115  : TpetraMap(numGlobalElements, numLocalElements, indexBase, comm)
116  {}
117 #endif // TPETRA_ENABLE_DEPRECATED_CODE
118  TpetraMap (global_size_t numGlobalElements,
119  size_t numLocalElements,
120  GlobalOrdinal indexBase,
121  const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
122  : map_ (Teuchos::rcp (new Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > (numGlobalElements,
123  numLocalElements,
124  indexBase, comm)))
125  {}
126 
128 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
129  TPETRA_DEPRECATED
130  TpetraMap (global_size_t numGlobalElements,
132  GlobalOrdinal indexBase,
133  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
134  const Teuchos::RCP< Node > & /* node */)
135  : TpetraMap(numGlobalElements, elementList, indexBase, comm)
136  {}
137 #endif // TPETRA_ENABLE_DEPRECATED_CODE
138  TpetraMap (global_size_t numGlobalElements,
140  GlobalOrdinal indexBase,
141  const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
142  : map_(Teuchos::rcp(new Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >(numGlobalElements,
143  elementList,
144  indexBase,
145  comm)))
146  {}
147 
148 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
149 #ifdef HAVE_XPETRA_TPETRA
150  TpetraMap (global_size_t numGlobalElements,
152  const Kokkos::View<const GlobalOrdinal*, typename Node::device_type>& indexList,
153  GlobalOrdinal indexBase,
154  const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
155  : map_(Teuchos::rcp(new Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >(numGlobalElements,
156  indexList,
157  indexBase,
158  comm)))
159  {}
160 #endif
161 #endif
162 
165 
167 
169 
170 
172  global_size_t getGlobalNumElements() const { XPETRA_MONITOR("TpetraMap::getGlobalNumElements"); return map_->getGlobalNumElements(); }
173 
175  size_t getNodeNumElements() const { XPETRA_MONITOR("TpetraMap::getNodeNumElements"); return map_->getNodeNumElements(); }
176 
178  GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("TpetraMap::getIndexBase"); return map_->getIndexBase(); }
179 
181  LocalOrdinal getMinLocalIndex() const { XPETRA_MONITOR("TpetraMap::getMinLocalIndex"); return map_->getMinLocalIndex(); }
182 
184  LocalOrdinal getMaxLocalIndex() const { XPETRA_MONITOR("TpetraMap::getMaxLocalIndex"); return map_->getMaxLocalIndex(); }
185 
187  GlobalOrdinal getMinGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMinGlobalIndex"); return map_->getMinGlobalIndex(); }
188 
190  GlobalOrdinal getMaxGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMaxGlobalIndex"); return map_->getMaxGlobalIndex(); }
191 
193  GlobalOrdinal getMinAllGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMinAllGlobalIndex"); return map_->getMinAllGlobalIndex(); }
194 
196  GlobalOrdinal getMaxAllGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMaxAllGlobalIndex"); return map_->getMaxAllGlobalIndex(); }
197 
199  LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("TpetraMap::getLocalElement"); return map_->getLocalElement(globalIndex); }
200 
202  GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { XPETRA_MONITOR("TpetraMap::getGlobalElement"); return map_->getGlobalElement(localIndex); }
203 
205  LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const { XPETRA_MONITOR("TpetraMap::getRemoteIndexList"); return toXpetra(map_->getRemoteIndexList(GIDList, nodeIDList, LIDList)); }
206 
208  LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const { XPETRA_MONITOR("TpetraMap::getRemoteIndexList"); return toXpetra(map_->getRemoteIndexList(GIDList, nodeIDList)); }
209 
211  Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const { XPETRA_MONITOR("TpetraMap::getNodeElementList"); return map_->getNodeElementList(); }
212 
214 
216 
217 
219  bool isNodeLocalElement(LocalOrdinal localIndex) const { XPETRA_MONITOR("TpetraMap::isNodeLocalElement"); return map_->isNodeLocalElement(localIndex); }
220 
222  bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("TpetraMap::isNodeGlobalElement"); return map_->isNodeGlobalElement(globalIndex); }
223 
225  bool isContiguous() const { XPETRA_MONITOR("TpetraMap::isContiguous"); return map_->isContiguous(); }
226 
228  bool isDistributed() const { XPETRA_MONITOR("TpetraMap::isDistributed"); return map_->isDistributed(); }
229 
231  bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("TpetraMap::isCompatible"); return map_->isCompatible(toTpetra(map)); }
232 
234  bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("TpetraMap::isSameAs"); return map_->isSameAs(toTpetra(map)); }
235 
237 
239 
240 
242  Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { XPETRA_MONITOR("TpetraMap::getComm"); return map_->getComm(); }
243 
244 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
245  Teuchos::RCP< Node > getNode() const { XPETRA_MONITOR("TpetraMap::getNode"); return map_->getNode(); }
247 #endif // TPETRA_ENABLE_DEPRECATED_CODE
248 
250 
252 
253 
255  std::string description() const { XPETRA_MONITOR("TpetraMap::description"); return map_->description(); }
256 
258  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { XPETRA_MONITOR("TpetraMap::describe"); map_->describe(out, verbLevel); }
259 
261  return toXpetra(map_->removeEmptyProcesses());
262  }
264  return toXpetra(map_->replaceCommWithSubset(newComm));
265  }
266 
267 #ifdef XPETRA_ENABLE_DEPRECATED_CODE
268  template<class Node2>
269  RCP<Map<LocalOrdinal, GlobalOrdinal, Node2> > XPETRA_DEPRECATED clone(const RCP<Node2> &node2) const {
270  return toXpetraNonConst(map_->clone(node2));
271  }
272 #endif
273 
275 
277 
278 
280  TpetraMap(const Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map)
281  : map_(map) { }
282 
284  UnderlyingLib lib() const { return UseTpetra; }
285 
288 
289 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
290 #ifdef HAVE_XPETRA_TPETRA
291  using local_map_type = typename Map<LocalOrdinal, GlobalOrdinal, Node>::local_map_type;
293  local_map_type getLocalMap () const {
294  return map_->getLocalMap();
295  }
296 #endif
297 #endif
298 
300 
301  protected:
302 
304 
305  }; // TpetraMap class
306 
307  // TODO: move that elsewhere
308  template <class LocalOrdinal, class GlobalOrdinal, class Node>
309  const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> & toTpetra(const Map<LocalOrdinal,GlobalOrdinal,Node> &map) {
310  // TODO: throw exception
311  const TpetraMap<LocalOrdinal,GlobalOrdinal,Node> & tpetraMap = dynamic_cast<const TpetraMap<LocalOrdinal,GlobalOrdinal,Node> &>(*map.getMap());
312  return *tpetraMap.getTpetra_Map();
313  }
314 
315  template <class LocalOrdinal, class GlobalOrdinal, class Node>
317  typedef TpetraMap<LocalOrdinal, GlobalOrdinal, Node> TpetraMapClass;
318  if (map != Teuchos::null) {
319  XPETRA_RCP_DYNAMIC_CAST(const TpetraMapClass, map->getMap(), tpetraMap, "toTpetra");
320  return tpetraMap->getTpetra_Map();
321  }
322  return Teuchos::null;
323  }
324 
325  // In some cases (for instance, in MueLu adapter to Tpetra operator), we need to return a reference. This is only possible if
326  // we assume that the map argument is nonzero
327  template <class LocalOrdinal, class GlobalOrdinal, class Node>
329  TEUCHOS_TEST_FOR_EXCEPTION(map.is_null(), std::invalid_argument, "map must be nonzero");
330  typedef TpetraMap<LocalOrdinal, GlobalOrdinal, Node> TpetraMapClass;
331  XPETRA_RCP_DYNAMIC_CAST(const TpetraMapClass, map->getMap(), tpetraMap, "toTpetra");
332  return tpetraMap->getTpetra_Map();
333  }
334 
335  template <class LocalOrdinal, class GlobalOrdinal, class Node>
336  const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > toXpetra(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& map) {
337  if (!map.is_null())
339 
340  return Teuchos::null;
341  }
342 
343  template <class LocalOrdinal, class GlobalOrdinal, class Node>
344  const RCP<Map<LocalOrdinal,GlobalOrdinal,Node> > toXpetraNonConst(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& map) {
345  if (!map.is_null())
347 
348  return Teuchos::null;
349  }
350 
351  // TODO: removed (but currently used in unit test)
352  namespace useTpetra {
353 
355 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
356  template <class LocalOrdinal, class GlobalOrdinal, class Node>
357  TPETRA_DEPRECATED
359  createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > & /* node */)
360  {
361  return createLocalMapWithNode<LocalOrdinal,GlobalOrdinal,Node>
362  (numElements, comm);
363  }
364 #endif // TPETRA_ENABLE_DEPRECATED_CODE
365  template <class LocalOrdinal, class GlobalOrdinal, class Node>
367  createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
368  {
369  XPETRA_MONITOR("useTpetra::createLocalMapWithNode");
370 
371  return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal,Node>(Tpetra::createLocalMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(numElements, comm)));
372  }
373 
375  template <class LocalOrdinal, class GlobalOrdinal>
377  createContigMap(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm) {
378  XPETRA_MONITOR("useTpetra::createContigMap");
379 
380  return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal>(Tpetra::createContigMap<LocalOrdinal,GlobalOrdinal>(numElements, localNumElements, comm)));
381  }
382 
384 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
385  template <class LocalOrdinal, class GlobalOrdinal, class Node>
386  TPETRA_DEPRECATED
388  createContigMapWithNode(global_size_t numElements, size_t localNumElements,
389  const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const TPETRA_DEPRECATED Teuchos::RCP< Node > & /* node */ )
390  {
391  return createContigMapWithNode<LocalOrdinal,GlobalOrdinal,Node>
392  (numElements, localNumElements, comm);
393  }
394 #endif // TPETRA_ENABLE_DEPRECATED_CODE
395  template <class LocalOrdinal, class GlobalOrdinal, class Node>
397  createContigMapWithNode(global_size_t numElements, size_t localNumElements,
398  const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
399  {
400  XPETRA_MONITOR("useTpetra::createContigMap");
401  return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal,Node>(Tpetra::createContigMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(numElements, localNumElements, comm)));
402  }
403  } // useTpetra namespace
404 
405  // TODO: move that elsewhere
406  template <class LocalOrdinal, class GlobalOrdinal, class Node>
407  const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node>& toTpetra(const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node>&);
408 
409  template <class LocalOrdinal, class GlobalOrdinal, class Node>
410  const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node > > toTpetra(const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >&);
411 
412  template <class LocalOrdinal, class GlobalOrdinal, class Node>
413  const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node > > toXpetra(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >&);
414 
415  template <class LocalOrdinal, class GlobalOrdinal, class Node>
416  const RCP<Map<LocalOrdinal,GlobalOrdinal,Node > > toXpetraNonConst(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >&);
417 
418 #ifdef HAVE_XPETRA_EPETRA
419 
420 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
421  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
422 
423  // specialization for Tpetra Map on EpetraNode and GO=int
424  template <>
425  class TpetraMap<int, int, EpetraNode>
426  : public virtual Map<int,int,EpetraNode> {
427 
428  public:
429  typedef int GlobalOrdinal;
430  typedef int LocalOrdinal;
431  typedef EpetraNode Node;
432 
434 
435 
437 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
438  TPETRA_DEPRECATED
439  TpetraMap (global_size_t numGlobalElements,
440  GlobalOrdinal indexBase,
441  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
442  LocalGlobal lg,
443  const Teuchos::RCP< Node > & /*node*/)
444  : TpetraMap(numGlobalElements, indexBase, comm, lg)
445  {}
446 #endif // TPETRA_ENABLE_DEPRECATED_CODE
447  TpetraMap (global_size_t numGlobalElements,
448  GlobalOrdinal indexBase,
449  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
452  }
453 
455 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
456  TPETRA_DEPRECATED
457  TpetraMap (global_size_t numGlobalElements,
458  size_t numLocalElements,
459  GlobalOrdinal indexBase,
460  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
461  const Teuchos::RCP< Node > & /*node */)
462  : TpetraMap(numGlobalElements, numLocalElements, indexBase, comm)
463  {}
464 #endif // TPETRA_ENABLE_DEPRECATED_CODE
465  TpetraMap (global_size_t numGlobalElements,
466  size_t numLocalElements,
467  GlobalOrdinal indexBase,
468  const Teuchos::RCP< const Teuchos::Comm< int > > &comm) {
470  }
471 
473 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
474  TPETRA_DEPRECATED
475  TpetraMap (global_size_t numGlobalElements,
477  GlobalOrdinal indexBase,
478  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
479  const Teuchos::RCP< Node > & /* node */)
480  : TpetraMap(numGlobalElements, elementList, indexBase, comm)
481  {}
482 #endif // TPETRA_ENABLE_DEPRECATED_CODE
483  TpetraMap (global_size_t numGlobalElements,
485  GlobalOrdinal indexBase,
486  const Teuchos::RCP< const Teuchos::Comm< int > > &comm) {
488  }
489 
492 
494 
496 
497 
499  global_size_t getGlobalNumElements() const { return 0; }
500 
502  size_t getNodeNumElements() const { return 0; }
503 
505  GlobalOrdinal getIndexBase() const { return 0; }
506 
508  LocalOrdinal getMinLocalIndex() const { return 0; }
509 
511  LocalOrdinal getMaxLocalIndex() const { return 0; }
512 
514  GlobalOrdinal getMinGlobalIndex() const { return 0; }
515 
517  GlobalOrdinal getMaxGlobalIndex() const { return 0; }
518 
520  GlobalOrdinal getMinAllGlobalIndex() const { return 0; }
521 
523  GlobalOrdinal getMaxAllGlobalIndex() const { return 0; }
524 
526  LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { return 0; }
527 
529  GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { return 0; }
530 
533 
536 
539 
541 
543 
544 
546  bool isNodeLocalElement(LocalOrdinal localIndex) const { return false; }
547 
549  bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { return false; }
550 
552  bool isContiguous() const { return false; }
553 
555  bool isDistributed() const { return false; }
556 
558  bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
559 
561  bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
562 
564 
566 
567 
569  Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { return Teuchos::null; }
570 
571 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
572  Teuchos::RCP< Node > getNode() const { return Teuchos::null; }
574 #endif // TPETRA_ENABLE_DEPRECATED_CODE
575 
577 
579 
580 
582  std::string description() const { return std::string(""); }
583 
586 
589 
590 #ifdef XPETRA_ENABLE_DEPRECATED_CODE
591  template<class Node2>
592  RCP<Map<LocalOrdinal, GlobalOrdinal, Node2> > XPETRA_DEPRECATED clone(const RCP<Node2> &node2) const { return Teuchos::null; }
593 #endif
594 
595 
597 
598 
600  TpetraMap(const Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map) {
602  }
603 
605  UnderlyingLib lib() const { return UseTpetra; }
606 
609 
610 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
611 #ifdef HAVE_XPETRA_TPETRA
612  using local_map_type = typename Map<LocalOrdinal, GlobalOrdinal, Node>::local_map_type;
614  local_map_type getLocalMap () const {
615  return local_map_type();
616  }
617 #endif
618 #endif
619 
621 
622  }; // TpetraMap class (specialization for GO=int and NO=EpetraNode)
623 #endif
624 
625 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
626  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
627  // specialization for Tpetra Map on EpetraNode and GO=int
628  template <>
629  class TpetraMap<int, long long, EpetraNode>
630  : public virtual Map<int,long long,EpetraNode> {
631 
632  public:
633  typedef long long GlobalOrdinal;
634  typedef int LocalOrdinal;
635  typedef EpetraNode Node;
636 
638 
639 
641 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
642  TPETRA_DEPRECATED
643  TpetraMap (global_size_t numGlobalElements,
644  GlobalOrdinal indexBase,
645  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
646  LocalGlobal lg,
647  const Teuchos::RCP< Node > & /* node */)
648  : TpetraMap(numGlobalElements, indexBase, comm, lg)
649  {}
650 #endif // TPETRA_ENABLE_DEPRECATED_CODE
651  TpetraMap (global_size_t numGlobalElements,
652  GlobalOrdinal indexBase,
653  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
656  }
657 
659 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
660  TPETRA_DEPRECATED
661  TpetraMap (global_size_t numGlobalElements,
662  size_t numLocalElements,
663  GlobalOrdinal indexBase,
664  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
665  const Teuchos::RCP< Node > & /* node */)
666  : TpetraMap(numGlobalElements, numLocalElements, indexBase, comm)
667  {}
668 #endif // TPETRA_ENABLE_DEPRECATED_CODE
669  TpetraMap (global_size_t numGlobalElements,
670  size_t numLocalElements,
671  GlobalOrdinal indexBase,
672  const Teuchos::RCP< const Teuchos::Comm< int > > &comm) {
674  }
675 
677 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
678  TPETRA_DEPRECATED
679  TpetraMap (global_size_t numGlobalElements,
681  GlobalOrdinal indexBase,
682  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
683  const Teuchos::RCP< Node > & /* node */)
684  : TpetraMap(numGlobalElements, elementList, indexBase, comm)
685  {}
686 #endif // TPETRA_ENABLE_DEPRECATED_CODE
687  TpetraMap (global_size_t numGlobalElements,
689  GlobalOrdinal indexBase,
690  const Teuchos::RCP< const Teuchos::Comm< int > > &comm) {
692  }
693 
696 
698 
700 
701 
703  global_size_t getGlobalNumElements() const { return 0; }
704 
706  size_t getNodeNumElements() const { return 0; }
707 
709  GlobalOrdinal getIndexBase() const { return 0; }
710 
712  LocalOrdinal getMinLocalIndex() const { return 0; }
713 
715  LocalOrdinal getMaxLocalIndex() const { return 0; }
716 
718  GlobalOrdinal getMinGlobalIndex() const { return 0; }
719 
721  GlobalOrdinal getMaxGlobalIndex() const { return 0; }
722 
724  GlobalOrdinal getMinAllGlobalIndex() const { return 0; }
725 
727  GlobalOrdinal getMaxAllGlobalIndex() const { return 0; }
728 
730  LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { return 0; }
731 
733  GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { return 0; }
734 
737 
740 
743 
745 
747 
748 
750  bool isNodeLocalElement(LocalOrdinal localIndex) const { return false; }
751 
753  bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { return false; }
754 
756  bool isContiguous() const { return false; }
757 
759  bool isDistributed() const { return false; }
760 
762  bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
763 
765  bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
766 
768 
770 
771 
773  Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { return Teuchos::null; }
774 
775 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
776  Teuchos::RCP< Node > getNode() const { return Teuchos::null; }
778 #endif // TPETRA_ENABLE_DEPRECATED_CODE
779 
781 
783 
784 
786  std::string description() const { return std::string(""); }
787 
790 
793 
794 #ifdef XPETRA_ENABLE_DEPRECATED_CODE
795  template<class Node2>
796  RCP<Map<LocalOrdinal, GlobalOrdinal, Node2> > XPETRA_DEPRECATED clone(const RCP<Node2> &node2) const { return Teuchos::null; }
797 #endif
798 
799 
801 
802 
804  TpetraMap(const Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map) {
806  }
807 
809  UnderlyingLib lib() const { return UseTpetra; }
810 
813 
814 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
815 #ifdef HAVE_XPETRA_TPETRA
816  using local_map_type = typename Map<LocalOrdinal, GlobalOrdinal, Node>::local_map_type;
818  local_map_type getLocalMap () const {
819  // We will never be here, this is a stub class
820  return local_map_type();
821  }
822 #endif
823 #endif
824 
826  }; // TpetraMap class (specialization for GO=int and NO=EpetraNode)
827 #endif
828 
829 #endif // HAVE_XPETRA_EPETRA
830 
831 } // Xpetra namespace
832 
833 // TODO: remove?
835 template <class LocalOrdinal, class GlobalOrdinal, class Node>
837  XPETRA_MONITOR("TpetraMap==TpetraMap");
838  return map1.isSameAs(map2);
839 }
840 
842 template <class LocalOrdinal, class GlobalOrdinal, class Node>
844  XPETRA_MONITOR("TpetraMap!=TpetraMap");
845  return !map1.isSameAs(map2);
846 }
847 
848 #define XPETRA_TPETRAMAP_SHORT
849 #endif // XPETRA_TPETRAMAP_HPP
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map&#39;s communicator with a subset communicator.
bool operator!=(const Xpetra::TpetraMap< LocalOrdinal, GlobalOrdinal, Node > &map1, const Xpetra::TpetraMap< LocalOrdinal, GlobalOrdinal, Node > &map2)
Returns true if map is not identical to this map. Implemented in TpetraMap::isSameAs().
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
RCP< Map< LocalOrdinal, GlobalOrdinal, Node2 > > clone(const Map< LocalOrdinal, GlobalOrdinal, Node1 > &map, const RCP< Node2 > &node2)
TpetraMap(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.
std::string description() const
Return a simple one-line description of this object.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
TpetraMap(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with a user-defined contiguous distribution.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
Teuchos::RCP< const TpetraMap< LocalOrdinal, GlobalOrdinal > > createContigMap(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member function to create a (potentially) non-uniform, contiguous Map with the default node...
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > toTpetraNonZero(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
TpetraMap(const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
TpetraMap constructor to wrap a Tpetra::Map object.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process IDs for the given global IDs.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
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 FancyOStream.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const
Return the process IDs and corresponding local IDs for the given global IDs.
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 FancyOStream.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
~TpetraMap()
Destructor.
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 FancyOStream.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
GlobalOrdinal getIndexBase() const
The index base for this Map.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process IDs for the given global IDs.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map&#39;s communicator with a subset communicator.
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Definition: Xpetra_Map.hpp:222
TpetraMap(const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
TpetraMap constructor to wrap a Tpetra::Map object.
Teuchos::RCP< const TpetraMap< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member function to create a locally replicated Map with a specified node.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map&#39;s Comm object.
TpetraMap(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with a user-defined contiguous distribution.
TpetraMap(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with a user-defined contiguous distribution.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process IDs for the given global IDs.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map&#39;s Comm object.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
const RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > toXpetraNonConst(const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &)
bool isContiguous() const
True if this Map is distributed contiguously, else false.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
size_t global_size_t
Global size_t object.
static const EVerbosityLevel verbLevel_default
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
GlobalOrdinal getIndexBase() const
The index base for this Map.
GlobalOrdinal getIndexBase() const
The index base for this Map.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
bool operator==(const Xpetra::TpetraMap< LocalOrdinal, GlobalOrdinal, Node > &map1, const Xpetra::TpetraMap< LocalOrdinal, GlobalOrdinal, Node > &map2)
Returns true if map is identical to this map. Implemented in TpetraMap::isSameAs().
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map&#39;s communicator with a subset communicator.
std::string description() const
Return a simple one-line description of this object.
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map&#39;s Comm object.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > map_
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
#define XPETRA_MONITOR(funcName)
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
TpetraMap(const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
TpetraMap constructor to wrap a Tpetra::Map object.
TpetraMap(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed)
Constructor with Tpetra-defined contiguous uniform distribution.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Teuchos::RCP< const TpetraMap< LocalOrdinal, GlobalOrdinal, Node > > createContigMapWithNode(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member function to create a (potentially) non-uniform, contiguous Map with a user-specified node...
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
TpetraMap(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.
TpetraMap(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed)
Constructor with Tpetra-defined contiguous uniform distribution.
TpetraMap(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.
std::string description() const
Return a simple one-line description of this object.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const
Return the process IDs and corresponding local IDs for the given global IDs.
TpetraMap(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed)
Constructor with Tpetra-defined contiguous uniform distribution.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const
Return the process IDs and corresponding local IDs for the given global IDs.