LogPrintCtrl Class Reference
[Global Utility Functions]

This class provides some printing and cropping utilities for writing to the logfile. More...

#include <LogPrintCtrl.h>

Collaboration diagram for LogPrintCtrl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LogPrintCtrl (int Ndec=-1000)
 Constructor.
 ~LogPrintCtrl ()
 Destructor.
void pr_de (const double d, int sigDigits=-1, const int wMin=-1, const int wMax=-1)
 Print a double using scientific notation.
void pr_de_c10 (const double d, int sigDigits=-1, const int wMin=-1, const int wMax=-1)
 Print a double using scientific notation cropping decade values.
double cropSigDigits (const double d, int sigDigits) const
 Crop a double at a certain number of significant digits.
double cropAbs10 (const double d, const int nDecades) const
 Crop a double at a certain decade level.
int setNdec (int nDecades)
 Set the default value of N decade.
int setSigDigits (int sigDigits)
 Set the default significant digits to output.
int setWmin (int wMin)
 Set the default minimum width.
int setWmax (int wMax)
 Set the default maximum width.

Private Attributes

std::ostringstream m_os
 local stringstream class for temp output
std::ostream * m_ffss
 Pointer to the ostream where this class actually prints its information.
PrintCtrlm_pc
 Pointer to the PrintCtrl class.

Detailed Description

This class provides some printing and cropping utilities for writing to the logfile.

This class writes its output to Cantera's logfile utility. It's a wrapper around PrintCtrl object. First, we direct PrintCtrl to write to a string and then we redirect the string to the logfile utility. This is a first cut, and it's pretty much a kluge. The logfile utility, however, demands a string, and this is what I came up with.

Definition at line 40 of file LogPrintCtrl.h.


Constructor & Destructor Documentation

LogPrintCtrl ( int  Ndec = -1000  ) 

Constructor.

This also serves to initialize the ticks within the object

Parameters:
Ndec value of Ndec. Defaults to -1000, i.e., no decade cropping

Definition at line 30 of file LogPrintCtrl.cpp.

References LogPrintCtrl::m_ffss, LogPrintCtrl::m_os, and LogPrintCtrl::m_pc.

~LogPrintCtrl (  ) 

Destructor.

Definition at line 38 of file LogPrintCtrl.cpp.

References LogPrintCtrl::m_ffss, and LogPrintCtrl::m_pc.


Member Function Documentation

double cropAbs10 ( const double  d,
const int  nDecades 
) const

Crop a double at a certain decade level.

This routine will crop a floating point number at a certain decade lvl. In other words everything below a power of 10^Ndec will be deleted. Note, it does rounding up of the last digit.

Parameters:
d Double to be cropped
nDecades Number of significant digits example: d = 1.1305E-15; nDecades = -16; This routine will return 1.1E-15

d = 8.0E-17 nDecades = -16 This routine will return 0.0

Definition at line 97 of file LogPrintCtrl.cpp.

References PrintCtrl::cropAbs10(), and LogPrintCtrl::m_pc.

double cropSigDigits ( const double  d,
int  sigDigits 
) const

Crop a double at a certain number of significant digits.

This routine will crop a floating point number at a certain number of significant digits. Note, it does rounding up of the last digit.

Parameters:
d Double to be cropped
sigDigits Number of significant digits example: d = 1.0305E-15; nsig = 3; This routine will return 1.03E-15

Definition at line 112 of file LogPrintCtrl.cpp.

References PrintCtrl::cropSigDigits(), and LogPrintCtrl::m_pc.

void pr_de ( const double  d,
int  sigDigits = -1,
const int  wMin = -1,
const int  wMax = -1 
)

Print a double using scientific notation.

Prints a double using scientific notation in a fixed number of spaces.

The precision of the number will be adjusted to fit into the maximum space.

Parameters:
d double to be printed
sigDigits Number of significant digits (-1 = default, means to use the default number for the object, which is initially set to 13.
wMin Minimum number of spaces to print out
wMax Maximum number of spaces to print out

Definition at line 72 of file LogPrintCtrl.cpp.

References LogPrintCtrl::m_os, LogPrintCtrl::m_pc, PrintCtrl::pr_de(), and Cantera::writelog().

void pr_de_c10 ( const double  d,
int  sigDigits = -1,
const int  wMin = -1,
const int  wMax = -1 
)

Print a double using scientific notation cropping decade values.

Prints a double using scientific notation in a fixed number of spaces. This routine also crops number below the default decade level.

The precision of the number will be adjusted to fit into the maximum space.

Parameters:
d double to be printed
sigDigits Number of significant digits (-1 = default, means to use the default number for the object, which is initially set to 13.
wMin Minimum number of spaces to print out
wMax Maximum number of spaces to print out

Definition at line 55 of file LogPrintCtrl.cpp.

References LogPrintCtrl::m_os, LogPrintCtrl::m_pc, PrintCtrl::pr_de_c10(), and Cantera::writelog().

int setNdec ( int  nDecades  ) 

Set the default value of N decade.

Parameters:
nDecades new value of Ndec
Returns:
returns the old value of Ndec

Definition at line 122 of file LogPrintCtrl.cpp.

References LogPrintCtrl::m_pc, and PrintCtrl::setNdec().

int setSigDigits ( int  sigDigits  ) 

Set the default significant digits to output.

Parameters:
sigDigits new value of the sig digits
Returns:
returns the old value of Ndec

Definition at line 132 of file LogPrintCtrl.cpp.

References LogPrintCtrl::m_pc, and PrintCtrl::setSigDigits().

int setWmax ( int  wMax  ) 

Set the default maximum width.

Parameters:
wMax Default maximum width
Returns:
returns the old default

Definition at line 153 of file LogPrintCtrl.cpp.

References LogPrintCtrl::m_pc, and PrintCtrl::setWmax().

int setWmin ( int  wMin  ) 

Set the default minimum width.

Parameters:
wMin Default minimum width
Returns:
returns the old default

Definition at line 142 of file LogPrintCtrl.cpp.

References LogPrintCtrl::m_pc, and PrintCtrl::setWmin().


Member Data Documentation

std::ostream* m_ffss [private]

Pointer to the ostream where this class actually prints its information.

Definition at line 171 of file LogPrintCtrl.h.

Referenced by LogPrintCtrl::LogPrintCtrl(), and LogPrintCtrl::~LogPrintCtrl().

std::ostringstream m_os [private]

local stringstream class for temp output

Definition at line 167 of file LogPrintCtrl.h.

Referenced by LogPrintCtrl::LogPrintCtrl(), LogPrintCtrl::pr_de(), and LogPrintCtrl::pr_de_c10().

PrintCtrl* m_pc [private]

The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.3