Cantera  2.1.2
LogPrintCtrl.cpp
Go to the documentation of this file.
1 /**
2  * @file LogPrintCtrl.cpp
3  * Declarations for a simple class that augments the logfile printing capabilities
4  * (see \ref Cantera::LogPrintCtrl).
5  */
6 /*
7  * Copyright 2004 Sandia Corporation. Under the terms of Contract
8  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
9  * retains certain rights in this software.
10  * See file License.txt for licensing information.
11  */
12 
13 #include "LogPrintCtrl.h"
14 #include "cantera/base/global.h"
15 
16 using namespace std;
17 
18 namespace Cantera
19 {
20 
21 LogPrintCtrl::LogPrintCtrl(int Ndec) :
22  m_ffss(0),
23  m_pc(0)
24 {
25  warn_deprecated("class LogPrintCtrl");
26  m_ffss = new std::ostream(m_os.rdbuf());
27  m_pc = new PrintCtrl(*m_ffss, Ndec);
28 }
29 
31 {
32  delete m_pc;
33  delete m_ffss;
34 }
35 
36 void LogPrintCtrl::pr_de_c10(const double din, int p, const int wMin,
37  const int wMax)
38 {
39  m_pc->pr_de_c10(din, p, wMin, wMax);
40  writelog(m_os.str());
41  m_os.str("");
42 }
43 
44 void LogPrintCtrl::pr_de(const double d, int sigDigIn, const int wMinIn,
45  const int wMaxIn)
46 {
47  m_pc->pr_de(d, sigDigIn, wMinIn, wMaxIn);
48  writelog(m_os.str());
49  m_os.str("");
50 }
51 
52 double LogPrintCtrl::cropAbs10(const double d, int Ndec) const
53 {
54  return m_pc->cropAbs10(d, Ndec);
55 }
56 
57 double LogPrintCtrl::cropSigDigits(const double d, int nSig) const
58 {
59  return m_pc->cropSigDigits(d, nSig);
60 }
61 
62 int LogPrintCtrl::setNdec(int Ndec)
63 {
64  return m_pc->setNdec(Ndec);
65 }
66 
67 int LogPrintCtrl::setSigDigits(int nSigDigits)
68 {
69  return m_pc->setSigDigits(nSigDigits);
70 }
71 
72 int LogPrintCtrl::setWmin(int wmin)
73 {
74  return m_pc->setWmin(wmin);
75 }
76 
77 int LogPrintCtrl::setWmax(int wmax)
78 {
79  return m_pc->setWmax(wmax);
80 }
81 
82 }
void pr_de(const double d, int sigDigits=-1, const int wMin=-1, const int wMax=-1)
Print a double using scientific notation.
int setWmin(int wMin)
Set the default minimum width.
double cropAbs10(const double d, const int nDecades) const
Crop a double at a certain decade level.
Definition: PrintCtrl.cpp:111
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.
Definition: PrintCtrl.cpp:37
int setWmin(int wMin)
Set the default minimum width.
Definition: PrintCtrl.cpp:184
double cropSigDigits(const double d, int sigDigits) const
Crop a double at a certain number of significant digits.
Definition: PrintCtrl.cpp:133
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:76
PrintCtrl * m_pc
Pointer to the PrintCtrl class.
Definition: LogPrintCtrl.h:161
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).
void pr_de(const double d, int sigDigits=-1, const int wMin=-1, const int wMax=-1)
Print a double using scientific notation.
Definition: PrintCtrl.cpp:44
int setSigDigits(int sigDigits)
Set the default significant digits to output.
Definition: PrintCtrl.cpp:174
int setSigDigits(int sigDigits)
Set the default significant digits to output.
~LogPrintCtrl()
Destructor.
int setWmax(int wMax)
Set the default maximum width.
Definition: PrintCtrl.cpp:191
int setNdec(int nDecades)
Set the default value of N decade.
Definition: PrintCtrl.cpp:167
double cropAbs10(const double d, const int nDecades) const
Crop a double at a certain decade level.
double cropSigDigits(const double d, int sigDigits) const
Crop a double at a certain number of significant digits.
This class provides some printing and cropping utilities.
Definition: PrintCtrl.h:50
Declarations for a simple class that augments the logfile printing capabilities (see Cantera::LogPrin...
void writelog(const std::string &msg)
Write a message to the screen.
Definition: global.cpp:43
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.
int setNdec(int nDecades)
Set the default value of N decade.
std::ostream * m_ffss
Pointer to the ostream where this class actually prints its information.
Definition: LogPrintCtrl.h:158
std::ostringstream m_os
local stringstream class for temp output
Definition: LogPrintCtrl.h:154
int setWmax(int wMax)
Set the default maximum width.