63#include <Teuchos_DefaultComm.hpp>
78int main(
int narg,
char *arg[])
80 Tpetra::ScopeGuard tscope(&narg, &arg);
81 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
83 int rank = comm->getRank();
84 int nprocs = comm->getSize();
87 std::set<string> basicMsgs, detailedMsgs, verboseMsgs;
88 std::set<string>::iterator next;
90 std::ostringstream oss;
91 oss <<
"Proc " << rank <<
": This is a ";
93 basicMsgs.insert(oss.str()+
string(
" basic message."));
94 basicMsgs.insert(oss.str()+
string(
"another basic message."));
95 detailedMsgs.insert(oss.str()+
string(
" detailed message."));
96 detailedMsgs.insert(oss.str()+
string(
"another detailed message."));
97 verboseMsgs.insert(oss.str()+
string(
" verbose message."));
98 verboseMsgs.insert(oss.str()+
string(
"another verbose message."));
105 bool iPrint = (rank%2 == 0);
109 for (
int i = 0; i < numLevels; i++){
116 catch(std::exception &e){
123 std::cout <<
"\nThere are " << nprocs <<
" processes. ";
124 std::cout <<
"Even ranks participate, output level is: " << level << std::endl;
130 for (next=basicMsgs.begin(); next != basicMsgs.end(); ++next){
131 dm->
print(BASIC_STATUS, *next);
134 for (next=detailedMsgs.begin(); next != detailedMsgs.end(); ++next){
135 dm->
print(DETAILED_STATUS, *next);
138 for (next=verboseMsgs.begin(); next != verboseMsgs.end(); ++next){
139 dm->
print(VERBOSE_DETAILED_STATUS, *next);
143 catch(std::exception &e){
154 iPrint = (rank == 0);
157 for (
int i = 0; i < numLevels; i++){
161 std::ios_base::openmode flags = std::ios_base::out & std::ios_base::trunc;
163 std::ofstream outF(
"testFile.txt", flags);
168 catch(std::exception &e){
175 std::cout <<
"\nThere are " << nprocs <<
" processes. ";
176 std::cout <<
"Rank zero only participates, output level is: ";
177 std::cout << level << std::endl;
181 for (next=basicMsgs.begin(); next != basicMsgs.end(); ++next){
182 dm->
print(BASIC_STATUS, *next);
186 for (next=detailedMsgs.begin(); next != detailedMsgs.end(); ++next){
187 dm->
print(DETAILED_STATUS, *next);
191 for (next=verboseMsgs.begin(); next != verboseMsgs.end(); ++next){
192 dm->
print(VERBOSE_DETAILED_STATUS, *next);
196 catch(std::exception &e){
209 std::ifstream inF(
"testFile.txt");
211 while (getline(inF, s)){
212 std::cout << s << std::endl;
215 system(
"rm testFile.txt");
222 std::cout <<
"PASS" << std::endl;
Zoltan2::MessageOutputLevel level_t
#define TEST_FAIL_AND_EXIT(comm, ok, s, code)
Debug output manager for Zoltan2.
Defines Parameter related enumerators, declares functions.
common code used by tests
DebugManager contains the methods that perform output of debug and status messages.
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.
static const std::string fail
MessageOutputLevel
The amount of debugging or status output to print.
@ BASIC_STATUS
the status at each high level step
@ DETAILED_STATUS
sub-steps, each method's entry and exit
@ NUM_STATUS_OUTPUT_LEVELS
@ NO_STATUS
don't display status/debug messages
@ VERBOSE_DETAILED_STATUS
include more detail about sub-steps