23 PrintCtrl::CROP_TYPE_GLOBAL PrintCtrl::GlobalCrop = GCT_NOPREF;
25 PrintCtrl::PrintCtrl(std::ostream& coutProxy,
int Ndec,
41 pr_de(d, p, wMin, wMax);
77 double dfabs = fabs(d);
80 int requestedLength = 6 + p;
84 if (dfabs < 9.9999999999E-99) {
87 if (dfabs > 9.9999999999E99) {
90 if (requestedLength > wMax) {
91 p -= (requestedLength - wMax);
98 m_cout.setf(ios_base::scientific | ios_base::uppercase);
99 int wold = (int)
m_cout.width(wMin);
100 int pold = (int)
m_cout.precision(p);
105 m_cout.unsetf(ios_base::scientific);
116 if (Ndec < -301 || Ndec > 301) {
119 double dfabs = fabs(d);
120 double pdec = pow(10.0, (
double) Ndec);
124 double dl10 = log10(dfabs);
125 int N10 = (int) dl10;
129 int nsig = N10 - Ndec;
148 double dfabs = fabs(d);
149 double dl10 = log10(dfabs);
150 int N10 = (int) dl10;
154 int E10 = -N10 + nSig ;
155 double pfabs = dfabs * pow(10.0, (
double) E10);
156 pfabs *= (1.0 + 1.0E-14);
157 long int nfabs = (
long int) pfabs;
158 double remainder = pfabs - nfabs;
159 if (remainder > 0.5) {
162 double paltabs = (double) nfabs;
163 double daltabs = paltabs * pow(10.0, (
double) -E10);
164 return sgn * daltabs;
Turn on cropping unless the global toggle is turned off.
CROP_TYPE
enum for cropping control
global toggle for turning off cropping
int m_wMin
default minimimum field width
double cropAbs10(const double d, const int nDecades) const
Crop a double at a certain decade level.
void setCropCntrl(CROP_TYPE ctlocal)
Set the cropping control flag.
bool doCrop() const
private function to figure out cropping logic
Declarations for a simple class that augments the streams printing capabilities (see Cantera::PrintCt...
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.
Turn off cropping, unless the global toggle is turned on.
int setWmin(int wMin)
Set the default minimum width.
double cropSigDigits(const double d, int sigDigits) const
Crop a double at a certain number of significant digits.
int m_wMax
Default maximum field width.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
int m_Ndec
Default decade level to use for decade cropping.
This file contains definitions for utility functions and text for modules, inputfiles, logs, textlogs, HTML_logs (see Input File Handling, Diagnostic Output, Writing messages to the screen and Writing HTML Logfiles).
global toggle for turning on cropping
void pr_de(const double d, int sigDigits=-1, const int wMin=-1, const int wMax=-1)
Print a double using scientific notation.
std::ostream & m_cout
This is the ostream to send all output from the object.
int setSigDigits(int sigDigits)
Set the default significant digits to output.
CROP_TYPE m_cropCntrl
Local Cropping Control.
int setWmax(int wMax)
Set the default maximum width.
int setNdec(int nDecades)
Set the default value of N decade.
int m_precision
default precision level to use in printing
static CROP_TYPE_GLOBAL GlobalCrop
static enum for turning on and off cropping