NOX Development
Loading...
Searching...
No Matches
NOX::Utils Class Reference

Provides printing utilities. More...

#include <NOX_Utils.H>

Inheritance diagram for NOX::Utils:

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::Utilsoperator= (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 std::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 std::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 std::ostream for printing regardless of the print processor. Only use this call if you want all processes to print to the std::ostream.
std::ostream & pout (NOX::Utils::MsgType type) const
 Returns the std::ostream for printing if the print type matches. Only use this call if you want all processes to print to the std::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 (std::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().

Detailed Description

Provides printing utilities.

The following parameters are valid for this class and should be defined in the "Printing" sublist of the solver parameter list.

  • "Output Information" - Can be a sublist or an integer. If it is an integer, this value is a sum of MsgType's to specify how much information to show. Defaults to NOX::Utils::Warning + NOX::Utils::OuterIteration + NOX::Utils::InnerIteration + NOX::Utils::Parameters = 0xf = 15. If this is a sublist, the following booleans are valid (set to true to enable print option):
    • "Error"
    • "Warning"
    • "Outer Iteration"
    • "Inner Iteration"
    • "Parameters"
    • "Details"
    • "Outer Iteration StatusTest"
    • "Linear Solver Details"
    • "Test Details"
    • "Stepper Iteration"
    • "Stepper Details"
    • "Stepper Parameters"
    • "Debug"
  • "Output Processor" - Specifies the designated print process. Defaults to 0.
  • "MyPID" - Specifies this process's ID. Defaults to 0.
  • "Output Precision" - Specifis the default number of decimal places to be used when printing floating point numbers. The default is 4.
  • "Output Stream" - A Teuchos::RCP<std::ostream> object that will be used for standard output.
  • "Error Stream" - A Teuchos::RCP<std::ostream> object that will be used for output of error information.

The public variables should never be modified directly.

Member Enumeration Documentation

◆ 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.

Enumerator
Error 

Errors are always printed.

Warning 

2^0

OuterIteration 

2^1

InnerIteration 

2^2

Parameters 

2^3

Details 

2^4

OuterIterationStatusTest 

2^5

LinearSolverDetails 

2^6

TestDetails 

2^7

StepperIteration 

2^8 – For LOCA

StepperDetails 

2^9 – For LOCA

StepperParameters 

2^10 – For LOCA

Debug 

2^12

Constructor & Destructor Documentation

◆ Utils()

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 std::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 std::ostream in a reference counted pointer for safe memory management.

Referenced by NOX::LineSearch::Utils::Printing::Printing().

Member Function Documentation

◆ fill()

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,'-');
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 ...
Definition NOX_Utils.C:160

This is modeled after the Form and Bound_form objects in Stroustrup, C++ Programming Langauge, 3rd ed., Chapter 21.4.

Referenced by NOX::LineSearch::Backtrack::compute(), NOX::LineSearch::NonlinearCG::compute(), NOX::Multiphysics::Solver::FixedPointBased::init(), NOX::Solver::AndersonAcceleration::init(), NOX::Solver::InexactTrustRegionBased::init(), NOX::Solver::LineSearchBased::init(), NOX::Solver::SingleStep::init(), NOX::Solver::TensorBased::init(), NOX::Solver::TrustRegionBased::init(), NOX::Solver::InexactTrustRegionBased::iterateInexact(), NOX::Solver::InexactTrustRegionBased::iterateStandard(), NOX::Solver::TensorBased::performLinesearch(), NOX::LineSearch::Polynomial::printOpeningRemarks(), NOX::LineSearch::Utils::Printing::printOpeningRemarks(), NOX::LineSearch::Utils::Printing::printStep(), NOX::Multiphysics::Solver::FixedPointBased::printUpdate(), NOX::Solver::AndersonAcceleration::printUpdate(), NOX::Solver::InexactTrustRegionBased::printUpdate(), NOX::Solver::LineSearchBased::printUpdate(), NOX::Solver::SingleStep::printUpdate(), NOX::Solver::TensorBased::printUpdate(), NOX::Solver::TrustRegionBased::printUpdate(), NOX::Solver::InexactTrustRegionBased::reset(), NOX::Solver::InexactTrustRegionBased::reset(), NOX::Solver::InexactTrustRegionBased::reset(), NOX::Solver::LineSearchBased::solve(), NOX::Solver::TrustRegionBased::step(), and LOCA::Stepper::stopLocaStatus().

◆ sciformat()

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.

Referenced by LOCA::Bifurcation::PitchforkBord::StatusTest::SlackUpdateNorm::print(), LOCA::Continuation::StatusTest::ParameterResidualNorm::print(), LOCA::Continuation::StatusTest::ParameterUpdateNorm::print(), NOX::StatusTest::NormF::print(), NOX::StatusTest::NormUpdate::print(), NOX::StatusTest::RelativeNormF::print(), and NOX::LineSearch::Utils::Printing::printStep().


The documentation for this class was generated from the following files: