28 #include <Teuchos_DefaultComm.hpp>
43 int main(
int narg,
char *arg[])
45 Tpetra::ScopeGuard tscope(&narg, &arg);
46 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
48 int rank = comm->getRank();
49 int nprocs = comm->getSize();
52 std::set<string> basicMsgs, detailedMsgs, verboseMsgs;
53 std::set<string>::iterator next;
55 std::ostringstream oss;
56 oss <<
"Proc " << rank <<
": This is a ";
58 basicMsgs.insert(oss.str()+string(
" basic message."));
59 basicMsgs.insert(oss.str()+string(
"another basic message."));
60 detailedMsgs.insert(oss.str()+string(
" detailed message."));
61 detailedMsgs.insert(oss.str()+string(
"another detailed message."));
62 verboseMsgs.insert(oss.str()+string(
" verbose message."));
63 verboseMsgs.insert(oss.str()+string(
"another verbose message."));
70 bool iPrint = (rank%2 == 0);
74 for (
int i = 0; i < numLevels; i++){
81 catch(std::exception &e){
88 std::cout <<
"\nThere are " << nprocs <<
" processes. ";
89 std::cout <<
"Even ranks participate, output level is: " << level << std::endl;
95 for (next=basicMsgs.begin(); next != basicMsgs.end(); ++next){
99 for (next=detailedMsgs.begin(); next != detailedMsgs.end(); ++next){
103 for (next=verboseMsgs.begin(); next != verboseMsgs.end(); ++next){
108 catch(std::exception &e){
119 iPrint = (rank == 0);
122 for (
int i = 0; i < numLevels; i++){
126 std::ios_base::openmode flags = std::ios_base::out & std::ios_base::trunc;
128 std::ofstream outF(
"testFile.txt", flags);
133 catch(std::exception &e){
140 std::cout <<
"\nThere are " << nprocs <<
" processes. ";
141 std::cout <<
"Rank zero only participates, output level is: ";
142 std::cout << level << std::endl;
146 for (next=basicMsgs.begin(); next != basicMsgs.end(); ++next){
151 for (next=detailedMsgs.begin(); next != detailedMsgs.end(); ++next){
156 for (next=verboseMsgs.begin(); next != verboseMsgs.end(); ++next){
161 catch(std::exception &e){
174 std::ifstream inF(
"testFile.txt");
176 while (getline(inF, s)){
177 std::cout << s << std::endl;
180 system(
"rm testFile.txt");
187 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)
int main(int narg, char **arg)
common code used by tests
sub-steps, each method's entry and exit
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