/usr/include/trilinos/Xpetra_TpetraMap.hpp is in libtrilinos-xpetra-dev 12.12.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | // @HEADER
//
// ***********************************************************************
//
// Xpetra: A linear algebra interface package
// Copyright 2012 Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact
// Jonathan Hu (jhu@sandia.gov)
// Andrey Prokopenko (aprokop@sandia.gov)
// Ray Tuminaro (rstumin@sandia.gov)
//
// ***********************************************************************
//
// @HEADER
#ifndef XPETRA_TPETRAMAP_HPP
#define XPETRA_TPETRAMAP_HPP
/* this file is automatically generated - do not edit (see script/tpetra.py) */
#include "Xpetra_TpetraConfigDefs.hpp"
#include <Tpetra_Map.hpp>
#include "Xpetra_Map.hpp"
#include "Xpetra_Utils.hpp"
#include "Xpetra_Exceptions.hpp"
namespace Xpetra {
// TODO: move that elsewhere
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node>& toTpetra(const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node>&);
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node > > toTpetra(const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >&);
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node > > toXpetra(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >&);
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const RCP<Map<LocalOrdinal,GlobalOrdinal,Node > > toXpetraNonConst(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >&);
//
template <class LocalOrdinal = Map<>::local_ordinal_type,
class GlobalOrdinal = typename Map<LocalOrdinal>::global_ordinal_type,
class Node = typename Map<LocalOrdinal, GlobalOrdinal>::node_type>
class TpetraMap
: public virtual Map<LocalOrdinal,GlobalOrdinal,Node> {
public:
static Teuchos::RCP<Node> defaultArgNode() {
// Workaround function for a deferred visual studio bug
// http://connect.microsoft.com/VisualStudio/feedback/details/719847/erroneous-error-c2783-could-not-deduce-template-argument
// Use this function for default arguments rather than calling
// what is the return value below. Also helps in reducing
// duplication in various constructors.
return KokkosClassic::Details::getNode<Node>();
}
//! @name Constructors and destructor
//@{
//! Constructor with Tpetra-defined contiguous uniform 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())
: map_ (Teuchos::rcp (new Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > (numGlobalElements,
indexBase, comm,
toTpetra(lg), node)))
{}
//! 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,
const Teuchos::RCP< Node > &node = defaultArgNode())
: map_ (Teuchos::rcp (new Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > (numGlobalElements,
numLocalElements,
indexBase, comm,
node)))
{}
//! Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
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())
: map_(Teuchos::rcp(new Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >(numGlobalElements,
elementList, indexBase,
comm, node)))
{}
//! Destructor.
~TpetraMap() { }
//@}
//! @name Attributes
//@{
//! The number of elements in this Map.
global_size_t getGlobalNumElements() const { XPETRA_MONITOR("TpetraMap::getGlobalNumElements"); return map_->getGlobalNumElements(); }
//! The number of elements belonging to the calling node.
size_t getNodeNumElements() const { XPETRA_MONITOR("TpetraMap::getNodeNumElements"); return map_->getNodeNumElements(); }
//! The index base for this Map.
GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("TpetraMap::getIndexBase"); return map_->getIndexBase(); }
//! The minimum local index.
LocalOrdinal getMinLocalIndex() const { XPETRA_MONITOR("TpetraMap::getMinLocalIndex"); return map_->getMinLocalIndex(); }
//! The maximum local index on the calling process.
LocalOrdinal getMaxLocalIndex() const { XPETRA_MONITOR("TpetraMap::getMaxLocalIndex"); return map_->getMaxLocalIndex(); }
//! The minimum global index owned by the calling process.
GlobalOrdinal getMinGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMinGlobalIndex"); return map_->getMinGlobalIndex(); }
//! The maximum global index owned by the calling process.
GlobalOrdinal getMaxGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMaxGlobalIndex"); return map_->getMaxGlobalIndex(); }
//! The minimum global index over all processes in the communicator.
GlobalOrdinal getMinAllGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMinAllGlobalIndex"); return map_->getMinAllGlobalIndex(); }
//! The maximum global index over all processes in the communicator.
GlobalOrdinal getMaxAllGlobalIndex() const { XPETRA_MONITOR("TpetraMap::getMaxAllGlobalIndex"); return map_->getMaxAllGlobalIndex(); }
//! The local index corresponding to the given global index.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("TpetraMap::getLocalElement"); return map_->getLocalElement(globalIndex); }
//! The global index corresponding to the given local index.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { XPETRA_MONITOR("TpetraMap::getGlobalElement"); return map_->getGlobalElement(localIndex); }
//! Return the process IDs and corresponding local IDs for the given global IDs.
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)); }
//! Return the process IDs for the given global IDs.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const { XPETRA_MONITOR("TpetraMap::getRemoteIndexList"); return toXpetra(map_->getRemoteIndexList(GIDList, nodeIDList)); }
//! Return a view of the global indices owned by this node.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const { XPETRA_MONITOR("TpetraMap::getNodeElementList"); return map_->getNodeElementList(); }
//@}
//! @name Boolean tests
//@{
//! True if the local index is valid for this Map on this node, else false.
bool isNodeLocalElement(LocalOrdinal localIndex) const { XPETRA_MONITOR("TpetraMap::isNodeLocalElement"); return map_->isNodeLocalElement(localIndex); }
//! True if the global index is found in this Map on this node, else false.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("TpetraMap::isNodeGlobalElement"); return map_->isNodeGlobalElement(globalIndex); }
//! True if this Map is distributed contiguously, else false.
bool isContiguous() const { XPETRA_MONITOR("TpetraMap::isContiguous"); return map_->isContiguous(); }
//! Whether this Map is globally distributed or locally replicated.
bool isDistributed() const { XPETRA_MONITOR("TpetraMap::isDistributed"); return map_->isDistributed(); }
//! True if and only if map is compatible with this Map.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("TpetraMap::isCompatible"); return map_->isCompatible(toTpetra(map)); }
//! True if and only if map is identical to this Map.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("TpetraMap::isSameAs"); return map_->isSameAs(toTpetra(map)); }
//@}
//! @name
//@{
//! Get this Map's Comm object.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { XPETRA_MONITOR("TpetraMap::getComm"); return map_->getComm(); }
//! Get this Map's Node object.
Teuchos::RCP< Node > getNode() const { XPETRA_MONITOR("TpetraMap::getNode"); return map_->getNode(); }
//@}
//! @name
//@{
//! Return a simple one-line description of this object.
std::string description() const { XPETRA_MONITOR("TpetraMap::description"); return map_->description(); }
//! Print this object with the given verbosity level to the given FancyOStream.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { XPETRA_MONITOR("TpetraMap::describe"); map_->describe(out, verbLevel); }
RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > removeEmptyProcesses () const {
return toXpetra(map_->removeEmptyProcesses());
}
RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > replaceCommWithSubset (const Teuchos::RCP<const Teuchos::Comm<int> >& newComm) const {
return toXpetra(map_->replaceCommWithSubset(newComm));
}
template<class Node2>
RCP<Map<LocalOrdinal, GlobalOrdinal, Node2> > clone(const RCP<Node2> &node2) const {
return toXpetraNonConst(map_->clone(node2));
}
//@}
//! @name Xpetra specific
//@{
//! TpetraMap constructor to wrap a Tpetra::Map object
TpetraMap(const Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map)
: map_(map) { }
//! Get the library used by this object (Tpetra or Epetra?)
UnderlyingLib lib() const { return UseTpetra; }
//! Get the underlying Tpetra map
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const { return map_; }
//@}
protected:
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > map_;
}; // TpetraMap class
// TODO: move that elsewhere
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> & toTpetra(const Map<LocalOrdinal,GlobalOrdinal,Node> &map) {
// TODO: throw exception
const TpetraMap<LocalOrdinal,GlobalOrdinal,Node> & tpetraMap = dynamic_cast<const TpetraMap<LocalOrdinal,GlobalOrdinal,Node> &>(*map.getMap());
return *tpetraMap.getTpetra_Map();
}
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map) {
typedef TpetraMap<LocalOrdinal, GlobalOrdinal, Node> TpetraMapClass;
if (map != Teuchos::null) {
XPETRA_RCP_DYNAMIC_CAST(const TpetraMapClass, map->getMap(), tpetraMap, "toTpetra");
return tpetraMap->getTpetra_Map();
}
return Teuchos::null;
}
// In some cases (for instance, in MueLu adapter to Tpetra operator), we need to return a reference. This is only possible if
// we assume that the map argument is nonzero
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > toTpetraNonZero(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map) {
TEUCHOS_TEST_FOR_EXCEPTION(map.is_null(), std::invalid_argument, "map must be nonzero");
typedef TpetraMap<LocalOrdinal, GlobalOrdinal, Node> TpetraMapClass;
XPETRA_RCP_DYNAMIC_CAST(const TpetraMapClass, map->getMap(), tpetraMap, "toTpetra");
return tpetraMap->getTpetra_Map();
}
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > toXpetra(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& map) {
if (!map.is_null())
return rcp(new TpetraMap<LocalOrdinal, GlobalOrdinal, Node>(map));
return Teuchos::null;
}
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const RCP<Map<LocalOrdinal,GlobalOrdinal,Node> > toXpetraNonConst(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& map) {
if (!map.is_null())
return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal,Node>(map));
return Teuchos::null;
}
// TODO: removed (but currently used in unit test)
namespace useTpetra {
//! Non-member function to create a locally replicated Map with a specified node.
template <class LocalOrdinal, class GlobalOrdinal, class Node>
Teuchos::RCP< const TpetraMap<LocalOrdinal,GlobalOrdinal,Node> >
createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node) {
XPETRA_MONITOR("useTpetra::createLocalMapWithNode");
return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal,Node>(Tpetra::createLocalMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(numElements, comm, node)));
}
//! Non-member function to create a (potentially) non-uniform, contiguous Map with the default node.
template <class LocalOrdinal, class GlobalOrdinal>
Teuchos::RCP< const TpetraMap<LocalOrdinal,GlobalOrdinal> >
createContigMap(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm) {
XPETRA_MONITOR("useTpetra::createContigMap");
return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal>(Tpetra::createContigMap<LocalOrdinal,GlobalOrdinal>(numElements, localNumElements, comm)));
}
//! Non-member function to create a (potentially) non-uniform, contiguous Map with a user-specified node.
template <class LocalOrdinal, class GlobalOrdinal, class Node>
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) {
XPETRA_MONITOR("useTpetra::createContigMap");
return rcp(new TpetraMap<LocalOrdinal,GlobalOrdinal,Node>(Tpetra::createContigMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(numElements, localNumElements, comm, node)));
}
} // useTpetra namespace
// TODO: move that elsewhere
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node>& toTpetra(const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node>&);
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node > > toTpetra(const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >&);
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node > > toXpetra(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >&);
template <class LocalOrdinal, class GlobalOrdinal, class Node>
const RCP<Map<LocalOrdinal,GlobalOrdinal,Node > > toXpetraNonConst(const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >&);
#ifdef HAVE_XPETRA_EPETRA
#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
(!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
// specialization for Tpetra Map on EpetraNode and GO=int
template <>
class TpetraMap<int, int, EpetraNode>
: public virtual Map<int,int,EpetraNode> {
public:
typedef int GlobalOrdinal;
typedef int LocalOrdinal;
typedef EpetraNode Node;
static Teuchos::RCP<Node> defaultArgNode() {
// Workaround function for a deferred visual studio bug
// http://connect.microsoft.com/VisualStudio/feedback/details/719847/erroneous-error-c2783-could-not-deduce-template-argument
// Use this function for default arguments rather than calling
// what is the return value below. Also helps in reducing
// duplication in various constructors.
return KokkosClassic::Details::getNode<Node>();
}
//! @name Constructors and destructor
//@{
//! Constructor with Tpetra-defined contiguous uniform 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()) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! 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,
const Teuchos::RCP< Node > &node = defaultArgNode()) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
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()) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Destructor.
~TpetraMap() { }
//@}
//! @name Attributes
//@{
//! The number of elements in this Map.
global_size_t getGlobalNumElements() const { return 0; }
//! The number of elements belonging to the calling node.
size_t getNodeNumElements() const { return 0; }
//! The index base for this Map.
GlobalOrdinal getIndexBase() const { return 0; }
//! The minimum local index.
LocalOrdinal getMinLocalIndex() const { return 0; }
//! The maximum local index on the calling process.
LocalOrdinal getMaxLocalIndex() const { return 0; }
//! The minimum global index owned by the calling process.
GlobalOrdinal getMinGlobalIndex() const { return 0; }
//! The maximum global index owned by the calling process.
GlobalOrdinal getMaxGlobalIndex() const { return 0; }
//! The minimum global index over all processes in the communicator.
GlobalOrdinal getMinAllGlobalIndex() const { return 0; }
//! The maximum global index over all processes in the communicator.
GlobalOrdinal getMaxAllGlobalIndex() const { return 0; }
//! The local index corresponding to the given global index.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { return 0; }
//! The global index corresponding to the given local index.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { return 0; }
//! Return the process IDs and corresponding local IDs for the given global IDs.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const { return Xpetra::IDNotPresent; }
//! Return the process IDs for the given global IDs.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const { return Xpetra::IDNotPresent; }
//! Return a view of the global indices owned by this node.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const { return Teuchos::ArrayView<const GlobalOrdinal>(); }
//@}
//! @name Boolean tests
//@{
//! True if the local index is valid for this Map on this node, else false.
bool isNodeLocalElement(LocalOrdinal localIndex) const { return false; }
//! True if the global index is found in this Map on this node, else false.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { return false; }
//! True if this Map is distributed contiguously, else false.
bool isContiguous() const { return false; }
//! Whether this Map is globally distributed or locally replicated.
bool isDistributed() const { return false; }
//! True if and only if map is compatible with this Map.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
//! True if and only if map is identical to this Map.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
//@}
//! @name
//@{
//! Get this Map's Comm object.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { return Teuchos::null; }
//! Get this Map's Node object.
Teuchos::RCP< Node > getNode() const { return Teuchos::null; }
//@}
//! @name
//@{
//! Return a simple one-line description of this object.
std::string description() const { return std::string(""); }
//! Print this object with the given verbosity level to the given FancyOStream.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { }
RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > removeEmptyProcesses () const { return Teuchos::null; }
RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > replaceCommWithSubset (const Teuchos::RCP<const Teuchos::Comm<int> >& newComm) const { return Teuchos::null; }
template<class Node2>
RCP<Map<LocalOrdinal, GlobalOrdinal, Node2> > clone(const RCP<Node2> &node2) const { return Teuchos::null; }
//@}
//! @name Xpetra specific
//@{
//! TpetraMap constructor to wrap a Tpetra::Map object
TpetraMap(const Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Get the library used by this object (Tpetra or Epetra?)
UnderlyingLib lib() const { return UseTpetra; }
//! Get the underlying Tpetra map
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const { return Teuchos::null; }
//@}
}; // TpetraMap class (specialization for GO=int and NO=EpetraNode)
#endif
#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
(!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
// specialization for Tpetra Map on EpetraNode and GO=int
template <>
class TpetraMap<int, long long, EpetraNode>
: public virtual Map<int,long long,EpetraNode> {
public:
typedef long long GlobalOrdinal;
typedef int LocalOrdinal;
typedef EpetraNode Node;
static Teuchos::RCP<Node> defaultArgNode() {
// Workaround function for a deferred visual studio bug
// http://connect.microsoft.com/VisualStudio/feedback/details/719847/erroneous-error-c2783-could-not-deduce-template-argument
// Use this function for default arguments rather than calling
// what is the return value below. Also helps in reducing
// duplication in various constructors.
return KokkosClassic::Details::getNode<Node>();
}
//! @name Constructors and destructor
//@{
//! Constructor with Tpetra-defined contiguous uniform 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()) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! 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,
const Teuchos::RCP< Node > &node = defaultArgNode()) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
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()) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Destructor.
~TpetraMap() { }
//@}
//! @name Attributes
//@{
//! The number of elements in this Map.
global_size_t getGlobalNumElements() const { return 0; }
//! The number of elements belonging to the calling node.
size_t getNodeNumElements() const { return 0; }
//! The index base for this Map.
GlobalOrdinal getIndexBase() const { return 0; }
//! The minimum local index.
LocalOrdinal getMinLocalIndex() const { return 0; }
//! The maximum local index on the calling process.
LocalOrdinal getMaxLocalIndex() const { return 0; }
//! The minimum global index owned by the calling process.
GlobalOrdinal getMinGlobalIndex() const { return 0; }
//! The maximum global index owned by the calling process.
GlobalOrdinal getMaxGlobalIndex() const { return 0; }
//! The minimum global index over all processes in the communicator.
GlobalOrdinal getMinAllGlobalIndex() const { return 0; }
//! The maximum global index over all processes in the communicator.
GlobalOrdinal getMaxAllGlobalIndex() const { return 0; }
//! The local index corresponding to the given global index.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { return 0; }
//! The global index corresponding to the given local index.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { return 0; }
//! Return the process IDs and corresponding local IDs for the given global IDs.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const { return Xpetra::IDNotPresent; }
//! Return the process IDs for the given global IDs.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const { return Xpetra::IDNotPresent; }
//! Return a view of the global indices owned by this node.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const { return Teuchos::ArrayView<const GlobalOrdinal>(); }
//@}
//! @name Boolean tests
//@{
//! True if the local index is valid for this Map on this node, else false.
bool isNodeLocalElement(LocalOrdinal localIndex) const { return false; }
//! True if the global index is found in this Map on this node, else false.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { return false; }
//! True if this Map is distributed contiguously, else false.
bool isContiguous() const { return false; }
//! Whether this Map is globally distributed or locally replicated.
bool isDistributed() const { return false; }
//! True if and only if map is compatible with this Map.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
//! True if and only if map is identical to this Map.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { return false; }
//@}
//! @name
//@{
//! Get this Map's Comm object.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { return Teuchos::null; }
//! Get this Map's Node object.
Teuchos::RCP< Node > getNode() const { return Teuchos::null; }
//@}
//! @name
//@{
//! Return a simple one-line description of this object.
std::string description() const { return std::string(""); }
//! Print this object with the given verbosity level to the given FancyOStream.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { }
RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > removeEmptyProcesses () const { return Teuchos::null; }
RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > replaceCommWithSubset (const Teuchos::RCP<const Teuchos::Comm<int> >& newComm) const { return Teuchos::null; }
template<class Node2>
RCP<Map<LocalOrdinal, GlobalOrdinal, Node2> > clone(const RCP<Node2> &node2) const { return Teuchos::null; }
//@}
//! @name Xpetra specific
//@{
//! TpetraMap constructor to wrap a Tpetra::Map object
TpetraMap(const Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraMap<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Get the library used by this object (Tpetra or Epetra?)
UnderlyingLib lib() const { return UseTpetra; }
//! Get the underlying Tpetra map
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const { return Teuchos::null; }
//@}
}; // TpetraMap class (specialization for GO=int and NO=EpetraNode)
#endif
#endif // HAVE_XPETRA_EPETRA
} // Xpetra namespace
// TODO: remove?
//! Returns true if \c map is identical to this map. Implemented in TpetraMap::isSameAs().
template <class LocalOrdinal, class GlobalOrdinal, class Node>
bool operator== (const Xpetra::TpetraMap<LocalOrdinal,GlobalOrdinal,Node> &map1, const Xpetra::TpetraMap<LocalOrdinal,GlobalOrdinal,Node> &map2) {
XPETRA_MONITOR("TpetraMap==TpetraMap");
return map1.isSameAs(map2);
}
//! Returns true if \c map is not identical to this map. Implemented in TpetraMap::isSameAs().
template <class LocalOrdinal, class GlobalOrdinal, class Node>
bool operator!= (const Xpetra::TpetraMap<LocalOrdinal,GlobalOrdinal,Node> &map1, const Xpetra::TpetraMap<LocalOrdinal,GlobalOrdinal,Node> &map2) {
XPETRA_MONITOR("TpetraMap!=TpetraMap");
return !map1.isSameAs(map2);
}
#define XPETRA_TPETRAMAP_SHORT
#endif // XPETRA_TPETRAMAP_HPP
|