Cantera  2.0
LogPrintCtrl Class Reference

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

#include <LogPrintCtrl.h>

Collaboration diagram for LogPrintCtrl:
[legend]

## 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 37 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 26 of file LogPrintCtrl.cpp.

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

 ~LogPrintCtrl ( )

Destructor.

Definition at line 34 of file LogPrintCtrl.cpp.

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

## Member Function Documentation

 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 70 of file LogPrintCtrl.cpp.

 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 52 of file LogPrintCtrl.cpp.

 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.

 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 96 of file LogPrintCtrl.cpp.

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

 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 123 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 134 of file LogPrintCtrl.cpp.

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

 int setWmin ( int wMin )

Set the default minimum width.

Parameters
 wMin Default minimum width
Returns
returns the old default

Definition at line 145 of file LogPrintCtrl.cpp.

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

 int setWmax ( int wMax )

Set the default maximum width.

Parameters
 wMax Default maximum width
Returns
returns the old default

Definition at line 157 of file LogPrintCtrl.cpp.

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

## Member Data Documentation

 std::ostringstream m_os
private

local stringstream class for temp output

Definition at line 165 of file LogPrintCtrl.h.

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

 std::ostream* m_ffss
private

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

Definition at line 169 of file LogPrintCtrl.h.

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

 PrintCtrl* m_pc
private

Pointer to the PrintCtrl class.

Definition at line 172 of file LogPrintCtrl.h.

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