Cantera  2.3.0
Classes | Functions
Writing messages to the screen
Collaboration diagram for Writing messages to the screen:

Classes

class  Application
 Class to hold global data. More...
 
class  Logger
 Base class for 'loggers' that write text messages to log files. More...
 

Functions

void writelog (const std::string &msg)
 Write a message to the screen. More...
 
void setLogger (Logger *logwriter)
 Install a logger. More...
 
template<typename... Args>
void writelog (const std::string &fmt, const Args &... args)
 Write a formatted message to the screen. More...
 
template<typename... Args>
void writelogf (const char *fmt, const Args &... args)
 Write a formatted message to the screen. More...
 

Detailed Description

Function Documentation

◆ writelog() [1/2]

void writelog ( const std::string &  msg)

Write a message to the screen.

The string may be of any length, and may contain end-of-line characters. This method is used throughout Cantera to write log messages. It can also be called by user programs. The advantage of using writelog over writing directly to the standard output is that messages written with writelog will display correctly even when Cantera is used from MATLAB or other application that do not have a standard output stream.

Parameters
msgc++ string to be written to the screen

Definition at line 90 of file application.cpp.

Referenced by Application::writelog().

◆ setLogger()

void setLogger ( Logger logwriter)

Install a logger.

Called by the language interfaces to install an appropriate logger. The logger is used for the writelog() function

Parameters
logwriterPointer to a logger object
See also
Logger.

Definition at line 85 of file application.cpp.

Referenced by Application::setLogger().

◆ writelog() [2/2]

void Cantera::writelog ( const std::string &  fmt,
const Args &...  args 
)

Write a formatted message to the screen.

This function passes its arguments to the fmt library 'format' function to generate a formatted string from a Python-style (curly braces) format string. This method is used throughout Cantera to write log messages. It can also be called by user programs. The advantage of using writelog over writing directly to the standard output is that messages written with writelog will display correctly even when Cantera is used from MATLAB or other application that do not have a standard output stream.

Definition at line 179 of file global.h.

References Cantera::writelog_direct().

Referenced by Cantera::BasisOptimize(), InterfaceKinetics::checkPartialEquil(), Cantera::ck2cti(), MultiNewton::dampStep(), ChemEquil::dampStep(), Cantera::ElemRearrange(), ChemEquil::equilibrate(), FuncEval::eval_nothrow(), GasTransport::fitCollisionIntegrals(), Cantera::getFloatArray(), Cantera::getInteger(), MMCollisionInt::init(), ChemEquil::initialize(), PDSS_HKFT::initThermo(), solveSP::print_header(), HMWSoln::printCoeffs(), solveSP::printIteration(), StFlow::restore(), Sim1D::restore(), Domain1D::restore(), HMWSoln::s_updatePitzer_d2lnMolalityActCoeff_dT2(), HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP(), HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dT(), HMWSoln::s_updatePitzer_lnMolalityActCoeff(), ChemEquil::setInitialMoles(), Inlet1D::showSolution(), StFlow::showSolution(), Surf1D::showSolution(), ReactingSurf1D::showSolution(), Domain1D::showSolution(), MultiNewton::solve(), RootFind::solve(), solveSP::solveSurfProb(), OneDim::timeStep(), VCS_SOLVE::vcs_basopt(), ResidEval::writeSolution(), and OneDim::writeStats().

◆ writelogf()

void Cantera::writelogf ( const char *  fmt,
const Args &...  args 
)

Write a formatted message to the screen.

Using the printf formatting of C, write a message to the screen with variable values.

Here, we format an internal string with the correct values and then feed it into writelog().

Parameters
fmtc format string for the following arguments
argsarguments used to interpolate the format string

Definition at line 200 of file global.h.

References Cantera::writelog_direct().

Referenced by HMWSoln::calc_lambdas(), InterfaceKinetics::checkPartialEquil(), ChemEquil::dampStep(), ChemEquil::equilibrate(), SquareMatrix::factor(), SquareMatrix::factorQR(), MMCollisionInt::init(), solveSP::print_header(), HMWSoln::printCoeffs(), solveSP::printIteration(), RootFind::printTable(), SquareMatrix::rcond(), HMWSoln::s_updatePitzer_d2lnMolalityActCoeff_dT2(), HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP(), HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dT(), HMWSoln::s_updatePitzer_lnMolalityActCoeff(), ChemEquil::setInitialMoles(), RootFind::solve(), solveSP::solveSurfProb(), and ResidEval::writeSolution().