10 #define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
11 #include <boost/stacktrace.hpp>
12 #include <boost/core/demangle.hpp>
31 }
catch (
const std::bad_alloc&) {
32 logwriter->
error(
"bad alloc thrown by app()");
46 void writeline(
char repeat,
size_t count,
bool endl_after,
bool endl_before)
57 void _warn_deprecated(
const string& method,
const string& extra)
62 void _warn(
const string& warning,
const string& method,
const string& extra)
64 app()->
warn(warning, method, extra);
113 void stacktraceWriter(
int signum) {
114 if (signum == SIGSEGV) {
115 std::cerr <<
"\nSegmentation fault. Stack trace:\n";
117 std::cerr <<
"\nProcess terminated abnormally. Stack trace:\n";
119 ::signal(signum, SIG_DFL);
120 std::cerr << boost::stacktrace::stacktrace();
128 ::signal(SIGSEGV, &stacktraceWriter);
129 ::signal(SIGABRT, &stacktraceWriter);
147 return CANTERA_VERSION;
181 if (!node.
hasKey(
"extensions")) {
184 for (
auto& extension : node[
"extensions"].asVector<AnyMap>()) {
185 loadExtension(extension[
"type"].asString(), extension[
"name"].asString());
215 static map<string, string> typenames = {
216 {
typeid(void).name(),
"void"},
217 {
typeid(double).name(),
"double"},
218 {
typeid(
long int).name(),
"long int"},
219 {
typeid(bool).name(),
"bool"},
220 {
typeid(string).name(),
"string"},
221 {
typeid(vector<AnyValue>).name(),
"vector<AnyValue>"},
222 {
typeid(vector<AnyMap>).name(),
"vector<AnyMap>"},
223 {
typeid(vector<double>).name(),
"vector<double>"},
224 {
typeid(vector<long int>).name(),
"vector<long int>"},
225 {
typeid(vector<bool>).name(),
"vector<bool>"},
226 {
typeid(vector<string>).name(),
"vector<string>"},
227 {
typeid(vector<vector<double>>).name(),
"vector<vector<double>>"},
228 {
typeid(vector<vector<long int>>).name(),
"vector<vector<long int>>"},
229 {
typeid(vector<vector<bool>>).name(),
"vector<vector<bool>>"},
230 {
typeid(vector<vector<string>>).name(),
"vector<vector<string>>"},
231 {
typeid(
AnyMap).name(),
"AnyMap"},
234 if (typenames.count(type.name())) {
235 return typenames[type.name()];
File contains the FactoryBase class declarations.
A map of string keys to values whose type can vary at runtime.
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
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.
void suppress_deprecation_warnings()
Globally disable printing of deprecation warnings.
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
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 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.
void thread_complete()
Delete and free memory allocated per thread in multithreaded applications.
void writelog(const string &msg)
Write a message to the screen.
void suppress_thermo_warnings(bool suppress=true)
Globally disable printing of warnings about problematic thermo data, such as NASA polynomials with di...
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.
static vector< FactoryBase * > s_vFactoryRegistry
statically held list of Factories.
static void deleteFactories()
static function that deletes all factories in the internal registry maintained in a static variable
Base class for 'loggers' that write text messages to log files.
virtual void error(const string &msg)
Write an error message and quit.
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 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 writelogendl()
Write an end of line character to the screen and flush output.
Namespace for the Cantera kernel.
static Application * app()
Return a pointer to the application object.
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 appdelete()
Delete and free all memory associated with the application.