158inline void debuglog(
const string& msg,
int loglevel)
174template <
typename... Args>
175void writelog(
const string& fmt,
const Args&... args) {
176 if (
sizeof...(args) == 0) {
194template <
typename... Args>
202void writeline(
char repeat,
size_t count,
203 bool endl_after=
true,
bool endl_before=
false);
215void _warn_deprecated(
const string& method,
const string& extra=
"");
226template <
typename... Args>
228 if (
sizeof...(args) == 0) {
229 _warn_deprecated(method, msg);
231 _warn_deprecated(method, fmt::format(fmt::runtime(msg), args...));
238void _warn(
const string& warning,
const string& method,
const string& extra);
250template <
typename... Args>
251void warn(
const string& warning,
const string& method,
252 const string& msg,
const Args&... args) {
253 if (
sizeof...(args) == 0) {
254 _warn(warning, method, msg);
256 _warn(warning, method, fmt::format(fmt::runtime(msg), args...));
266template <
typename... Args>
267void warn_user(
const string& method,
const string& msg,
const Args&... args) {
268 if (
sizeof...(args) == 0) {
269 _warn(
"Cantera", method, msg);
271 _warn(
"Cantera", method, fmt::format(fmt::runtime(msg), args...));
329inline T
clip(
const T& value,
const T& lower,
const T& upper)
331 return std::max(lower, std::min(upper, value));
336template <
typename T>
int sign(T x) {
337 return (T(0) < x) - (x < T(0));
343string demangle(
const std::type_info& type);
This file contains definitions of constants, types and terms that are used in internal routines and a...
Wrapper for either system-installed or local headers for fmt.
bool warnings_suppressed()
Returns true if warnings should be suppressed.
void use_legacy_rate_constants(bool legacy)
Set definition used for rate constant calculation.
bool debugModeEnabled()
Returns true if Cantera was compiled in debug mode.
string demangle(const std::type_info &type)
Convert a type name to a human readable string, using boost::core::demangle if available.
void suppress_deprecation_warnings()
Globally disable printing of deprecation warnings.
void printStackTraceOnSegfault()
Enables printing a stacktrace to std::err if a segfault occurs.
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
void make_warnings_fatal()
Turns Cantera warnings into exceptions.
string version()
Returns the Cantera version.
void make_deprecation_warnings_fatal()
Turns deprecation warnings into exceptions.
bool legacy_rate_constants_used()
Returns true if legacy rate constant definition is used.
void suppress_warnings()
Globally disable printing of (user) warnings.
void suppress_thermo_warnings(bool suppress)
Globally disable printing of warnings about problematic thermo data, such as NASA polynomials with di...
string gitCommit()
Returns the hash of the git commit from which Cantera was compiled, if known.
bool usingSharedLibrary()
Returns true if Cantera was loaded as a shared library in the current application.
bool usesHDF5()
Returns true if Cantera was compiled with C++ HDF5 support.
void writelog_direct(const string &msg)
Write a message to the screen.
void setLogger(Logger *logwriter)
Install a logger.
void debuglog(const string &msg, int loglevel)
Write a message to the log only if loglevel > 0.
void writelogf(const char *fmt, const Args &... args)
Write a formatted message to the screen.
void writelog(const string &fmt, const Args &... args)
Write a formatted message to the screen.
void writelogendl()
Write an end of line character to the screen and flush output.
int sign(T x)
Sign of a number.
T clip(const T &value, const T &lower, const T &upper)
Clip value such that lower <= value <= upper.
void warn(const string &warning, const string &method, const string &msg, const Args &... args)
Print a generic warning raised from method.
void warn_user(const string &method, const string &msg, const Args &... args)
Print a user warning raised from method as CanteraWarning.
Namespace for the Cantera kernel.
void loadExtensions(const AnyMap &node)
Load extensions providing user-defined models from the extensions section of the given node.
void loadExtension(const string &extType, const string &name)
Load an extension implementing user-defined models.
void searchPythonVersions(const string &versions)
Set the versions of Python to try when loading user-defined extensions, in order of preference.
void thread_complete()
Delete and free memory allocated per thread in multithreaded applications.
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.
void appdelete()
Delete and free all memory associated with the application.