#include <NOX_Utils.H>
Classes | |
class | Fill |
Fill object - used to print the given character the number of times specified. More... | |
class | Sci |
Sci object - used to print the given value with the specified precision. More... | |
Public Types | |
enum | MsgType { Error = 0, Warning = 0x1, OuterIteration = 0x2, InnerIteration = 0x4, Parameters = 0x8, Details = 0x10, OuterIterationStatusTest = 0x20, LinearSolverDetails = 0x40, TestDetails = 0x80, StepperIteration = 0x0100, StepperDetails = 0x0200, StepperParameters = 0x0400, Debug = 0x01000 } |
Message types for printing. More... | |
Public Member Functions | |
Utils (int outputInformation=0xf, int MyPID=0, int outputProcess=0, int outputPrecision=3, const Teuchos::RCP< std::ostream > &outputStream=Teuchos::null, const Teuchos::RCP< std::ostream > &errorStream=Teuchos::null) | |
Constructor. | |
Utils (Teuchos::ParameterList &p) | |
Constructor via a parameter list. | |
Utils (const NOX::Utils &u) | |
Copy constructor. | |
~Utils () | |
Destructor. | |
NOX::Utils & | operator= (const NOX::Utils &source) |
Assignment operator. | |
void | reset (Teuchos::ParameterList &p) |
Reset the printing parameters. | |
bool | isPrintType (NOX::Utils::MsgType type) const |
Returns true if this is a valid print type. | |
std::ostream & | out () const |
Returns the ostream for printing if this proces is the print process. Returns a Teuchos::oblackholestream otherwise. | |
std::ostream & | out (NOX::Utils::MsgType type) const |
Returns the ostream for printing if this process is the print process and the print type is valid. Returns a Teuchos::oblackholestream otherwise. | |
std::ostream & | pout () const |
Returns the ostream for printing regardless of the print processor. Only use this call if you want all processes to print to the ostream. | |
std::ostream & | pout (NOX::Utils::MsgType type) const |
Returns the ostream for printing if the print type matches. Only use this call if you want all processes to print to the ostream for the print type. | |
std::ostream & | err () const |
Returns the error stream for printing if this is the print process. | |
std::ostream & | perr () const |
Returns the error stream for printing to all processors. Only use this call if you want all processes to print to the error stream. | |
void | print (ostream &os) const |
Print this object. | |
Sci | sciformat (double dval) const |
Creates a Sci object which can be used in an output stream for printing a double precision number in scientific format with an arbitrary precision. The precision is that specificed by the Utils object. | |
Static Public Member Functions | |
static Fill | fill (int filln, char fillc= '*') |
Creates a Fill object which can be used in an output stream to insert an arbitrary number of a given character. The default character is an asterick. | |
static Sci | sciformat (double dval, int prec) |
Static version of sciformat(). | |
Private Attributes | |
int | precision |
Output precision for floats and doubles. | |
int | myPID |
Processor ID. | |
int | printTest |
Output test. | |
int | printProc |
Processor responsible for output. | |
Teuchos::RCP< std::ostream > | blackholeStream |
std::ostream derived object that deletes the output. | |
Teuchos::RCP< std::ostream > | printStream |
Output stream to be used for printing. | |
Teuchos::RCP< std::ostream > | myStream |
Output stream used for printing to the print process. | |
Teuchos::RCP< std::ostream > | errorStream |
Output stream used for printing to the print process. |
The following parameters are valid for this class and should be defined in the "Printing" sublist of the solver parameter list.
The public variables should never be modified directly.
Definition at line 97 of file NOX_Utils.H.
enum NOX::Utils::MsgType |
Message types for printing.
Note that each message type is a power of two - this is very important. They can be added together to specify which messages you wish to receive.
Definition at line 135 of file NOX_Utils.H.
NOX::Utils::Utils | ( | int | outputInformation = 0xf , |
|
int | MyPID = 0 , |
|||
int | outputProcess = 0 , |
|||
int | outputPrecision = 3 , |
|||
const Teuchos::RCP< std::ostream > & | outputStream = Teuchos::null , |
|||
const Teuchos::RCP< std::ostream > & | errorStream = Teuchos::null | |||
) |
Constructor.
The final two arguments are a reference counted pointers to ostreams. This defaults to std::cout and std::cerr if not supplied. Users should only supply this argument if they want output directed to a std::ostream other than the defaults. If so, they must wrap the ostream in a reference counted pointer for safe memory management.
Definition at line 50 of file NOX_Utils.C.
References blackholeStream, errorStream, myPID, myStream, printProc, and printStream.
NOX::Utils::Utils | ( | Teuchos::ParameterList & | p | ) |
NOX::Utils::Utils | ( | const NOX::Utils & | u | ) |
NOX::Utils::~Utils | ( | ) |
NOX::Utils::Fill NOX::Utils::fill | ( | int | filln, | |
char | fillc = '*' | |||
) | [static] |
Creates a Fill object which can be used in an output stream to insert an arbitrary number of a given character. The default character is an asterick.
For example,
cout << Utils::fill(10) << "or" << Utils::fill(10,'-');
This is modeled after the Form and Bound_form objects in Stroustrup, C++ Programming Langauge, 3rd ed., Chapter 21.4.
Definition at line 187 of file NOX_Utils.C.
Referenced by NOX::LineSearch::NonlinearCG::compute(), NOX::LineSearch::Backtrack::compute(), NOX::LineSearch::MoreThuente::cvsrch(), NOX::Solver::TrustRegionBased::init(), NOX::Solver::TensorBased::init(), NOX::Solver::LineSearchBased::init(), NOX::Solver::InexactTrustRegionBased::init(), NOX::Multiphysics::Solver::FixedPointBased::init(), NOX::Solver::InexactTrustRegionBased::iterateInexact(), NOX::Solver::InexactTrustRegionBased::iterateStandard(), NOX::Solver::TensorBased::performLinesearch(), NOX::LineSearch::Utils::Printing::printOpeningRemarks(), NOX::LineSearch::Polynomial::printOpeningRemarks(), NOX::LineSearch::Utils::Printing::printStep(), NOX::Solver::TrustRegionBased::printUpdate(), NOX::Solver::TensorBased::printUpdate(), NOX::Solver::LineSearchBased::printUpdate(), NOX::Solver::InexactTrustRegionBased::printUpdate(), NOX::Multiphysics::Solver::FixedPointBased::printUpdate(), NOX::Solver::TrustRegionBased::reset(), NOX::Solver::InexactTrustRegionBased::reset(), and NOX::Solver::TrustRegionBased::step().
NOX::Utils & NOX::Utils::operator= | ( | const NOX::Utils & | source | ) |
Assignment operator.
Definition at line 87 of file NOX_Utils.C.
References blackholeStream, errorStream, myPID, myStream, precision, printProc, printStream, and printTest.
void NOX::Utils::reset | ( | Teuchos::ParameterList & | p | ) |
Reset the printing parameters.
Definition at line 101 of file NOX_Utils.C.
References blackholeStream, Debug, Details, Error, errorStream, InnerIteration, LinearSolverDetails, myPID, myStream, OuterIteration, OuterIterationStatusTest, Parameters, precision, printProc, printStream, printTest, StepperDetails, StepperIteration, StepperParameters, TestDetails, and Warning.
Referenced by Utils().
bool NOX::Utils::isPrintType | ( | NOX::Utils::MsgType | type | ) | const |
Returns true if this is a valid print type.
Definition at line 218 of file NOX_Utils.C.
References Error, and printTest.
Referenced by NOX::Epetra::LinearSystemAztecOO::applyJacobianInverse(), NOX::Epetra::LinearSystemAztecOO::applyRightPreconditioning(), NOX::Epetra::FiniteDifferenceColoring::computeJacobian(), NOX::Epetra::LinearSystemAztecOO::createIfpackPreconditioner(), NOX::Epetra::LinearSystemAztecOO::createNewIfpackPreconditioner(), NOX::Epetra::LinearSystemAztecOO::createPreconditioner(), NOX::LineSearch::MoreThuente::cvsrch(), NOX::Epetra::LinearSystemAztecOO::destroyPreconditioner(), NOX::Epetra::Group::getNormLastLinearSolveResidual(), NOX::Epetra::LinearSystemAztecOO::getPreconditionerPolicy(), out(), NOX::Solver::TensorBased::performLinesearch(), pout(), NOX::LineSearch::Utils::Printing::printOpeningRemarks(), NOX::LineSearch::Polynomial::printOpeningRemarks(), NOX::LineSearch::Utils::Printing::printStep(), NOX::Epetra::LinearSystemAztecOO::recomputePreconditioner(), and NOX::Epetra::LinearSystemAztecOO::setAztecOptions().
std::ostream & NOX::Utils::out | ( | ) | const |
Returns the ostream for printing if this proces is the print process. Returns a Teuchos::oblackholestream otherwise.
Definition at line 224 of file NOX_Utils.C.
References myStream.
Referenced by NOX::Epetra::MatrixFree::ApplyInverse(), NOX::Epetra::LinearSystemAztecOO::applyJacobianInverse(), NOX::Epetra::LinearSystemAztecOO::applyRightPreconditioning(), NOX::Multiphysics::Solver::Manager::checkNullPtr(), NOX::Epetra::FiniteDifference::computeJacobian(), NOX::LineSearch::Utils::Slope::computeSlope(), NOX::LineSearch::Utils::Slope::computeSlopeWithOutJac(), NOX::Epetra::LinearSystemAztecOO::createIfpackPreconditioner(), NOX::Epetra::LinearSystemAztecOO::createNewIfpackPreconditioner(), NOX::Epetra::LinearSystemAztecOO::createPreconditioner(), NOX::LineSearch::MoreThuente::cvsrch(), NOX::Multiphysics::Solver::Manager::deprecated(), NOX::Epetra::LinearSystemAztecOO::destroyPreconditioner(), NOX::Epetra::LinearSystemAztecOO::getPreconditionerPolicy(), NOX::Epetra::MatrixFree::NormInf(), NOX::Epetra::LinearSystemAztecOO::precError(), NOX::LineSearch::Polynomial::printBadSlopeWarning(), NOX::LineSearch::Utils::Printing::printOpeningRemarks(), NOX::LineSearch::Polynomial::printOpeningRemarks(), NOX::LineSearch::Utils::Printing::printStep(), NOX::Epetra::LinearSystemAztecOO::recomputePreconditioner(), NOX::Epetra::LinearSystemAztecOO::setAztecOptions(), and NOX::Epetra::MatrixFree::SetUseTranspose().
std::ostream & NOX::Utils::out | ( | NOX::Utils::MsgType | type | ) | const |
Returns the ostream for printing if this process is the print process and the print type is valid. Returns a Teuchos::oblackholestream otherwise.
Definition at line 229 of file NOX_Utils.C.
References blackholeStream, isPrintType(), and myStream.
std::ostream & NOX::Utils::pout | ( | ) | const |
Returns the ostream for printing regardless of the print processor. Only use this call if you want all processes to print to the ostream.
Definition at line 237 of file NOX_Utils.C.
References printStream.
Referenced by NOX::Epetra::LinearSystemAztecOO::setAztecOptions().
std::ostream & NOX::Utils::pout | ( | NOX::Utils::MsgType | type | ) | const |
Returns the ostream for printing if the print type matches. Only use this call if you want all processes to print to the ostream for the print type.
Definition at line 242 of file NOX_Utils.C.
References blackholeStream, isPrintType(), and printStream.
std::ostream & NOX::Utils::err | ( | ) | const |
Returns the error stream for printing if this is the print process.
Definition at line 250 of file NOX_Utils.C.
References blackholeStream, errorStream, myPID, and printProc.
Referenced by NOX::StatusTest::Combo::addStatusTest(), NOX::LineSearch::Polynomial::checkConvergence(), NOX::LineSearch::MoreThuente::cvsrch(), NOX::StatusTest::MaxIters::MaxIters(), and NOX::StatusTest::NormF::relativeSetup().
std::ostream & NOX::Utils::perr | ( | ) | const |
Returns the error stream for printing to all processors. Only use this call if you want all processes to print to the error stream.
Definition at line 255 of file NOX_Utils.C.
References errorStream.
Referenced by NOX::Epetra::LinearSystemAztecOO::setAztecOptions().
void NOX::Utils::print | ( | ostream & | os | ) | const |
NOX::Utils::Sci NOX::Utils::sciformat | ( | double | dval | ) | const |
Creates a Sci object which can be used in an output stream for printing a double precision number in scientific format with an arbitrary precision. The precision is that specificed by the Utils object.
For example,
cout << Utils::sci(d) << "or" << Utils::sci(d,2);
This is modeled after the Form and Bound_form objects in Stroustrup, C++ Programming Langauge, 3rd ed., Chapter 21.4.
Definition at line 199 of file NOX_Utils.C.
References precision.
Referenced by NOX::Epetra::LinearSystemAztecOO::createIfpackPreconditioner(), NOX::StatusTest::NormWRMS::print(), NOX::StatusTest::NormUpdate::print(), NOX::StatusTest::NormF::print(), and NOX::LineSearch::Utils::Printing::printStep().
NOX::Utils::Sci NOX::Utils::sciformat | ( | double | dval, | |
int | prec | |||
) | [static] |
int NOX::Utils::precision [private] |
Output precision for floats and doubles.
Definition at line 257 of file NOX_Utils.H.
Referenced by operator=(), print(), reset(), and sciformat().
int NOX::Utils::myPID [private] |
Processor ID.
Definition at line 260 of file NOX_Utils.H.
Referenced by err(), operator=(), print(), reset(), and Utils().
int NOX::Utils::printTest [private] |
Output test.
Definition at line 263 of file NOX_Utils.H.
Referenced by isPrintType(), operator=(), print(), and reset().
int NOX::Utils::printProc [private] |
Processor responsible for output.
Definition at line 266 of file NOX_Utils.H.
Referenced by err(), operator=(), print(), reset(), and Utils().
Teuchos::RCP<std::ostream> NOX::Utils::blackholeStream [private] |
std::ostream derived object that deletes the output.
This is useful for parallel printing to eliminate errors due to printing to all processors.
Definition at line 271 of file NOX_Utils.H.
Referenced by err(), operator=(), out(), pout(), reset(), and Utils().
Teuchos::RCP<std::ostream> NOX::Utils::printStream [private] |
Output stream to be used for printing.
Definition at line 274 of file NOX_Utils.H.
Referenced by operator=(), pout(), reset(), and Utils().
Teuchos::RCP<std::ostream> NOX::Utils::myStream [private] |
Output stream used for printing to the print process.
Definition at line 277 of file NOX_Utils.H.
Referenced by operator=(), out(), reset(), and Utils().
Teuchos::RCP<std::ostream> NOX::Utils::errorStream [private] |
Output stream used for printing to the print process.
Definition at line 280 of file NOX_Utils.H.
Referenced by err(), operator=(), perr(), reset(), and Utils().