Cantera  2.4.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 153 of file global.h.

References Cantera::writelog_direct().

Referenced by Cantera::BasisOptimize(), Cantera::ck2cti(), MultiNewton::dampStep(), ChemEquil::dampStep(), Cantera::ElemRearrange(), ChemEquil::equilibrate(), ChemEquil::estimateElementPotentials(), FuncEval::eval_nothrow(), GasTransport::fitCollisionIntegrals(), IonGasTransport::fitDiffCoeffs(), GasTransport::fitDiffCoeffs(), GasTransport::fitProperties(), Cantera::getFloatArray(), Cantera::getInteger(), MMCollisionInt::init(), ChemEquil::initialize(), PDSS_HKFT::initThermo(), solveSP::print_header(), HMWSoln::printCoeffs(), solveSP::printIteration(), Sim1D::refine(), StFlow::restore(), Sim1D::restore(), Domain1D::restore(), ChemEquil::setInitialMoles(), Inlet1D::showSolution(), StFlow::showSolution(), Surf1D::showSolution(), ReactingSurf1D::showSolution(), Domain1D::showSolution(), MultiNewton::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 174 of file global.h.

References Cantera::writelog_direct().

Referenced by ChemEquil::dampStep(), ChemEquil::equilibrate(), ChemEquil::estimateElementPotentials(), IonGasTransport::fitDiffCoeffs(), GasTransport::fitDiffCoeffs(), GasTransport::fitProperties(), MMCollisionInt::init(), solveSP::print_header(), HMWSoln::printCoeffs(), solveSP::printIteration(), ChemEquil::setInitialMoles(), solveSP::solveSurfProb(), and ResidEval::writeSolution().