Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef XPETRA_EPETRAMAP_HPP
00047 #define XPETRA_EPETRAMAP_HPP
00048
00049
00050
00051 #include "Xpetra_EpetraConfigDefs.hpp"
00052
00053 #include "Xpetra_Map.hpp"
00054
00055 #include <Epetra_Map.h>
00056 #include <Epetra_BlockMap.h>
00057
00058 #include "Xpetra_Utils.hpp"
00059 #include "Xpetra_EpetraUtils.hpp"
00060
00061 #include "Xpetra_ConfigDefs.hpp"
00062
00063 namespace Xpetra {
00064
00065
00066 const Epetra_Map & toEpetra(const Map<int,int> &);
00067 const Epetra_Map & toEpetra(const RCP< const Map<int, int> > &);
00068
00069 const RCP< const Map<int, int> > toXpetra(const Epetra_BlockMap &);
00070
00071
00072 class EpetraMap
00073 : public virtual Map<int, int>
00074 {
00075
00076 typedef int LocalOrdinal;
00077 typedef int GlobalOrdinal;
00078 typedef Kokkos::DefaultNode::DefaultNodeType Node;
00079
00080 public:
00081
00083
00084
00086 EpetraMap(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed, const Teuchos::RCP< Node > &node=Kokkos::DefaultNode::getDefaultNode());
00087
00089 EpetraMap(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Kokkos::DefaultNode::getDefaultNode());
00090
00092 EpetraMap(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=Kokkos::DefaultNode::getDefaultNode());
00093
00095
00097
00098
00100 global_size_t getGlobalNumElements() const { XPETRA_MONITOR("EpetraMap::getGlobalNumElements"); return map_->NumGlobalElements(); }
00101
00103 size_t getNodeNumElements() const { XPETRA_MONITOR("EpetraMap::getNodeNumElements"); return map_->NumMyElements(); }
00104
00106 GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("EpetraMap::getIndexBase"); return map_->IndexBase(); }
00107
00109 LocalOrdinal getMinLocalIndex() const { XPETRA_MONITOR("EpetraMap::getMinLocalIndex"); return map_->MinLID(); }
00110
00112 LocalOrdinal getMaxLocalIndex() const { XPETRA_MONITOR("EpetraMap::getMaxLocalIndex"); return map_->MaxLID(); }
00113
00115 GlobalOrdinal getMinGlobalIndex() const { XPETRA_MONITOR("EpetraMap::getMinGlobalIndex"); return map_->MinMyGID(); }
00116
00118 GlobalOrdinal getMaxGlobalIndex() const { XPETRA_MONITOR("EpetraMap::getMaxGlobalIndex"); return map_->MaxMyGID(); }
00119
00121 GlobalOrdinal getMinAllGlobalIndex() const { XPETRA_MONITOR("EpetraMap::getMinAllGlobalIndex"); return map_->MinAllGID(); }
00122
00124 GlobalOrdinal getMaxAllGlobalIndex() const { XPETRA_MONITOR("EpetraMap::getMaxAllGlobalIndex"); return map_->MaxAllGID(); }
00125
00127 LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("EpetraMap::getLocalElement"); return map_->LID(globalIndex); }
00128
00130 LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const;
00131
00133 LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const;
00134
00136 Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const;
00137
00139
00141
00142
00144 bool isNodeLocalElement(LocalOrdinal localIndex) const { XPETRA_MONITOR("EpetraMap::isNodeLocalElement"); return map_->MyLID(localIndex); }
00145
00147 bool isNodeGlobalElement(GlobalOrdinal globalIndex) const { XPETRA_MONITOR("EpetraMap::isNodeGlobalElement"); return map_->MyGID(globalIndex); }
00148
00150 bool isContiguous() const { XPETRA_MONITOR("EpetraMap::isContiguous"); return map_->LinearMap(); }
00151
00153 bool isDistributed() const { XPETRA_MONITOR("EpetraMap::isDistributed"); return map_->DistributedGlobal(); }
00154
00156 bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("EpetraMap::isCompatible"); return map_->PointSameAs(toEpetra(map)); }
00157
00159 bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const { XPETRA_MONITOR("EpetraMap::isSameAs"); return map_->SameAs(toEpetra(map)); }
00160
00162
00164
00165
00167 const Teuchos::RCP< const Teuchos::Comm< int > > getComm() const { XPETRA_MONITOR("EpetraMap::getComm"); return toXpetra(map_->Comm()); }
00168
00170 const Teuchos::RCP< Node > getNode() const;
00171
00173
00175
00176
00178 std::string description() const;
00179
00181 void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
00182
00184
00186 GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const {
00187 XPETRA_MONITOR("EpetraMap::getGlobalElement");
00188
00189 GlobalOrdinal gid = map_->GID(localIndex);
00190 if (gid == map_->IndexBase()-1) return (-1);
00191 else return (gid);
00192 }
00193
00195
00196
00198 virtual ~EpetraMap() { }
00199
00201 EpetraMap(const Teuchos::RCP<const Epetra_BlockMap> &map)
00202 : map_(map) { }
00203
00205 UnderlyingLib lib() const { return Xpetra::UseEpetra; }
00206
00208
00209 const Epetra_BlockMap& getEpetra_BlockMap() const { return *map_; }
00210 const Epetra_Map& getEpetra_Map() const { return (Epetra_Map &)*map_; }
00211
00213
00214 protected:
00215
00216 RCP<const Epetra_BlockMap> map_;
00217
00218
00219
00220 };
00221
00222 }
00223
00224 #endif // XPETRA_EPETRAMAP_HPP