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 
84  static Teuchos::RCP<Node> defaultArgNode() {
85  // Workaround function for a deferred visual studio bug
86  // http://connect.microsoft.com/VisualStudio/feedback/details/719847/erroneous-error-c2783-could-not-deduce-template-argument
87  // Use this function for default arguments rather than calling
88  // what is the return value below. Also helps in reducing
89  // duplication in various constructors.
90  return KokkosClassic::Details::getNode<Node>();
91  }
92 
94 
95 
97  TpetraMap (global_size_t numGlobalElements,
98  GlobalOrdinal indexBase,
99  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
101  const Teuchos::RCP< Node > &node = defaultArgNode())
102  : map_ (Teuchos::rcp (new Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > (numGlobalElements,
103  indexBase, comm,
104  toTpetra(lg), node)))
105  {}
106 
108  TpetraMap (global_size_t numGlobalElements,
109  size_t numLocalElements,
110  GlobalOrdinal indexBase,
111  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
112  const Teuchos::RCP< Node > &node = defaultArgNode())
113  : map_ (Teuchos::rcp (new Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > (numGlobalElements,
114  numLocalElements,
115  indexBase, comm,
116  node)))
117  {}
118 
120  TpetraMap (global_size_t numGlobalElements,
121  const Teuchos::ArrayView< const GlobalOrdinal > &elementList,
122  GlobalOrdinal indexBase,
123  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
124  const Teuchos::RCP< Node > &node = defaultArgNode())
125  : map_(Teuchos::rcp(new Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >(numGlobalElements,
126  elementList, indexBase,
127  comm, node)))
128  {}
129 
132 
134 
136 
137 
139  global_size_t getGlobalNumElements() const { XPETRA_MONITOR("TpetraMap::getGlobalNumElements"); return map_->getGlobalNumElements(); }
140 
142  size_t getNodeNumElements() const { XPETRA_MONITOR("TpetraMap::getNodeNumElements"); return map_->getNodeNumElements(); }
143 
145  GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("TpetraMap::getIndexBase"); return map_->getIndexBase(); }
146 
148  LocalOrdinal getMinLocalIndex() const { XPETRA_MONITOR("TpetraMap::getMinLocalIndex"); return map_->getMinLocalIndex(); }
149 
151  LocalOrdinal getMaxLocalIndex() const { XPETRA_MONITOR("TpetraMap::getMaxLocalIndex"); return map_->getMaxLocalIndex(); }
152 
154  GlobalOrdinal getMinGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMinGlobalIndex"); return map_->getMinGlobalIndex(); }
155 
157  GlobalOrdinal getMaxGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMaxGlobalIndex"); return map_->getMaxGlobalIndex(); }
158 
160  GlobalOrdinal getMinAllGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMinAllGlobalIndex"); return map_->getMinAllGlobalIndex(); }
161 
163  GlobalOrdinal getMaxAllGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMaxAllGlobalIndex"); return map_->getMaxAllGlobalIndex(); }
164 
166  LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("TpetraMap::getLocalElement"); return map_->getLocalElement(globalIndex); }
167 
169  GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { XPETRA_MONITOR("TpetraMap::getGlobalElement"); return map_->getGlobalElement(localIndex); }
170 
172  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)); }
173 
175  LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const { XPETRA_MONITOR("TpetraMap::getRemoteIndexList"); return toXpetra(map_->getRemoteIndexList(GIDList, nodeIDList)); }
176 
178  Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const { XPETRA_MONITOR("TpetraMap::getNodeElementList"); return map_->getNodeElementList(); }
179 
181 
183 
184 
186  bool isNodeLocalElement(LocalOrdinal localIndex) const { XPETRA_MONITOR("TpetraMap::isNodeLocalElement"); return map_->isNodeLocalElement(localIndex); }
187 
189  bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("TpetraMap::isNodeGlobalElement"); return map_->isNodeGlobalElement(globalIndex); }
190 
192  bool isContiguous() const { XPETRA_MONITOR("TpetraMap::isContiguous"); return map_->isContiguous(); }
193 
195  bool isDistributed() const { XPETRA_MONITOR("TpetraMap::isDistributed"); return map_->isDistributed(); }
196 
198  bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("TpetraMap::isCompatible"); return map_->isCompatible(toTpetra(map)); }
199 
201  bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("TpetraMap::isSameAs"); return map_->isSameAs(toTpetra(map)); }
202 
204 
206 
207 
209  Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { XPETRA_MONITOR("TpetraMap::getComm"); return map_->getComm(); }
210 
212  Teuchos::RCP< Node > getNode() const { XPETRA_MONITOR("TpetraMap::getNode"); return map_->getNode(); }
213 
215 
217 
218 
220  std::string description() const { XPETRA_MONITOR("TpetraMap::description"); return map_->description(); }
221 
223  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { XPETRA_MONITOR("TpetraMap::describe"); map_->describe(out, verbLevel); }
224 
225  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > removeEmptyProcesses () const {
226  return toXpetra(map_->removeEmptyProcesses());
227  }
228  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > replaceCommWithSubset (const Teuchos::RCP<const Teuchos::Comm<int> >& newComm) const {
229  return toXpetra(map_->replaceCommWithSubset(newComm));
230  }
231 
232  template<class Node2>
233  RCP<Map<LocalOrdinal, GlobalOrdinal, Node2> > clone(const RCP<Node2> &node2) const {
234  return toXpetraNonConst(map_->clone(node2));
235  }
236 
238 
240 
241 
243  TpetraMap(const Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map)
244  : map_(map) { }
245 
247  UnderlyingLib lib() const { return UseTpetra; }
248 
250  RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const { return map_; }
251 
253 
254  protected:
255 
256  RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > map_;
257 
258  }; // TpetraMap class
259 
260  // TODO: move that elsewhere
261  template <class LocalOrdinal, class GlobalOrdinal, class Node>
262  const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> & toTpetra(const Map<LocalOrdinal,GlobalOrdinal,Node> &map) {
263  // TODO: throw exception
264  const TpetraMap<LocalOrdinal,GlobalOrdinal,Node> & tpetraMap = dynamic_cast<const TpetraMap<LocalOrdinal,GlobalOrdinal,Node> &>(*map.getMap());
265  return *tpetraMap.getTpetra_Map();
266  }
267 
268  template <class LocalOrdinal, class GlobalOrdinal, class Node>
269  const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map) {
270  typedef TpetraMap<LocalOrdinal, GlobalOrdinal, Node> TpetraMapClass;
271  if (map != Teuchos::null) {
272  XPETRA_RCP_DYNAMIC_CAST(const TpetraMapClass, map->getMap(), tpetraMap, "toTpetra");
273  return tpetraMap->getTpetra_Map();
274  }
275  return Teuchos::null;
276  }
277 
278  // In some cases (for instance, in MueLu adapter to Tpetra operator), we need to return a reference. This is only possible if
279  // we assume that the map argument is nonzero
280  template <class LocalOrdinal, class GlobalOrdinal, class Node>
281  const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > toTpetraNonZero(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map) {
282  TEUCHOS_TEST_FOR_EXCEPTION(map.is_null(), std::invalid_argument, "map must be nonzero");
283  typedef TpetraMap<LocalOrdinal, GlobalOrdinal, Node> TpetraMapClass;
284  XPETRA_RCP_DYNAMIC_CAST(const TpetraMapClass, map->getMap(), tpetraMap, "toTpetra");
285  return tpetraMap->getTpetra_Map();
286  }
287 
288  template <class LocalOrdinal, class GlobalOrdinal, class Node>
289  const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > toXpetra(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& map) {
290  if (!map.is_null())
292 
293  return Teuchos::null;
294  }
295 
296  template <class LocalOrdinal, class GlobalOrdinal, class Node>
297  const RCP<Map<LocalOrdinal,GlobalOrdinal,Node> > toXpetraNonConst(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& map) {
298  if (!map.is_null())
299  return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal,Node>(map));
300 
301  return Teuchos::null;
302  }
303 
304  // TODO: removed (but currently used in unit test)
305  namespace useTpetra {
306 
308  template <class LocalOrdinal, class GlobalOrdinal, class Node>
309  Teuchos::RCP< const TpetraMap<LocalOrdinal,GlobalOrdinal,Node> >
310  createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node) {
311  XPETRA_MONITOR("useTpetra::createLocalMapWithNode");
312 
313  return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal,Node>(Tpetra::createLocalMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(numElements, comm, node)));
314  }
315 
317  template <class LocalOrdinal, class GlobalOrdinal>
318  Teuchos::RCP< const TpetraMap<LocalOrdinal,GlobalOrdinal> >
319  createContigMap(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm) {
320  XPETRA_MONITOR("useTpetra::createContigMap");
321 
322  return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal>(Tpetra::createContigMap<LocalOrdinal,GlobalOrdinal>(numElements, localNumElements, comm)));
323  }
324 
326  template <class LocalOrdinal, class GlobalOrdinal, class Node>
327  Teuchos::RCP< const TpetraMap<LocalOrdinal,GlobalOrdinal,Node> >
328  createContigMapWithNode(global_size_t numElements, size_t localNumElements,
329  const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node) {
330  XPETRA_MONITOR("useTpetra::createContigMap");
331  return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal,Node>(Tpetra::createContigMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(numElements, localNumElements, comm, node)));
332  }
333  } // useTpetra namespace
334 
335  // TODO: move that elsewhere
336  template <class LocalOrdinal, class GlobalOrdinal, class Node>
337  const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node>& toTpetra(const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node>&);
338 
339  template <class LocalOrdinal, class GlobalOrdinal, class Node>
340  const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node > > toTpetra(const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >&);
341 
342  template <class LocalOrdinal, class GlobalOrdinal, class Node>
343  const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node > > toXpetra(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >&);
344 
345  template <class LocalOrdinal, class GlobalOrdinal, class Node>
346  const RCP<Map<LocalOrdinal,GlobalOrdinal,Node > > toXpetraNonConst(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >&);
347 
348 #ifdef HAVE_XPETRA_EPETRA
349 
350 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
351  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
352 
353  // specialization for Tpetra Map on EpetraNode and GO=int
354  template <>
355  class TpetraMap<int, int, EpetraNode>
356  : public virtual Map<int,int,EpetraNode> {
357 
358  public:
359  typedef int GlobalOrdinal;
360  typedef int LocalOrdinal;
361  typedef EpetraNode Node;
362 
363  static Teuchos::RCP<Node> defaultArgNode() {
364  // Workaround function for a deferred visual studio bug
365  // http://connect.microsoft.com/VisualStudio/feedback/details/719847/erroneous-error-c2783-could-not-deduce-template-argument
366  // Use this function for default arguments rather than calling
367  // what is the return value below. Also helps in reducing
368  // duplication in various constructors.
369  return KokkosClassic::Details::getNode<Node>();
370  }
371 
373 
374 
376  TpetraMap (global_size_t numGlobalElements,
377  GlobalOrdinal indexBase,
378  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
380  const Teuchos::RCP< Node > &node = defaultArgNode()) {
382  }
383 
385  TpetraMap (global_size_t numGlobalElements,
386  size_t numLocalElements,
387  GlobalOrdinal indexBase,
388  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
389  const Teuchos::RCP< Node > &node = defaultArgNode()) {
391  }
392 
394  TpetraMap (global_size_t numGlobalElements,
395  const Teuchos::ArrayView< const GlobalOrdinal > &elementList,
396  GlobalOrdinal indexBase,
397  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
398  const Teuchos::RCP< Node > &node = defaultArgNode()) {
400  }
401 
404 
406 
408 
409 
411  global_size_t getGlobalNumElements() const { return 0; }
412 
414  size_t getNodeNumElements() const { return 0; }
415 
417  GlobalOrdinal getIndexBase() const { return 0; }
418 
420  LocalOrdinal getMinLocalIndex() const { return 0; }
421 
423  LocalOrdinal getMaxLocalIndex() const { return 0; }
424 
426  GlobalOrdinal getMinGlobalIndex() const { return 0; }
427 
429  GlobalOrdinal getMaxGlobalIndex() const { return 0; }
430 
432  GlobalOrdinal getMinAllGlobalIndex() const { return 0; }
433 
435  GlobalOrdinal getMaxAllGlobalIndex() const { return 0; }
436 
438  LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { return 0; }
439 
441  GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { return 0; }
442 
444  LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const { return Xpetra::IDNotPresent; }
445 
447  LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const { return Xpetra::IDNotPresent; }
448 
450  Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const { return Teuchos::ArrayView<const GlobalOrdinal>(); }
451 
453 
455 
456 
458  bool isNodeLocalElement(LocalOrdinal localIndex) const { return false; }
459 
461  bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { return false; }
462 
464  bool isContiguous() const { return false; }
465 
467  bool isDistributed() const { return false; }
468 
470  bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
471 
473  bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
474 
476 
478 
479 
481  Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { return Teuchos::null; }
482 
484  Teuchos::RCP< Node > getNode() const { return Teuchos::null; }
485 
487 
489 
490 
492  std::string description() const { return std::string(""); }
493 
495  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { }
496 
497  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > removeEmptyProcesses () const { return Teuchos::null; }
498  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > replaceCommWithSubset (const Teuchos::RCP<const Teuchos::Comm<int> >& newComm) const { return Teuchos::null; }
499 
500  template<class Node2>
501  RCP<Map<LocalOrdinal, GlobalOrdinal, Node2> > clone(const RCP<Node2> &node2) const { return Teuchos::null; }
502 
504 
506 
507 
509  TpetraMap(const Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map) {
511  }
512 
514  UnderlyingLib lib() const { return UseTpetra; }
515 
517  RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const { return Teuchos::null; }
518 
520 
521  }; // TpetraMap class (specialization for GO=int and NO=EpetraNode)
522 #endif
523 
524 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
525  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
526  // specialization for Tpetra Map on EpetraNode and GO=int
527  template <>
528  class TpetraMap<int, long long, EpetraNode>
529  : public virtual Map<int,long long,EpetraNode> {
530 
531  public:
532  typedef long long GlobalOrdinal;
533  typedef int LocalOrdinal;
534  typedef EpetraNode Node;
535 
536  static Teuchos::RCP<Node> defaultArgNode() {
537  // Workaround function for a deferred visual studio bug
538  // http://connect.microsoft.com/VisualStudio/feedback/details/719847/erroneous-error-c2783-could-not-deduce-template-argument
539  // Use this function for default arguments rather than calling
540  // what is the return value below. Also helps in reducing
541  // duplication in various constructors.
542  return KokkosClassic::Details::getNode<Node>();
543  }
544 
546 
547 
549  TpetraMap (global_size_t numGlobalElements,
550  GlobalOrdinal indexBase,
551  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
553  const Teuchos::RCP< Node > &node = defaultArgNode()) {
555  }
556 
558  TpetraMap (global_size_t numGlobalElements,
559  size_t numLocalElements,
560  GlobalOrdinal indexBase,
561  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
562  const Teuchos::RCP< Node > &node = defaultArgNode()) {
564  }
565 
567  TpetraMap (global_size_t numGlobalElements,
568  const Teuchos::ArrayView< const GlobalOrdinal > &elementList,
569  GlobalOrdinal indexBase,
570  const Teuchos::RCP< const Teuchos::Comm< int > > &comm,
571  const Teuchos::RCP< Node > &node = defaultArgNode()) {
573  }
574 
577 
579 
581 
582 
584  global_size_t getGlobalNumElements() const { return 0; }
585 
587  size_t getNodeNumElements() const { return 0; }
588 
590  GlobalOrdinal getIndexBase() const { return 0; }
591 
593  LocalOrdinal getMinLocalIndex() const { return 0; }
594 
596  LocalOrdinal getMaxLocalIndex() const { return 0; }
597 
599  GlobalOrdinal getMinGlobalIndex() const { return 0; }
600 
602  GlobalOrdinal getMaxGlobalIndex() const { return 0; }
603 
605  GlobalOrdinal getMinAllGlobalIndex() const { return 0; }
606 
608  GlobalOrdinal getMaxAllGlobalIndex() const { return 0; }
609 
611  LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { return 0; }
612 
614  GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { return 0; }
615 
617  LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const { return Xpetra::IDNotPresent; }
618 
620  LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const { return Xpetra::IDNotPresent; }
621 
623  Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const { return Teuchos::ArrayView<const GlobalOrdinal>(); }
624 
626 
628 
629 
631  bool isNodeLocalElement(LocalOrdinal localIndex) const { return false; }
632 
634  bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { return false; }
635 
637  bool isContiguous() const { return false; }
638 
640  bool isDistributed() const { return false; }
641 
643  bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
644 
646  bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
647 
649 
651 
652 
654  Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { return Teuchos::null; }
655 
657  Teuchos::RCP< Node > getNode() const { return Teuchos::null; }
658 
660 
662 
663 
665  std::string description() const { return std::string(""); }
666 
668  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { }
669 
670  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > removeEmptyProcesses () const { return Teuchos::null; }
671  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > replaceCommWithSubset (const Teuchos::RCP<const Teuchos::Comm<int> >& newComm) const { return Teuchos::null; }
672 
673  template<class Node2>
674  RCP<Map<LocalOrdinal, GlobalOrdinal, Node2> > clone(const RCP<Node2> &node2) const { return Teuchos::null; }
675 
677 
679 
680 
682  TpetraMap(const Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map) {
684  }
685 
687  UnderlyingLib lib() const { return UseTpetra; }
688 
690  RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const { return Teuchos::null; }
691 
693  }; // TpetraMap class (specialization for GO=int and NO=EpetraNode)
694 #endif
695 
696 #endif // HAVE_XPETRA_EPETRA
697 
698 } // Xpetra namespace
699 
700 // TODO: remove?
702 template <class LocalOrdinal, class GlobalOrdinal, class Node>
704  XPETRA_MONITOR("TpetraMap==TpetraMap");
705  return map1.isSameAs(map2);
706 }
707 
709 template <class LocalOrdinal, class GlobalOrdinal, class Node>
711  XPETRA_MONITOR("TpetraMap!=TpetraMap");
712  return !map1.isSameAs(map2);
713 }
714 
715 #define XPETRA_TPETRAMAP_SHORT
716 #endif // XPETRA_TPETRAMAP_HPP
Teuchos::RCP< const TpetraMap< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node)
Non-member function to create a locally replicated Map with a specified node.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
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().
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map&#39;s Comm object.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
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...
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
GlobalOrdinal global_ordinal_type
Definition: Xpetra_Map.hpp:86
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
TpetraMap(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode())
Constructor with a user-defined contiguous distribution.
TpetraMap(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.
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.
GlobalOrdinal getIndexBase() const
The index base for this Map.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
RCP< Map< LocalOrdinal, GlobalOrdinal, Node2 > > clone(const RCP< Node2 > &node2) const
std::string description() const
Return a simple one-line description of this object.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > toTpetraNonZero(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
global_size_t getGlobalNumElements() const
The number of elements in this Map.
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 TpetraMap< LocalOrdinal, GlobalOrdinal, Node > > createContigMapWithNode(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node)
Non-member function to create a (potentially) non-uniform, contiguous Map with a user-specified node...
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.
Teuchos::RCP< Node > getNode() const
Get this Map&#39;s Node object.
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 Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
Node node_type
Definition: Xpetra_Map.hpp:87
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
Teuchos::RCP< Node > getNode() const
Get this Map&#39;s Node object.
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
TpetraMap(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode())
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
Xpetra namespace
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, const Teuchos::RCP< Node > &node=defaultArgNode())
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.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
TpetraMap(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode())
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
~TpetraMap()
Destructor.
RCP< Map< LocalOrdinal, GlobalOrdinal, Node2 > > clone(const RCP< Node2 > &node2) const
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
TpetraMap(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.
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.
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.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
TpetraMap(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode())
Constructor with a user-defined contiguous distribution.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
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 isContiguous() const
True if this Map is distributed contiguously, else false.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
Teuchos::RCP< Node > getNode() const
Get this Map&#39;s Node object.
TpetraMap(const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
TpetraMap constructor to wrap a Tpetra::Map object.
TpetraMap(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode())
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map&#39;s Comm object.
GlobalOrdinal getIndexBase() const
The index base for this Map.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
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 getIndexBase() const
The index base for this Map.
const RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > toXpetraNonConst(const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &)
size_t global_size_t
Global size_t object.
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 identical to this map. Implemented in TpetraMap::isSameAs().
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
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.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
TpetraMap(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode())
Constructor with a user-defined contiguous distribution.
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.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
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.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > map_
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
#define XPETRA_MONITOR(funcName)
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Definition: Xpetra_Map.hpp:211
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
TpetraMap(const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
TpetraMap constructor to wrap a Tpetra::Map object.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
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.
std::string description() const
Return a simple one-line description of this object.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
RCP< Map< LocalOrdinal, GlobalOrdinal, Node2 > > clone(const RCP< Node2 > &node2) const
LocalOrdinal getMinLocalIndex() const
The minimum local index.
static Teuchos::RCP< Node > defaultArgNode()
static Teuchos::RCP< Node > defaultArgNode()
bool isContiguous() const
True if this Map is distributed contiguously, else false.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.