42 #ifndef TPETRA_DETAILS_TRANSFER_DEF_HPP 43 #define TPETRA_DETAILS_TRANSFER_DEF_HPP 45 #include "Tpetra_Details_Transfer_decl.hpp" 46 #include "Tpetra_Details_gathervPrint.hpp" 47 #include "Tpetra_Distributor.hpp" 48 #include "Tpetra_Map.hpp" 49 #include "Teuchos_CommHelpers.hpp" 50 #include "Teuchos_TypeNameTraits.hpp" 56 template <
class LO,
class GO,
class NT>
60 const Teuchos::EVerbosityLevel verbLevel)
const 62 this->describeImpl (out,
"Tpetra::Details::Transfer", verbLevel);
65 template<
class LO,
class GO,
class NT>
69 const std::string& className,
70 const Teuchos::EVerbosityLevel verbLevel)
const 72 using Teuchos::TypeNameTraits;
73 using Teuchos::VERB_DEFAULT;
74 using Teuchos::VERB_NONE;
75 using Teuchos::VERB_LOW;
77 const Teuchos::EVerbosityLevel vl =
78 (verbLevel == VERB_DEFAULT) ? VERB_LOW : verbLevel;
80 if (vl == VERB_NONE) {
87 auto srcMap = this->getSourceMap ();
88 if (srcMap.is_null ()) {
91 auto comm = srcMap->getComm ();
92 if (comm.is_null ()) {
95 if (this->getTargetMap ().is_null () ||
96 this->getTargetMap ()->getComm ().is_null ()) {
100 const int myRank = comm->getRank ();
101 const int numProcs = comm->getSize ();
108 Teuchos::RCP<Teuchos::OSTab> tab0, tab1;
114 tab0 = Teuchos::rcp (
new Teuchos::OSTab (out));
116 out <<
"\"" << className <<
"\":" << endl;
117 tab1 = Teuchos::rcp (
new Teuchos::OSTab (out));
120 out <<
"Template parameters:" << endl;
121 Teuchos::OSTab tab2 (out);
122 out <<
"LocalOrdinal: " << TypeNameTraits<LO>::name () << endl
123 <<
"GlobalOrdinal: " << TypeNameTraits<GO>::name () << endl
124 <<
"Node: " << TypeNameTraits<NT>::name () << endl;
127 const std::string label = this->getObjectLabel ();
129 out <<
"Label: " << label << endl;
131 out <<
"Number of processes: " << numProcs << endl;
138 this->globalDescribe (out, vl);
150 out <<
"Source Map:" << endl;
153 this->getSourceMap ()->describe (out, vl);
156 out <<
"Target Map:" << endl;
159 this->getTargetMap ()->describe (out, vl);
162 out <<
"Distributor:" << endl;
164 this->getDistributor ().describe (out, vl);
167 template<
class LO,
class GO,
class NT>
171 const Teuchos::EVerbosityLevel vl)
const 174 using Teuchos::OSTab;
176 using Teuchos::toString;
183 auto srcMap = this->getSourceMap ();
184 if (srcMap.is_null ()) {
187 RCP<const Teuchos::Comm<int> > comm = srcMap->getComm ();
188 if (comm.is_null ()) {
192 const std::string myStr = localDescribeToString (vl);
196 template<
class LO,
class GO,
class NT>
198 Transfer<LO, GO, NT>::
199 localDescribeToString (
const Teuchos::EVerbosityLevel vl)
const 201 using Teuchos::OSTab;
205 RCP<std::ostringstream> outString (
new std::ostringstream);
206 RCP<Teuchos::FancyOStream> outp = Teuchos::getFancyOStream (outString);
207 Teuchos::FancyOStream& out = *outp;
209 RCP<const Teuchos::Comm<int> > comm = this->getSourceMap ()->getComm ();
210 if (this->getSourceMap ().is_null () ||
211 this->getSourceMap ()->getComm ().is_null ()) {
216 return std::string (
"");
219 const int myRank = comm->getRank ();
220 const int numProcs = comm->getSize ();
222 out <<
"Process " << myRank <<
" of " << numProcs <<
":" << endl;
225 out <<
"numSameIDs: " << getNumSameIDs () << endl;
226 out <<
"numPermuteIDs: " << getNumPermuteIDs () << endl;
227 out <<
"numRemoteIDs: " << getNumRemoteIDs () << endl;
228 out <<
"numExportIDs: " << getNumExportIDs () << endl;
232 if (vl <= Teuchos::VERB_MEDIUM) {
233 out <<
"permuteFromLIDs count: " << getPermuteFromLIDs ().size () << endl
234 <<
"permuteToLIDs count: " << getPermuteToLIDs ().size () << endl
235 <<
"remoteLIDs count: " << getRemoteLIDs ().size () << endl
236 <<
"exportLIDs count: " << getExportLIDs ().size () << endl
237 <<
"exportPIDs count: " << getExportPIDs () << endl;
240 out <<
"permuteFromLIDs: " << toString (getPermuteFromLIDs ()) << endl
241 <<
"permuteToLIDs: " << toString (getPermuteToLIDs ()) << endl
242 <<
"remoteLIDs: " << toString (getRemoteLIDs ()) << endl
243 <<
"exportLIDs: " << toString (getExportLIDs ()) << endl
244 <<
"exportPIDs: " << toString (getExportPIDs ()) << endl;
248 return outString->str ();
255 #endif // TPETRA_DETAILS_TRANSFER_DEF_HPP void describeImpl(Teuchos::FancyOStream &out, const std::string &className, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Implementation of describe() for subclasses (Tpetra::Import and Tpetra::Export).
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Common base class of Import and Export.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Describe this object in a human-readable way to the given output stream.
Implementation details of Tpetra.
void gathervPrint(std::ostream &out, const std::string &s, const Teuchos::Comm< int > &comm)
On Process 0 in the given communicator, print strings from each process in that communicator, in rank order.