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 NOX_UTILS_H
00043 #define NOX_UTILS_H
00044
00045 #include "NOX_Common.H"
00046 #include "Teuchos_oblackholestream.hpp"
00047 #include "Teuchos_RCP.hpp"
00048
00049
00050 namespace Teuchos {
00051 class ParameterList;
00052 }
00053
00054 namespace NOX {
00055
00097 class Utils {
00098
00099 public:
00100
00102 class Fill {
00103 public:
00105 Fill(int ntimes, char ch) : n(ntimes), c(ch) {};
00107 ~Fill() {};
00109 int n;
00111 char c;
00112 };
00113
00115 class Sci {
00116 public:
00118 Sci(double val, int precision = -1) : d(val), p(precision) {};
00120 ~Sci() {};
00122 double d;
00124 int p;
00125 };
00126
00127
00135 enum MsgType {
00137 Error = 0,
00139 Warning = 0x1,
00141 OuterIteration = 0x2,
00143 InnerIteration = 0x4,
00145 Parameters = 0x8,
00147 Details = 0x10,
00149 OuterIterationStatusTest = 0x20,
00151 LinearSolverDetails = 0x40,
00153 TestDetails = 0x80,
00155 StepperIteration = 0x0100,
00157 StepperDetails = 0x0200,
00159 StepperParameters = 0x0400,
00161 Debug = 0x01000
00162 };
00163
00164
00165 public:
00166
00178 static Fill fill(int filln, char fillc = '*');
00179
00180 public:
00181
00183
00189 Utils(int outputInformation=0xf, int MyPID=0, int outputProcess=0,
00190 int outputPrecision=3,
00191 const Teuchos::RCP<std::ostream>& outputStream=
00192 Teuchos::null,
00193 const Teuchos::RCP<std::ostream>& errorStream=
00194 Teuchos::null);
00195
00197 Utils(Teuchos::ParameterList& p);
00198
00200 Utils(const NOX::Utils& u);
00201
00203 ~Utils();
00204
00206 NOX::Utils& operator=(const NOX::Utils& source);
00207
00209 void reset(Teuchos::ParameterList& p);
00210
00212 bool isPrintType(NOX::Utils::MsgType type) const;
00213
00215 std::ostream& out() const;
00216
00218 std::ostream& out(NOX::Utils::MsgType type) const;
00219
00221 std::ostream& pout() const;
00222
00224 std::ostream& pout(NOX::Utils::MsgType type) const;
00225
00227 std::ostream& err() const;
00228
00230 std::ostream& perr() const;
00231
00233 void print(ostream& os) const;
00234
00247 Sci sciformat(double dval) const;
00248
00252 static Sci sciformat(double dval, int prec);
00253
00254 private:
00255
00257 int precision;
00258
00260 int myPID;
00261
00263 int printTest;
00264
00266 int printProc;
00267
00269
00271 Teuchos::RCP<std::ostream> blackholeStream;
00272
00274 Teuchos::RCP<std::ostream> printStream;
00275
00277 Teuchos::RCP<std::ostream> myStream;
00278
00280 Teuchos::RCP<std::ostream> errorStream;
00281
00282 };
00283
00284 }
00285
00286 ostream& operator<<(ostream&, const NOX::Utils::Fill&);
00287 ostream& operator<<(ostream&, const NOX::Utils::Sci&);
00288 ostream& operator<<(ostream&, const NOX::Utils& utils);
00289
00290
00291 #endif