63 #include <Teuchos_DefaultComm.hpp>
78 int 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){
134 for (next=detailedMsgs.begin(); next != detailedMsgs.end(); ++next){
138 for (next=verboseMsgs.begin(); next != verboseMsgs.end(); ++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){
186 for (next=detailedMsgs.begin(); next != detailedMsgs.end(); ++next){
191 for (next=verboseMsgs.begin(); next != verboseMsgs.end(); ++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;
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.
int main(int narg, char *arg[])
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
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