6#ifndef CT_BASE_APPLICATION_H
7#define CT_BASE_APPLICATION_H
9#include "cantera/base/config.h"
12#include <boost/algorithm/string/join.hpp>
65 void addError(
const string& r,
const string& msg=
"");
141 void warnlog(
const string& warning,
const string& msg);
209 void addError(
const string& r,
const string& msg=
"") {
280 return boost::algorithm::join(
inputDirs, sep);
291 void loadExtension(
const string& extType,
const string& name);
300 long int readStringRegistryKey(
const string& keyName,
const string& valueName,
301 string& value,
const string& defaultValue);
315 void warnlog(
const string& warning,
const string& msg) {
316 pMessenger->
warnlog(warning, msg);
328 m_suppress_deprecation_warnings =
true;
329 m_fatal_deprecation_warnings =
false;
335 m_fatal_deprecation_warnings =
true;
342 void warn(
const string& warning,
const string& method,
const string& extra=
"");
347 m_suppress_warnings =
true;
348 m_fatal_warnings =
false;
353 return m_suppress_warnings;
359 m_fatal_warnings =
true;
365 m_suppress_thermo_warnings = suppress;
370 return m_suppress_thermo_warnings;
384 m_use_legacy_rate_constants = legacy;
389 return m_use_legacy_rate_constants;
443 bool m_suppress_deprecation_warnings =
false;
444 bool m_fatal_deprecation_warnings =
false;
445 bool m_suppress_thermo_warnings =
false;
446 bool m_suppress_warnings =
false;
447 bool m_fatal_warnings =
false;
448 bool m_use_legacy_rate_constants =
false;
450 set<pair<string, string>> m_loaded_extensions;
Class to carry out messages.
unique_ptr< Logger > logwriter
Current pointer to the logwriter.
vector< string > errorMessage
Current list of error messages.
void writelogendl()
Write an end of line character to the screen and flush output.
Class that stores thread messages for each thread, and retrieves them based on the thread id.
ThreadMessages()
Constructor.
Messages * operator->()
Provide a pointer dereferencing overloaded operator.
threadMsgMap_t m_threadMsgMap
Thread Msg Map.
map< std::thread::id, pMessages_t > threadMsgMap_t
Typedef for map between a thread and the message.
void removeThreadMessages()
Remove a local thread message.
Class to hold global data.
bool warnings_suppressed()
Returns true if warnings should be suppressed.
void use_legacy_rate_constants(bool legacy=true)
Set definition used for rate constant calculation.
static Application * s_app
Pointer to the single Application instance.
void suppress_deprecation_warnings()
Globally disable printing of deprecation warnings.
vector< string > m_pythonSearchVersions
Versions of Python to consider when attempting to load user extensions.
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
void warnlog(const string &warning, const string &msg)
Write a warning message to the screen.
void make_warnings_fatal()
Turns Cantera warnings into exceptions.
void setLogger(Logger *logwriter)
Install a logger.
void make_deprecation_warnings_fatal()
Turns deprecation warnings into exceptions.
static Application * Instance()
Return a pointer to the one and only instance of class Application.
void addError(const string &r, const string &msg="")
Set an error condition in the application class without throwing an exception.
void logErrors()
Prints all of the error messages using writelog.
void loadExtension(const string &extType, const string &name)
Load an extension implementing user-defined models.
void warn_deprecated(const string &method, const string &extra="")
Print a warning indicating that method is deprecated.
void searchPythonVersions(const string &versions)
Set the versions of Python to try when loading user-defined extensions, in order of preference.
bool legacy_rate_constants_used()
Returns true if legacy rate constant definition is used.
void suppress_warnings()
Globally disable printing of (user) warnings.
vector< string > inputDirs
Current vector of input directories to search for input files.
void thread_complete()
Delete and free memory allocated per thread in multithreaded applications.
void writelog(const string &msg)
Write a message to the screen.
set< string > warnings
Set of deprecation warnings that have been emitted (to suppress duplicates)
void suppress_thermo_warnings(bool suppress=true)
Globally disable printing of warnings about problematic thermo data, such as NASA polynomials with di...
shared_ptr< Messages > pMessages_t
Typedef for thread specific messages.
void getErrors(std::ostream &f)
Prints all of the error messages to an ostream.
string lastErrorMessage()
Retrieve the last error message in a string.
int getErrorCount()
Return the number of errors that have been encountered so far.
virtual ~Application()
Destructor for class deletes global data.
Application()
Constructor for class sets up the initial conditions Protected ctor access thru static member functio...
void writelogendl()
Write an endl to the screen and flush output.
static void ApplicationDestroy()
Static function that destroys the application class's data.
void warn(const string &warning, const string &method, const string &extra="")
Generate a general purpose warning; repeated warnings are not suppressed.
void popError()
Discard the last error message.
Base class for 'loggers' that write text messages to log files.
void addError(const string &r, const string &msg="")
Set an error condition in the application class without throwing an exception.
void logErrors()
Prints all of the error messages using writelog.
void getErrors(std::ostream &f)
Prints all of the error messages to an ostream.
string lastErrorMessage()
Retrieve the last error message in a string.
int getErrorCount()
Return the number of errors that have been encountered so far.
void popError()
Discard the last error message.
void warnlog(const string &warning, const string &msg)
Write a warning message to the screen.
void setLogger(Logger *logwriter)
Install a logger.
void writelog(const string &msg)
Write a message to the screen.
Header for Base class for 'loggers' that write text messages to log files (see Logging and class Logg...
Namespace for the Cantera kernel.