Added an endl printing capability to writelog(). Some systems differentiate
between endl and \n when it comes to flushing the output. Added C++ printing utilities
This commit is contained in:
parent
cd3e8d8741
commit
e463b77fa2
15 changed files with 913 additions and 44 deletions
158
Cantera/src/base/LogPrintCtrl.cpp
Normal file
158
Cantera/src/base/LogPrintCtrl.cpp
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
/**
|
||||
* @file LogPrintCtrl.cpp
|
||||
* Declarations for a simple class that augments the logfile printing capabilities
|
||||
* (see \ref Cantera::LogPrintCtrl).
|
||||
*/
|
||||
/*
|
||||
* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*/
|
||||
/*
|
||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
||||
* retains certain rights in this software.
|
||||
* See file License.txt for licensing information.
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "LogPrintCtrl.h"
|
||||
#include "global.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
LogPrintCtrl::LogPrintCtrl(int Ndec) :
|
||||
m_ffss(0),
|
||||
m_pc(0)
|
||||
{
|
||||
m_ffss = new std::ostream(m_os.rdbuf());
|
||||
m_pc = new PrintCtrl(*m_ffss, Ndec);
|
||||
}
|
||||
|
||||
LogPrintCtrl::~LogPrintCtrl() {
|
||||
delete m_pc;
|
||||
delete m_ffss;
|
||||
}
|
||||
|
||||
// Print a double using scientific notation
|
||||
/*
|
||||
* Prints a double using scientific notation in a
|
||||
* fixed number of spaces
|
||||
*
|
||||
*
|
||||
* @param d double to be printed
|
||||
* @param w Number of spaces to use
|
||||
* @param p Precision
|
||||
*
|
||||
*
|
||||
*/
|
||||
void LogPrintCtrl::pr_de_c10(const double din, int p, const int wMin,
|
||||
const int wMax) {
|
||||
m_pc->pr_de_c10(din, p, wMin, wMax);
|
||||
writelog(m_os.str());
|
||||
m_os.str("");
|
||||
}
|
||||
|
||||
// Print a double using scientific notation
|
||||
/*
|
||||
* Prints a double using scientific notation in a
|
||||
* fixed number of spaces. Rounding of the last digit is carried out
|
||||
* by the standard c++ printing utilities.
|
||||
*
|
||||
* @param d double to be printed
|
||||
* @param w Number of spaces to use
|
||||
* @param p Precision
|
||||
*/
|
||||
void LogPrintCtrl::pr_de(const double d, int sigDigIn, const int wMinIn,
|
||||
const int wMaxIn) {
|
||||
m_pc->pr_de(d, sigDigIn, wMinIn, wMaxIn);
|
||||
writelog(m_os.str());
|
||||
m_os.str("");
|
||||
}
|
||||
|
||||
// Croup 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 currently does not do rounding of the last digit.
|
||||
*
|
||||
* @param d Double to be cropped
|
||||
* @param nSig Number of significant digits
|
||||
* example:
|
||||
* d = 1.1305E-15;
|
||||
* Ndec = -16;
|
||||
* This routine will return 1.1E-15
|
||||
*
|
||||
* d = 8.0E-17
|
||||
* Ndec = -16
|
||||
* This routine will return 0.0
|
||||
*/
|
||||
double LogPrintCtrl::cropAbs10(const double d, int Ndec) const {
|
||||
return m_pc->cropAbs10(d, Ndec);
|
||||
}
|
||||
|
||||
// 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 currently does
|
||||
* rounding up of the last digit.
|
||||
*
|
||||
* example:
|
||||
* d = 1.0305E-15;
|
||||
* nsig = 3;
|
||||
* This routine will return 1.03E-15
|
||||
*/
|
||||
double LogPrintCtrl::cropSigDigits(const double d, int nSig) const {
|
||||
return m_pc->cropSigDigits(d, nSig);
|
||||
}
|
||||
|
||||
// Set the default value of N decade
|
||||
/*
|
||||
* @param Ndec new value of Ndec
|
||||
*
|
||||
* @return returns the old value of Ndec
|
||||
*/
|
||||
int LogPrintCtrl::setNdec(int Ndec) {
|
||||
return m_pc->setNdec(Ndec);
|
||||
}
|
||||
|
||||
// Set the default significant digits to output
|
||||
/*
|
||||
* @param nSigDigits new value of the sig digits
|
||||
*
|
||||
* @return returns the old value of Ndec
|
||||
*/
|
||||
int LogPrintCtrl::setSigDigits(int nSigDigits) {
|
||||
return m_pc->setSigDigits(nSigDigits);
|
||||
}
|
||||
|
||||
// Set the default minimum width
|
||||
/*
|
||||
* @param wmin Default minimum width
|
||||
*
|
||||
* @return returns the old default
|
||||
*/
|
||||
int LogPrintCtrl::setWmin(int wmin) {
|
||||
return m_pc->setWmin(wmin);
|
||||
}
|
||||
|
||||
|
||||
// Set the default maximum width
|
||||
/*
|
||||
* @param wmin Default maximum width
|
||||
*
|
||||
* @return returns the old default
|
||||
*/
|
||||
int LogPrintCtrl::setWmax(int wmax) {
|
||||
return m_pc->setWmax(wmax);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
178
Cantera/src/base/LogPrintCtrl.h
Normal file
178
Cantera/src/base/LogPrintCtrl.h
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
/**
|
||||
* @file LogPrintCtrl.h
|
||||
* Declarations for a simple class that augments the logfile printing capabilities
|
||||
* (see \ref Cantera::LogPrintCtrl).
|
||||
*/
|
||||
/*
|
||||
* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*/
|
||||
/*
|
||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
||||
* retains certain rights in this software.
|
||||
* See file License.txt for licensing information.
|
||||
*/
|
||||
|
||||
#ifndef CT_LOGPRINTCTRL_H
|
||||
#define CT_LOGPRINTCTRL_H
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "PrintCtrl.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
//! 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.
|
||||
*
|
||||
* @ingroup globalUtilFuncs
|
||||
*
|
||||
*/
|
||||
class LogPrintCtrl {
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
* This also serves to initialize the ticks within the object
|
||||
*
|
||||
* @param coutProxy This is a reference to the ostream
|
||||
* to use for all IO from ths object.
|
||||
* @param Ndec value of Ndec. Defaults to -1000, i.e.,
|
||||
* no decade cropping
|
||||
*/
|
||||
LogPrintCtrl(int Ndec = -1000);
|
||||
|
||||
//! Destructor
|
||||
~LogPrintCtrl();
|
||||
|
||||
//! 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.
|
||||
*
|
||||
* @param d double to be printed
|
||||
* @param sigDigits Number of significant digits
|
||||
* (-1 = default, means to use the default
|
||||
* number for the object, which is initially
|
||||
* set to 13.
|
||||
* @param wMin Minimum number of spaces to print out
|
||||
* @param wMax Maximum number of spaces to print out
|
||||
*/
|
||||
void pr_de(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.
|
||||
*
|
||||
* @param d double to be printed
|
||||
* @param sigDigits Number of significant digits
|
||||
* (-1 = default, means to use the default
|
||||
* number for the object, which is initially
|
||||
* set to 13.
|
||||
* @param wMin Minimum number of spaces to print out
|
||||
* @param wMax Maximum number of spaces to print out
|
||||
*/
|
||||
void pr_de_c10(const double d, int sigDigits = -1,
|
||||
const int wMin = -1, const int wMax = -1);
|
||||
|
||||
//! 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.
|
||||
*
|
||||
* @param d Double to be cropped
|
||||
* @param sigDigits Number of significant digits
|
||||
* example:
|
||||
* d = 1.0305E-15;
|
||||
* nsig = 3;
|
||||
* This routine will return 1.03E-15
|
||||
*/
|
||||
double cropSigDigits(const double d, int sigDigits) 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.
|
||||
*
|
||||
* @param d Double to be cropped
|
||||
* @param 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
|
||||
*/
|
||||
double cropAbs10(const double d, const int nDecades) const;
|
||||
|
||||
//! Set the default value of N decade
|
||||
/*!
|
||||
* @param nDecades new value of Ndec
|
||||
*
|
||||
* @return returns the old value of Ndec
|
||||
*/
|
||||
int setNdec(int nDecades);
|
||||
|
||||
|
||||
//! Set the default significant digits to output
|
||||
/*!
|
||||
* @param sigDigits new value of the sig digits
|
||||
*
|
||||
* @return returns the old value of Ndec
|
||||
*/
|
||||
int setSigDigits(int sigDigits);
|
||||
|
||||
//! Set the default minimum width
|
||||
/*!
|
||||
* @param wMin Default minimum width
|
||||
*
|
||||
* @return returns the old default
|
||||
*/
|
||||
int setWmin(int wMin);
|
||||
|
||||
//! Set the default maximum width
|
||||
/*!
|
||||
* @param wMax Default maximum width
|
||||
*
|
||||
* @return returns the old default
|
||||
*/
|
||||
int setWmax(int wMax);
|
||||
|
||||
|
||||
private:
|
||||
std::ostringstream m_os;
|
||||
std::ostream *m_ffss;
|
||||
PrintCtrl *m_pc;
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -26,11 +26,13 @@ PIC_FLAG=@PIC@
|
|||
|
||||
CXX_FLAGS = @CXXFLAGS@ $(LOCAL_DEFS) $(CXX_OPT) $(PIC_FLAG) $(DEBUG_FLAG)
|
||||
|
||||
BASE_OBJ = ct2ctml.o ctml.o misc.o plots.o stringUtils.o xml.o clockWC.o
|
||||
BASE_OBJ = ct2ctml.o ctml.o misc.o plots.o stringUtils.o xml.o clockWC.o\
|
||||
PrintCtrl.o LogPrintCtrl.o
|
||||
|
||||
BASE_H = ct_defs.h ctexceptions.h logger.h XML_Writer.h \
|
||||
ctml.h plots.h stringUtils.h xml.h config.h utilities.h \
|
||||
Array.h vec_functions.h global.h FactoryBase.h clockWC.h
|
||||
Array.h vec_functions.h global.h FactoryBase.h clockWC.h \
|
||||
PrintCtrl.h LogPrintCtrl.h
|
||||
|
||||
CXX_INCLUDES = -I. @CXX_INCLUDES@
|
||||
LIB = @buildlib@/libctbase.a
|
||||
|
|
|
|||
248
Cantera/src/base/PrintCtrl.cpp
Normal file
248
Cantera/src/base/PrintCtrl.cpp
Normal file
|
|
@ -0,0 +1,248 @@
|
|||
/**
|
||||
* @file PrintCtrl.cpp
|
||||
* Definitions for a simple class that augments the streams printing capabilities
|
||||
* (see \ref Cantera::PrintCtrl).
|
||||
*/
|
||||
/*
|
||||
* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*/
|
||||
/*
|
||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
||||
* retains certain rights in this software.
|
||||
* See file License.txt for licensing information.
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "PrintCtrl.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
PrintCtrl::PrintCtrl(std::ostream &coutProxy, int Ndec) :
|
||||
m_cout(coutProxy),
|
||||
m_Ndec(Ndec),
|
||||
m_precision(12),
|
||||
m_wMin(9),
|
||||
m_wMax(19)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Print a double using scientific notation
|
||||
/*
|
||||
* Prints a double using scientific notation in a
|
||||
* fixed number of spaces
|
||||
*
|
||||
*
|
||||
* @param d double to be printed
|
||||
* @param w Number of spaces to use
|
||||
* @param p Precision
|
||||
*
|
||||
*
|
||||
*/
|
||||
void PrintCtrl::pr_de_c10(const double din, int p, const int wMin,
|
||||
const int wMax) {
|
||||
double d = cropAbs10(din, m_Ndec);
|
||||
pr_de(d, p, wMin, wMax);
|
||||
}
|
||||
|
||||
// Print a double using scientific notation
|
||||
/*
|
||||
* Prints a double using scientific notation in a
|
||||
* fixed number of spaces. Rounding of the last digit is carried out
|
||||
* by the standard c++ printing utilities.
|
||||
*
|
||||
* @param d double to be printed
|
||||
* @param w Number of spaces to use
|
||||
* @param p Precision
|
||||
*/
|
||||
void PrintCtrl::pr_de(const double d, int sigDigIn, const int wMinIn,
|
||||
const int wMaxIn) {
|
||||
int p = m_precision;
|
||||
if (sigDigIn != -1) {
|
||||
p = sigDigIn-1;
|
||||
if (p < 0) p = 0;
|
||||
}
|
||||
|
||||
int wMin = m_wMin;
|
||||
if (wMinIn != -1) {
|
||||
wMin = wMinIn;
|
||||
if (wMin < 1) wMin = 1;
|
||||
}
|
||||
|
||||
int wMax = m_wMax;
|
||||
if (wMaxIn != -1) {
|
||||
wMax = wMaxIn;
|
||||
if (wMax < 1) wMax = 1;
|
||||
}
|
||||
|
||||
if (wMin > wMax) wMax = wMin;
|
||||
|
||||
// Have to do the wMax ourselves, since C++ doesn't seem to
|
||||
// have a streams manipulator to do this !?!
|
||||
double dfabs = fabs(d);
|
||||
// This is the normal length assuming no sign and an 1.0E+04
|
||||
// formated exponented
|
||||
int requestedLength = 6 + p;
|
||||
if (d < 0.0) {
|
||||
requestedLength++;
|
||||
}
|
||||
if (dfabs < 9.9999999999E-99) {
|
||||
requestedLength++;
|
||||
}
|
||||
if (dfabs > 9.9999999999E99) {
|
||||
requestedLength++;
|
||||
}
|
||||
if (requestedLength > wMax) {
|
||||
p -= (requestedLength - wMax);
|
||||
if (p < 0) p = 0;
|
||||
}
|
||||
|
||||
// Set to upper case and scientific notation
|
||||
m_cout.setf(ios_base::scientific | ios_base::uppercase);
|
||||
int wold = m_cout.width(wMin);
|
||||
int pold = m_cout.precision(p);
|
||||
|
||||
m_cout << d;
|
||||
// Return the precision to the previous value;
|
||||
m_cout.precision(pold);
|
||||
m_cout.unsetf(ios_base::scientific);
|
||||
|
||||
// Return width to original
|
||||
m_cout.width(wold);
|
||||
}
|
||||
|
||||
// Croup 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 currently does not do rounding of the last digit.
|
||||
*
|
||||
* @param d Double to be cropped
|
||||
* @param nSig Number of significant digits
|
||||
* example:
|
||||
* d = 1.1305E-15;
|
||||
* Ndec = -16;
|
||||
* This routine will return 1.1E-15
|
||||
*
|
||||
* d = 8.0E-17
|
||||
* Ndec = -16
|
||||
* This routine will return 0.0
|
||||
*/
|
||||
double PrintCtrl::cropAbs10(const double d, int Ndec) const {
|
||||
if (Ndec < -301 || Ndec > 301) {
|
||||
return d;
|
||||
}
|
||||
double sgn = 1.0;
|
||||
if (d < 0.0) sgn = -1.0;
|
||||
double dfabs = fabs(d);
|
||||
double pdec = pow(10.0, (double) Ndec);
|
||||
if (dfabs < pdec) {
|
||||
return 0.0;
|
||||
}
|
||||
double dl10 = log10(dfabs);
|
||||
int N10 = (int) dl10;
|
||||
if (dl10 > -0.0) {
|
||||
N10 += 1;
|
||||
}
|
||||
int nsig = N10 - Ndec;
|
||||
double retn = cropSigDigits(d, nsig);
|
||||
return retn;
|
||||
}
|
||||
|
||||
// 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 currently does
|
||||
* rounding up of the last digit.
|
||||
*
|
||||
* example:
|
||||
* d = 1.0305E-15;
|
||||
* nsig = 3;
|
||||
* This routine will return 1.03E-15
|
||||
*/
|
||||
double PrintCtrl::cropSigDigits(const double d, int nSig) const {
|
||||
if (nSig <=0) nSig = 1;
|
||||
if (nSig >=10) nSig = 10;
|
||||
double sgn = 1.0;
|
||||
if (d < 0.0) sgn = -1.0;
|
||||
double dfabs = fabs(d);
|
||||
double dl10 = log10(dfabs);
|
||||
int N10 = (int) dl10;
|
||||
if (dl10 > -0.0) {
|
||||
N10 += 1;
|
||||
}
|
||||
int E10 = -N10 + nSig ;
|
||||
double pfabs = dfabs * pow(10.0, (double) E10);
|
||||
pfabs *= (1.0 + 1.0E-14);
|
||||
long int nfabs = (long int) pfabs;
|
||||
double remainder = pfabs - nfabs;
|
||||
if (remainder > 0.5) {
|
||||
nfabs++;
|
||||
}
|
||||
double paltabs = (double) nfabs;
|
||||
double daltabs = paltabs * pow(10.0, (double) -E10);
|
||||
return (sgn * daltabs);
|
||||
}
|
||||
|
||||
// Set the default value of N decade
|
||||
/*
|
||||
* @param Ndec new value of Ndec
|
||||
*
|
||||
* @return returns the old value of Ndec
|
||||
*/
|
||||
int PrintCtrl::setNdec(int Ndec) {
|
||||
int nold = m_Ndec;
|
||||
m_Ndec = Ndec;
|
||||
return nold;
|
||||
}
|
||||
|
||||
// Set the default significant digits to output
|
||||
/*
|
||||
* @param nSigDigits new value of the sig digits
|
||||
*
|
||||
* @return returns the old value of Ndec
|
||||
*/
|
||||
int PrintCtrl::setSigDigits(int nSigDigits) {
|
||||
int nold = m_precision + 1;
|
||||
m_precision = nSigDigits - 1;
|
||||
if (m_precision < 0) m_precision = 0;
|
||||
return nold;
|
||||
}
|
||||
|
||||
// Set the default minimum width
|
||||
/*
|
||||
* @param wmin Default minimum width
|
||||
*
|
||||
* @return returns the old default
|
||||
*/
|
||||
int PrintCtrl::setWmin(int wmin) {
|
||||
int nold = m_wMin;
|
||||
m_wMin = wmin;
|
||||
return nold;
|
||||
}
|
||||
|
||||
|
||||
// Set the default maximum width
|
||||
/*
|
||||
* @param wmin Default maximum width
|
||||
*
|
||||
* @return returns the old default
|
||||
*/
|
||||
int PrintCtrl::setWmax(int wmax) {
|
||||
int nold = m_wMax;
|
||||
m_wMax = wmax;
|
||||
return nold;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
217
Cantera/src/base/PrintCtrl.h
Normal file
217
Cantera/src/base/PrintCtrl.h
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
/**
|
||||
* @file PrintCtrl.h
|
||||
* Declarations for a simple class that augments the streams printing capabilities
|
||||
* (see \ref Cantera::PrintCtrl).
|
||||
*/
|
||||
/*
|
||||
* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*/
|
||||
/*
|
||||
* Copywrite 2004 Sandia Corporation. Under the terms of Contract
|
||||
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
|
||||
* retains certain rights in this software.
|
||||
* See file License.txt for licensing information.
|
||||
*/
|
||||
|
||||
#ifndef CT_PRINTCTRL_H
|
||||
#define CT_PRINTCTRL_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
//! This class provides some printing and cropping utilities
|
||||
/*!
|
||||
* The class is used to provide some formatting options for
|
||||
* printing out real numbers to files and to standard output.
|
||||
* Specifically, it can make sure that a max and min field
|
||||
* width is honored when conducting IO of numbers and strings.
|
||||
* Basically, its the spot to house all wrappers around
|
||||
* commonly used printing facilities.
|
||||
*
|
||||
* It can also handle cropping of numbers below a certain
|
||||
* decade level. This is useful for IO for testing purposes.
|
||||
* For example, if you don't care about anything below
|
||||
* 1.0E-20, you can set up the IO so that it won't print out
|
||||
* any digits below 1.0E-20, even digits that are in numbers
|
||||
* greater than 1.0E-20. In other words the number
|
||||
*
|
||||
* 1.12345E-19
|
||||
*
|
||||
* whould be cropped to the value
|
||||
*
|
||||
* 1.1000E-19
|
||||
*
|
||||
* The class wraps aroud a single std::ostream class. It's
|
||||
* cropping functions are also available as a "double"
|
||||
* conversion utility.
|
||||
*
|
||||
*
|
||||
* @ingroup globalUtilFuncs
|
||||
*
|
||||
*/
|
||||
class PrintCtrl {
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
* This also serves to initialize the ticks within the object
|
||||
*
|
||||
* @param coutProxy This is a reference to the ostream
|
||||
* to use for all IO from ths object.
|
||||
* @param Ndec value of Ndec. Defaults to -1000, i.e.,
|
||||
* no decade cropping
|
||||
*/
|
||||
PrintCtrl(std::ostream &coutProxy = std::cout, int Ndec = -1000);
|
||||
|
||||
//! 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.
|
||||
*
|
||||
* @param d double to be printed
|
||||
* @param sigDigits Number of significant digits
|
||||
* (-1 = default, means to use the default
|
||||
* number for the object, which is initially
|
||||
* set to 13.
|
||||
* @param wMin Minimum number of spaces to print out
|
||||
* @param wMax Maximum number of spaces to print out
|
||||
*/
|
||||
void pr_de(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.
|
||||
*
|
||||
* @param d double to be printed
|
||||
* @param sigDigits Number of significant digits
|
||||
* (-1 = default, means to use the default
|
||||
* number for the object, which is initially
|
||||
* set to 13.
|
||||
* @param wMin Minimum number of spaces to print out
|
||||
* @param wMax Maximum number of spaces to print out
|
||||
*/
|
||||
void pr_de_c10(const double d, int sigDigits = -1,
|
||||
const int wMin = -1, const int wMax = -1);
|
||||
|
||||
//! 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.
|
||||
*
|
||||
* @param d Double to be cropped
|
||||
* @param sigDigits Number of significant digits
|
||||
* example:
|
||||
* d = 1.0305E-15;
|
||||
* nsig = 3;
|
||||
* This routine will return 1.03E-15
|
||||
*/
|
||||
double cropSigDigits(const double d, int sigDigits) 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.
|
||||
*
|
||||
* @param d Double to be cropped
|
||||
* @param 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
|
||||
*/
|
||||
double cropAbs10(const double d, const int nDecades) const;
|
||||
|
||||
//! Set the default value of N decade
|
||||
/*!
|
||||
* @param nDecades new value of Ndec
|
||||
*
|
||||
* @return returns the old value of Ndec
|
||||
*/
|
||||
int setNdec(int nDecades);
|
||||
|
||||
|
||||
//! Set the default significant digits to output
|
||||
/*!
|
||||
* @param sigDigits new value of the sig digits
|
||||
*
|
||||
* @return returns the old value of Ndec
|
||||
*/
|
||||
int setSigDigits(int sigDigits);
|
||||
|
||||
//! Set the default minimum width
|
||||
/*!
|
||||
* @param wMin Default minimum width
|
||||
*
|
||||
* @return returns the old default
|
||||
*/
|
||||
int setWmin(int wMin);
|
||||
|
||||
//! Set the default maximum width
|
||||
/*!
|
||||
* @param wMax Default maximum width
|
||||
*
|
||||
* @return returns the old default
|
||||
*/
|
||||
int setWmax(int wMax);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//! This is the ostream to send all output from the object
|
||||
/*!
|
||||
* It defaults to cout
|
||||
*/
|
||||
std::ostream &m_cout;
|
||||
|
||||
//! Default decade level to use for decade cropping
|
||||
/*!
|
||||
* This is initially set to -1000, which means that
|
||||
* no cropping will be carried out
|
||||
*/
|
||||
int m_Ndec;
|
||||
|
||||
//! default precision level to use in printing
|
||||
/*!
|
||||
* This actually is one less than the number of significant digits.
|
||||
*
|
||||
* Initially set to 12
|
||||
*/
|
||||
int m_precision;
|
||||
|
||||
//! default minimimum field width
|
||||
/*!
|
||||
* Initially, this is set to 9
|
||||
*/
|
||||
int m_wMin;
|
||||
|
||||
//! Default maximum field width
|
||||
/*!
|
||||
* Initially this is set to 19
|
||||
*/
|
||||
int m_wMax;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -300,6 +300,13 @@ namespace Cantera {
|
|||
*/
|
||||
void writelogf(const char* fmt,...);
|
||||
|
||||
//! Write an end of line character to the screen and flush output
|
||||
/*!
|
||||
* Some implementations differentiate between \n and endl in
|
||||
* terms of when the output is flushed.
|
||||
*/
|
||||
void writelogendl();
|
||||
|
||||
//! Write an error message and terminate execution.
|
||||
/*!
|
||||
* @param msg Error message to be written to the screen.
|
||||
|
|
|
|||
|
|
@ -59,6 +59,15 @@ namespace Cantera {
|
|||
std::cout << msg;
|
||||
}
|
||||
|
||||
//! Write an end of line character and flush output.
|
||||
/*!
|
||||
* Some systems treat endl and \n differently. The endl
|
||||
* statement causes a flushing of stdout to the screen.
|
||||
*/
|
||||
virtual void writeendl() {
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
//! Write an error message and quit.
|
||||
/*!
|
||||
* The default behavior is
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ namespace Cantera {
|
|||
*
|
||||
* @ingroup errorhandling
|
||||
*/
|
||||
void logErrors() ;
|
||||
void logErrors();
|
||||
|
||||
//! Write a message to the screen.
|
||||
/*!
|
||||
|
|
@ -268,7 +268,10 @@ namespace Cantera {
|
|||
* @param msg c++ string to be written to the screen
|
||||
* @ingroup textlogs
|
||||
*/
|
||||
void writelog(const std::string& msg) ;
|
||||
void writelog(const std::string& msg);
|
||||
|
||||
//! Write an end of line and flush output
|
||||
void writelogendl();
|
||||
|
||||
//! Write a message to the screen.
|
||||
/*!
|
||||
|
|
@ -697,6 +700,13 @@ namespace Cantera {
|
|||
*/
|
||||
void writelog(const std::string& msg) { pMessenger->writelog(msg); }
|
||||
|
||||
|
||||
//! Write an endl to the screen and flush output
|
||||
/*!
|
||||
* @ingroup textlogs
|
||||
*/
|
||||
void writelogendl() { pMessenger->writelogendl(); }
|
||||
|
||||
//! Write a message to the screen.
|
||||
/*!
|
||||
* The string may be of any
|
||||
|
|
@ -1513,7 +1523,12 @@ protected:
|
|||
void Application::Messages::writelog(const char* pszmsg) {
|
||||
logwriter->write( pszmsg ) ;
|
||||
}
|
||||
|
||||
|
||||
// Write an endl to the screen and flush output
|
||||
void Application::Messages::writelogendl() {
|
||||
logwriter->writeendl();
|
||||
}
|
||||
|
||||
// Write a message to the screen using printf format
|
||||
void writelogf(const char* fmt,...) {
|
||||
enum { BUFSIZE = 2048 } ;
|
||||
|
|
@ -1534,6 +1549,10 @@ protected:
|
|||
va_end(args) ;
|
||||
}
|
||||
|
||||
void writelogendl() {
|
||||
app()->writelogendl();
|
||||
}
|
||||
|
||||
// Write an error message and terminate execution. test.
|
||||
// @ingroup textlogs
|
||||
void error(const std::string& msg) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ namespace VCSnonideal {
|
|||
* We can replace this with printf easily
|
||||
*/
|
||||
#define plogf Cantera::writelogf
|
||||
#define plogendl() Cantera::writelogendl()
|
||||
|
||||
//! Global hook for turning on and off time printing.
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -302,15 +302,16 @@ namespace VCSnonideal {
|
|||
} else {
|
||||
plogf(" Unknown");
|
||||
}
|
||||
plogf(" \n");
|
||||
plogendl();
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < m_numSpeciesTot; ++i) {
|
||||
if (soln[i] < 0.0) {
|
||||
plogf("On Input species %-12s has a "
|
||||
"negative MF, setting it small\n",
|
||||
SpName[i].c_str());
|
||||
"negative MF, setting it small",
|
||||
SpName[i].c_str());
|
||||
plogendl();
|
||||
soln[i] = VCS_DELETE_SPECIES_CUTOFF;
|
||||
}
|
||||
}
|
||||
|
|
@ -366,7 +367,8 @@ namespace VCSnonideal {
|
|||
#ifdef DEBUG_MODE
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- Minor species changed to major: ");
|
||||
plogf("%-12s\n", SpName[kspec].c_str());
|
||||
plogf("%-12s", SpName[kspec].c_str());
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -379,7 +381,8 @@ namespace VCSnonideal {
|
|||
if (! vcs_elabcheck(0)) {
|
||||
#ifdef DEBUG_MODE
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- Element Abundance check failed\n");
|
||||
plogf(" --- Element Abundance check failed");
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
vcs_elcorr(VCS_DATA_PTR(sm), VCS_DATA_PTR(wx));
|
||||
|
|
@ -388,7 +391,8 @@ namespace VCSnonideal {
|
|||
#ifdef DEBUG_MODE
|
||||
else {
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- Element Abundance check passed\n");
|
||||
plogf(" --- Element Abundance check passed");
|
||||
plogendl();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -652,9 +656,10 @@ namespace VCSnonideal {
|
|||
sprintf(ANOTE,"minor species not considered");
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- "); plogf("%-12s", SpName[kspec].c_str());
|
||||
plogf("%3d%11.4E%11.4E%11.4E | %s\n",
|
||||
plogf("%3d%11.4E%11.4E%11.4E | %s",
|
||||
spStatus[irxn], soln[kspec], wt[kspec],
|
||||
ds[kspec], ANOTE);
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
|
|
@ -686,8 +691,9 @@ namespace VCSnonideal {
|
|||
/*******************************************************************/
|
||||
#ifdef DEBUG_MODE
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- Delete minor species in multispec phase: %-12s\n",
|
||||
plogf(" --- Delete minor species in multispec phase: %-12s",
|
||||
SpName[kspec].c_str());
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
ds[kspec] = 0.0;
|
||||
|
|
@ -734,9 +740,10 @@ namespace VCSnonideal {
|
|||
sprintf(ANOTE, "major species is converged");
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- "); plogf("%-12s", SpName[kspec].c_str());
|
||||
plogf("%3d%11.4E%11.4E%11.4E | %s\n",
|
||||
plogf("%3d%11.4E%11.4E%11.4E | %s",
|
||||
spStatus[irxn], soln[kspec], wt[kspec],
|
||||
ds[kspec], ANOTE);
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
|
|
@ -810,7 +817,8 @@ namespace VCSnonideal {
|
|||
#ifdef DEBUG_MODE
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- Major species changed to minor: ");
|
||||
plogf("%-12s\n", SpName[kspec].c_str());
|
||||
plogf("%-12s", SpName[kspec].c_str());
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
spStatus[irxn] = VCS_SPECIES_MINOR;
|
||||
|
|
@ -904,7 +912,8 @@ namespace VCSnonideal {
|
|||
if (vcs_debug_print_lvl >= 2) {
|
||||
if (spStatus[irxn] >= 0) {
|
||||
plogf(" --- SS species changed to zeroedss: ");
|
||||
plogf("%-12s\n", SpName[kspec].c_str());
|
||||
plogf("%-12s", SpName[kspec].c_str());
|
||||
plogendl();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -950,7 +959,8 @@ namespace VCSnonideal {
|
|||
#ifdef DEBUG_MODE
|
||||
if (fabs(ds[kspec] -dx) > 1.0E-14*(fabs(ds[kspec]) + fabs(dx) + 1.0E-32)) {
|
||||
plogf(" ds[kspec] = %20.16g dx = %20.16g , kspec = %d\n", ds[kspec], dx, kspec);
|
||||
plogf("we have a problem!\n");
|
||||
plogf("we have a problem!");
|
||||
plogendl();
|
||||
exit(-1);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -980,9 +990,10 @@ namespace VCSnonideal {
|
|||
if (vcs_debug_print_lvl >= 2) {
|
||||
wt[kspec] = soln[kspec] + ds[kspec];
|
||||
plogf(" --- "); plogf("%-12.12s", SpName[kspec].c_str());
|
||||
plogf("%3d%11.4E%11.4E%11.4E | %s\n",
|
||||
plogf("%3d%11.4E%11.4E%11.4E | %s",
|
||||
spStatus[irxn], soln[kspec], wt[kspec],
|
||||
ds[kspec], ANOTE);
|
||||
plogendl();
|
||||
}
|
||||
L_MAIN_LOOP_END_NO_PRINT: ;
|
||||
#endif
|
||||
|
|
@ -992,11 +1003,13 @@ namespace VCSnonideal {
|
|||
if (vcs_debug_print_lvl >= 2) {
|
||||
for (k = 0; k < m_numComponents; k++) {
|
||||
plogf(" --- "); plogf("%-12.12s", SpName[k].c_str());
|
||||
plogf(" c%11.4E%11.4E%11.4E |\n",
|
||||
plogf(" c%11.4E%11.4E%11.4E |",
|
||||
soln[k], soln[k]+ds[k], ds[k]);
|
||||
}
|
||||
plogendl();
|
||||
plogf(" "); vcs_print_line("-", 80);
|
||||
plogf(" --- Finished Main Loop\n");
|
||||
plogf(" --- Finished Main Loop");
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
/*************************************************************************/
|
||||
|
|
@ -1036,7 +1049,8 @@ namespace VCSnonideal {
|
|||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- Reduction in step size due to component ");
|
||||
plogf("%s", SpName[ll].c_str());
|
||||
plogf(" going negative = %11.3E\n", par);
|
||||
plogf(" going negative = %11.3E", par);
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < m_numSpeciesTot; ++i) {
|
||||
|
|
@ -1061,8 +1075,9 @@ namespace VCSnonideal {
|
|||
for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) {
|
||||
wt[kspec] = soln[kspec] + ds[kspec];
|
||||
if (wt[kspec] < 0.0 && (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE)) {
|
||||
plogf("vcs_solve_TP: ERROR on step change wt[%d:%s]: %g < 0.0\n",
|
||||
plogf("vcs_solve_TP: ERROR on step change wt[%d:%s]: %g < 0.0",
|
||||
kspec, SpName[kspec].c_str(), wt[kspec]);
|
||||
plogendl();
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
|
@ -1141,9 +1156,10 @@ namespace VCSnonideal {
|
|||
dgl[l1], dg[l1]);
|
||||
}
|
||||
plogf(" ---"); print_space(56);
|
||||
plogf("Norms of Delta G():%14.6E%14.6E\n",
|
||||
plogf("Norms of Delta G():%14.6E%14.6E",
|
||||
l2normdg(VCS_DATA_PTR(dgl)),
|
||||
l2normdg(VCS_DATA_PTR(dg)));
|
||||
plogendl();
|
||||
|
||||
plogf(" --- Phase_Name Moles(after update)\n");
|
||||
plogf(" --- "); vcs_print_line("-", 50);
|
||||
|
|
@ -1152,11 +1168,13 @@ namespace VCSnonideal {
|
|||
plogf(" --- %18s = %15.7E\n", Vphase->PhaseName.c_str(), TPhMoles1[iph]);
|
||||
}
|
||||
plogf(" "); vcs_print_line("-", 103);
|
||||
plogf(" --- Total Dimensionless Gibbs Free Energy = %15.7E\n",
|
||||
plogf(" --- Total Dimensionless Gibbs Free Energy = %15.7E",
|
||||
vcs_Total_Gibbs(VCS_DATA_PTR(wt), VCS_DATA_PTR(m_gibbsSpecies),
|
||||
VCS_DATA_PTR(TPhMoles1)));
|
||||
plogendl();
|
||||
if (m_VCount->Its > 150) {
|
||||
plogf(" --- Troublesome solve\n");
|
||||
plogf(" --- Troublesome solve");
|
||||
plogendl();
|
||||
}
|
||||
#ifdef DEBUG_MODE
|
||||
#ifdef DEBUG_NOT
|
||||
|
|
@ -1227,7 +1245,8 @@ namespace VCSnonideal {
|
|||
plogf(" Total Dimensionless Gibbs Free Energy = %15.7E\n",
|
||||
vcs_Total_Gibbs(VCS_DATA_PTR(soln), VCS_DATA_PTR(m_gibbsSpecies),
|
||||
VCS_DATA_PTR(TPhMoles)));
|
||||
plogf(" -----------------------------------------------------\n");
|
||||
plogf(" -----------------------------------------------------");
|
||||
plogendl();
|
||||
}
|
||||
/*************************************************************************/
|
||||
/******************* RESET VALUES AT END OF ITERATION ********************/
|
||||
|
|
@ -1300,7 +1319,8 @@ namespace VCSnonideal {
|
|||
if (soldel) {
|
||||
#ifdef DEBUG_MODE
|
||||
if (vcs_debug_print_lvl >= 1) {
|
||||
plogf(" --- Setting microscopic phase %d to zero\n", iph);
|
||||
plogf(" --- Setting microscopic phase %d to zero", iph);
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
justDeletedMultiPhase = TRUE;
|
||||
|
|
@ -1332,7 +1352,8 @@ namespace VCSnonideal {
|
|||
*/
|
||||
plogf(" DELETION OF MULTISPECIES PHASE. ");
|
||||
plogf("Convergence to number of positive n(i) less than C.\n");
|
||||
plogf("Check results to follow carefully. \n\n");
|
||||
plogf("Check results to follow carefully. \n");
|
||||
plogendl();
|
||||
goto L_RETURN_BLOCK;
|
||||
}
|
||||
}
|
||||
|
|
@ -1348,7 +1369,8 @@ namespace VCSnonideal {
|
|||
if (! vcs_elabcheck(0)) {
|
||||
#ifdef DEBUG_MODE
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" - failed -> redoing element abundances.\n");
|
||||
plogf(" - failed -> redoing element abundances.");
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
vcs_elcorr(VCS_DATA_PTR(sm), VCS_DATA_PTR(wx));
|
||||
|
|
@ -1359,7 +1381,8 @@ namespace VCSnonideal {
|
|||
#ifdef DEBUG_MODE
|
||||
else {
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" - passed\n");
|
||||
plogf(" - passed");
|
||||
plogendl();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1395,8 +1418,9 @@ namespace VCSnonideal {
|
|||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- Get a new basis because %s", SpName[l].c_str());
|
||||
plogf(" is larger than comp %s", SpName[j].c_str());
|
||||
plogf(" and share nonzero stoic: %-9.1f\n",
|
||||
plogf(" and share nonzero stoic: %-9.1f",
|
||||
sc[i][j]);
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
goto L_COMPONENT_CALC;
|
||||
|
|
@ -1413,8 +1437,9 @@ namespace VCSnonideal {
|
|||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- Get a new basis because %s", SpName[l].c_str());
|
||||
plogf(" has dg < 0.0 and comp %s has zero mole num", SpName[j].c_str());
|
||||
plogf(" and share nonzero stoic: %-9.1f\n",
|
||||
plogf(" and share nonzero stoic: %-9.1f",
|
||||
sc[i][j]);
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
goto L_COMPONENT_CALC;
|
||||
|
|
@ -1437,8 +1462,9 @@ namespace VCSnonideal {
|
|||
plogf("%s", SpName[l].c_str());
|
||||
plogf(" is larger than comp ");
|
||||
plogf("%s", SpName[j].c_str());
|
||||
plogf(" and share nonzero stoic: %-9.1f\n",
|
||||
plogf(" and share nonzero stoic: %-9.1f",
|
||||
sc[i][j]);
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
goto L_COMPONENT_CALC;
|
||||
|
|
@ -1453,8 +1479,9 @@ namespace VCSnonideal {
|
|||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- Get a new basis because %s", SpName[l].c_str());
|
||||
plogf(" has dg < 0.0 and comp %s has zero mole num", SpName[j].c_str());
|
||||
plogf(" and share nonzero stoic: %-9.1f\n",
|
||||
plogf(" and share nonzero stoic: %-9.1f",
|
||||
sc[i][j]);
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
goto L_COMPONENT_CALC;
|
||||
|
|
@ -1468,7 +1495,8 @@ namespace VCSnonideal {
|
|||
}
|
||||
#ifdef DEBUG_MODE
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" --- Check for an optimum basis passed\n");
|
||||
plogf(" --- Check for an optimum basis passed");
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
/*************************************************************************/
|
||||
|
|
@ -1588,7 +1616,8 @@ namespace VCSnonideal {
|
|||
}
|
||||
#ifdef DEBUG_MODE
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" MAJOR SPECIES CONVERGENCE achieved\n");
|
||||
plogf(" MAJOR SPECIES CONVERGENCE achieved");
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1596,7 +1625,8 @@ namespace VCSnonideal {
|
|||
else {
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
plogf(" MAJOR SPECIES CONVERGENCE achieved "
|
||||
"(because there are no major species)\n");
|
||||
"(because there are no major species)");
|
||||
plogendl();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1772,7 +1802,8 @@ namespace VCSnonideal {
|
|||
plogf(" --- vcs_solve_tp: RANGE SPACE ERROR ENCOUNTERED\n");
|
||||
plogf(" --- vcs_solve_tp: - Giving up on NE Element Abundance satisfaction \n");
|
||||
plogf(" --- vcs_solve_tp: - However, NC Element Abundance criteria is satisfied \n");
|
||||
plogf(" --- vcs_solve_tp: - Returning the calculated equilibrium condition \n");
|
||||
plogf(" --- vcs_solve_tp: - Returning the calculated equilibrium condition ");
|
||||
plogendl();
|
||||
}
|
||||
#endif
|
||||
rangeErrorFound = 1;
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ namespace VCSnonideal {
|
|||
if (string) {
|
||||
for (int j = 0; j < num; j++) plogf("%s", string);
|
||||
}
|
||||
plogf("\n");
|
||||
plogendl();
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "ct_defs.h"
|
||||
#include "DAE_Solver.h"
|
||||
|
||||
// DAE_DEVEL is turned off at the current time
|
||||
#ifdef DAE_DEVEL
|
||||
|
||||
#ifdef HAS_SUNDIALS
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ namespace Cantera {
|
|||
|
||||
|
||||
// pass a pointer to func in m_data
|
||||
m_fdata = new FuncData(&func, func.nparams());
|
||||
m_fdata = new ResidData(&func, func.nparams());
|
||||
|
||||
flag = IDASetRdata(m_ida_mem, (void*)m_fdata);
|
||||
if (flag != IDA_SUCCESS)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Cantera {
|
|||
*/
|
||||
class IDA_Err : public CanteraError {
|
||||
public:
|
||||
IDA_Err(std::string msg) : CanteraError("IDA_Solver", msg){}
|
||||
IDA_Err(std::string msg) : CanteraError("IDA_Solver", msg){}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -60,7 +60,6 @@ namespace Cantera {
|
|||
virtual void setBandedLinearSolver(int m_upper, int m_lower);
|
||||
|
||||
virtual void setMaxTime(doublereal tmax);
|
||||
virtual void setMaxStepSize(doublereal dtmax);
|
||||
|
||||
virtual void setMaxOrder(int n);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ namespace Cantera {
|
|||
class SolidTransport : public Transport {
|
||||
|
||||
public:
|
||||
|
||||
virtual ~SolidTransport() {}
|
||||
virtual ~SolidTransport() {}
|
||||
|
||||
virtual int model() { return cSolidTransport; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue