63 #include <Teuchos_DefaultComm.hpp> 79 int main(
int argc,
char *argv[])
81 Teuchos::GlobalMPISession session(&argc, &argv);
82 Teuchos::RCP<const Teuchos::Comm<int> > comm =
83 Teuchos::DefaultComm<int>::getComm();
85 int rank = comm->getRank();
86 int nprocs = comm->getSize();
89 set<string> basicMsgs, detailedMsgs, verboseMsgs;
90 set<string>::iterator next;
93 oss <<
"Proc " << rank <<
": This is a ";
95 basicMsgs.insert(oss.str()+string(
" basic message."));
96 basicMsgs.insert(oss.str()+string(
"another basic message."));
97 detailedMsgs.insert(oss.str()+string(
" detailed message."));
98 detailedMsgs.insert(oss.str()+string(
"another detailed message."));
99 verboseMsgs.insert(oss.str()+string(
" verbose message."));
100 verboseMsgs.insert(oss.str()+string(
"another verbose message."));
107 bool iPrint = (rank%2 == 0);
111 for (
int i = 0; i < numLevels; i++){
118 catch(std::exception &e){
125 std::cout <<
"\nThere are " << nprocs <<
" processes. ";
126 std::cout <<
"Even ranks participate, output level is: " << level << std::endl;
132 for (next=basicMsgs.begin(); next != basicMsgs.end(); ++next){
136 for (next=detailedMsgs.begin(); next != detailedMsgs.end(); ++next){
140 for (next=verboseMsgs.begin(); next != verboseMsgs.end(); ++next){
145 catch(std::exception &e){
156 iPrint = (rank == 0);
159 for (
int i = 0; i < numLevels; i++){
163 ios_base::openmode flags = ios_base::out & ios_base::trunc;
165 ofstream outF(
"testFile.txt", flags);
170 catch(std::exception &e){
177 std::cout <<
"\nThere are " << nprocs <<
" processes. ";
178 std::cout <<
"Rank zero only participates, output level is: ";
179 std::cout << level << std::endl;
183 for (next=basicMsgs.begin(); next != basicMsgs.end(); ++next){
188 for (next=detailedMsgs.begin(); next != detailedMsgs.end(); ++next){
193 for (next=verboseMsgs.begin(); next != verboseMsgs.end(); ++next){
198 catch(std::exception &e){
211 ifstream inF(
"testFile.txt");
213 while (getline(inF, s)){
214 std::cout << s << std::endl;
217 system(
"rm testFile.txt");
224 std::cout <<
"PASS" << std::endl;
void print(MessageOutputLevel debugLevel, const std::string &output)
Print a debug or status message, if this process is one of those that is supposed to be doing output...
MessageOutputLevel
The amount of debugging or status output to print.
Defines Parameter related enumerators, declares functions.
Debug output manager for Zoltan2.
#define TEST_FAIL_AND_EXIT(comm, ok, s, code)
common code used by tests
sub-steps, each method's entry and exit
int main(int argc, char *argv[])
Zoltan2::MessageOutputLevel level_t
don't display status/debug messages
static const std::string fail
the status at each high level step
DebugManager contains the methods that perform output of debug and status messages.
include more detail about sub-steps