00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef PLAYA_OUT_HPP
00043 #define PLAYA_OUT_HPP
00044
00045 #include "PlayaDefs.hpp"
00046 #include "Teuchos_Assert.hpp"
00047 #include "Teuchos_RefCountPtr.hpp"
00048 #include "Teuchos_FancyOStream.hpp"
00049 #include "PlayaMPIComm.hpp"
00050
00051 namespace Teuchos
00052 {
00053 template <class T> class Array;
00054 }
00055
00056 namespace Playa
00057 {
00058 class Tabs;
00059 using namespace Teuchos;
00060 using std::cout;
00061 using std::endl;
00062 using std::cerr;
00063
00064
00065
00066
00067
00068 class Out
00069 {
00070 public:
00071
00072
00073 static void println(const std::string& str)
00074 {
00075 if (!suppressStdout()) os() << str << std::endl;
00076 }
00077
00078
00079 static std::ostream*& basicStream()
00080 {
00081 static std::ostream* rtn = &std::cout;
00082 return rtn;
00083 }
00084
00085
00086 static FancyOStream& os();
00087
00088
00089
00090 static FancyOStream& root();
00091
00092
00093 static bool& suppressStdout() {static bool rtn=false; return rtn;}
00094 };
00095
00096
00097
00098 void writeTable(std::ostream& os, const Tabs& tab,
00099 const Array<double>& a, int cols);
00100
00101 void writeTable(std::ostream& os, const Tabs& tab,
00102 const Array<int>& a, int cols);
00103
00104 }
00105
00106 #define PLAYA_OUT(test, msg) \
00107 { \
00108 if (test) \
00109 { \
00110 TeuchosOStringStream omsg; \
00111 omsg << msg; \
00112 Out::println(omsg.str()); \
00113 } \
00114 }
00115
00116 #define PLAYA_ROOT_OUT(test, msg) \
00117 { \
00118 if (test) \
00119 { \
00120 TeuchosOStringStream omsg; \
00121 omsg << msg; \
00122 Out::root() << omsg.str() << std::endl; \
00123 } \
00124 }
00125
00126
00127 #define PLAYA_VERB_EXTREME(msg) PLAYA_MSG4(this->verb(), msg)
00128 #define PLAYA_VERB_HIGH(msg) PLAYA_MSG3(this->verb(), msg)
00129 #define PLAYA_VERB_MEDIUM(msg) PLAYA_MSG2(this->verb(), msg)
00130 #define PLAYA_VERB_LOW(msg) PLAYA_MSG1(this->verb(), msg)
00131
00132 #define PLAYA_HEADER_LINE "\n------------------------------------------------------------------\n"
00133
00134 #define PLAYA_MSG(context, level, msg) PLAYA_OUT(this->verbLevel(context) >= level, msg)
00135
00136 #define PLAYA_LEVEL1(context, msg) PLAYA_MSG(context, 1, msg)
00137
00138 #define PLAYA_LEVEL2(context, msg) PLAYA_MSG(context, 2, msg)
00139
00140 #define PLAYA_LEVEL3(context, msg) PLAYA_MSG(context, 3, msg)
00141
00142 #define PLAYA_LEVEL4(context, msg) PLAYA_MSG(context, 4, msg)
00143
00144 #define PLAYA_LEVEL5(context, msg) PLAYA_MSG(context, 5, msg)
00145
00146
00147 #define PLAYA_MSG1(level, msg) PLAYA_OUT(level >= 1, msg)
00148
00149 #define PLAYA_MSG2(level, msg) PLAYA_OUT(level >= 2, msg)
00150
00151 #define PLAYA_MSG3(level, msg) PLAYA_OUT(level >= 3, msg)
00152
00153 #define PLAYA_MSG4(level, msg) PLAYA_OUT(level >= 4, msg)
00154
00155 #define PLAYA_MSG5(level, msg) PLAYA_OUT(level >= 5, msg)
00156
00157
00158
00159 #define PLAYA_ROOT_MSG1(level, msg) PLAYA_ROOT_OUT(level >= 1, msg)
00160
00161 #define PLAYA_ROOT_MSG2(level, msg) PLAYA_ROOT_OUT(level >= 2, msg)
00162
00163 #define PLAYA_ROOT_MSG3(level, msg) PLAYA_ROOT_OUT(level >= 3, msg)
00164
00165 #define PLAYA_ROOT_MSG4(level, msg) PLAYA_ROOT_OUT(level >= 4, msg)
00166
00167 #define PLAYA_ROOT_MSG5(level, msg) PLAYA_ROOT_OUT(level >= 5, msg)
00168
00169
00170
00171
00172 #define PLAYA_BANNER1(level, tab, msg) \
00173 PLAYA_ROOT_MSG1(level, tab \
00174 << "===================================================================");\
00175 PLAYA_ROOT_MSG1(level, tab << std::endl << tab \
00176 << " " << msg); \
00177 PLAYA_ROOT_MSG1(level, tab << std::endl << tab\
00178 << "===================================================================");
00179
00180
00181 #define PLAYA_BANNER2(level, tab, msg) \
00182 PLAYA_ROOT_MSG2(level, tab \
00183 << "-------------------------------------------------------------------");\
00184 PLAYA_ROOT_MSG2(level, tab << msg); \
00185 PLAYA_MSG2(level, tab\
00186 << "-------------------------------------------------------------------");
00187
00188
00189
00190 #define PLAYA_BANNER3(level, tab, msg) \
00191 PLAYA_ROOT_MSG3(level, tab \
00192 << "-------------------------------------------------------------------");\
00193 PLAYA_ROOT_MSG3(level, tab << std::endl << tab \
00194 << msg); \
00195 PLAYA_ROOT_MSG3(level, tab << std::endl << tab\
00196 << "-------------------------------------------------------------------");
00197
00198 #endif