48 #ifdef HAVE_XPETRA_EPETRA
64 std::string errPrefix;
65 errPrefix =
Teuchos::typeName(*
this) +
"::constructor(numGlobal,indexBase,comm,lOrG): ";
68 const int myImageID = comm->getRank();
72 int rootIB = indexBase;
73 Teuchos::broadcast<int,global_size_t>(*comm,0,&rootNGE);
74 Teuchos::broadcast<int,int>(*comm,0,&rootIB);
75 int localChecks[2], globalChecks[2];
78 if (numGlobalElements != rootNGE) {
79 localChecks[0] = myImageID;
82 else if (indexBase != rootIB) {
83 localChecks[0] = myImageID;
89 if (globalChecks[0] != -1) {
90 if (globalChecks[1] == 1) {
92 errPrefix <<
"numGlobal must be the same on all nodes (examine node " << globalChecks[0] <<
").");
94 else if (globalChecks[1] == 2) {
96 errPrefix <<
"indexBase must be the same on all nodes (examine node " << globalChecks[0] <<
").");
101 errPrefix <<
"logic error. Please contact the Tpetra team.");
115 using Teuchos::outArg;
123 std::string errPrefix;
124 errPrefix =
Teuchos::typeName(*
this) +
"::constructor(numGlobal,numLocal,indexBase,platform): ";
127 const int myImageID = comm->getRank();
132 int localChecks[2], globalChecks[2];
141 Teuchos::as<global_size_t>(numLocalElements),outArg(global_sum));
148 if (numLocalElements < L1 && numLocalElements != L0) {
150 localChecks[0] = myImageID;
153 else if (numGlobalElements < GST1 && numGlobalElements != GST0 && numGlobalElements != GSTI) {
155 localChecks[0] = myImageID;
158 else if (numGlobalElements != GSTI && numGlobalElements != global_sum) {
160 localChecks[0] = myImageID;
164 int rootIB = indexBase;
165 Teuchos::broadcast<int,int>(*comm,0,&rootIB);
166 if (indexBase != rootIB) {
167 localChecks[0] = myImageID;
173 if (globalChecks[0] != -1) {
174 if (globalChecks[1] == 1) {
176 errPrefix <<
"numLocal is not valid on at least one node (possibly node "
177 << globalChecks[0] <<
").");
179 else if (globalChecks[1] == 2) {
181 errPrefix <<
"numGlobal is not valid on at least one node (possibly node "
182 << globalChecks[0] <<
").");
184 else if (globalChecks[1] == 3) {
186 errPrefix <<
"numGlobal doesn't match sum of numLocal (== "
187 << global_sum <<
") on at least one node (possibly node "
188 << globalChecks[0] <<
").");
190 else if (globalChecks[1] == 4) {
192 errPrefix <<
"indexBase is not the same on all nodes (examine node "
193 << globalChecks[0] <<
").");
198 errPrefix <<
"logic error. Please contact the Tpetra team.");
205 if (numGlobalElements == GSTI) {
206 numGlobalElements = global_sum;}
246 std::ostringstream oss;
273 int myImageID = comm_->getRank();
274 int numImages = comm_->getSize();
283 width = std::max<size_t>(width,12) + 2;
294 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
295 if (myImageID == imageCtr) {
296 if (myImageID == 0) {
305 out <<
"Number of Local Elements = " << nME << endl
311 out << std::setw(width) <<
"Node ID"
312 << std::setw(width) <<
"Local Index"
313 << std::setw(width) <<
"Global Index"
315 for (
size_t i=0; i < nME; i++) {
316 out << std::setw(width) << myImageID
317 << std::setw(width) << i
318 << std::setw(width) << myEntries[i]
344 return epetraMap->getEpetra_Map();
std::string description() const
Return a simple one-line description of this object.
bool isContiguous() const
True if this Map is distributed contiguously, 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.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
const Teuchos::RCP< Node > getNode() const
Get this Map's Node object.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
static Teuchos::RCP< DefaultNodeType > getDefaultNode()
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
RCP< const Epetra_BlockMap > map_
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, int > > &graph)
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.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
#define IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG(sourceCode)
virtual std::string description() const
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.
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())
Constructor with Tpetra-defined contiguous uniform distribution.
size_t global_size_t
Global size_t object.
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
const Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
#define XPETRA_MONITOR(funcName)
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
GlobalOrdinal getIndexBase() const
The index base for this Map.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node, LocalMatOps > > toXpetra(RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node, LocalMatOps > >)
Convert an Epetra_Comm.to a Teuchos_Comm.
const Epetra_Map & getEpetra_Map() const
std::string typeName(const T &t)