Go to the documentation of this file.
19 return Application::Instance();
28 }
catch (
const std::bad_alloc&) {
29 logwriter->
error(
"bad alloc thrown by app()");
43 void writeline(
char repeat,
size_t count,
bool endl_after,
bool endl_before)
59 void _warn_user(
const std::string& method,
const std::string& extra)
87 std::mutex Unit::units_mutex;
91 Application::ApplicationDestroy();
92 FactoryBase::deleteFactories();
140 doublereal
toSI(
const std::string& unit)
142 doublereal f = Unit::units()->toSI(unit);
146 throw CanteraError(
"toSI",
"unknown unit string: "+unit);
153 doublereal f = Unit::units()->actEnergyToSI(unit);
162 char* ctroot = getenv(
"CANTERA_ROOT");
164 return string(ctroot);
167 return string(CANTERA_ROOT);
182 static void split_at_pound(
const std::string& src, std::string& file, std::string&
id)
184 string::size_type ipound = src.find(
'#');
186 id = src.substr(ipound+1,src.size());
187 file = src.substr(0,ipound);
196 std::string fname, idstr;
201 "no file name given. file_ID = "+file_ID);
202 db = root->
findID(idstr, 3);
208 if (fname.rfind(
".xml") == fname.size() - 4) {
209 fname.replace(fname.size() - 3, 3,
"cti");
210 }
else if (fname.rfind(
".cti") == fname.size() - 4) {
211 fname.replace(fname.size() - 3, 3,
"xml");
222 "get_XML_File failed trying to open "+fname);
223 db = doc->
findID(idstr, 3);
227 "id tag '"+idstr+
"' not found.");
233 const std::string& file_ID,
236 string fname, idTarget;
254 std::vector<FactoryBase*> FactoryBase::s_vFactoryRegistry;
void suppress_deprecation_warnings()
Globally disable printing of deprecation warnings.
static Application * app()
Return a pointer to the application object.
void warn_deprecated(const std::string &method, const std::string &extra="")
Print a warning indicating that method is deprecated.
void warn_user(const std::string &method, const std::string &extra="")
Print a user warning arising during usage of method.
Base class for 'loggers' that write text messages to log files.
XML_Node * get_XML_File(const std::string &file, int debug=0)
Return a pointer to the XML tree for a Cantera input file.
virtual void error(const std::string &msg)
Write an error message and quit.
void thread_complete()
Delete and free memory allocated per thread in multithreaded applications.
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
XML_Node * findNameID(const std::string &nameTarget, const std::string &idTarget) const
This routine carries out a recursive search for an XML node based on both the XML element name and th...
void setLogger(Logger *logwriter)
Install a logger.
void close_XML_File(const std::string &file)
Close an XML File.
void make_deprecation_warnings_fatal()
Turns deprecation warnings into exceptions.
void suppress_thermo_warnings(bool suppress=true)
Globally disable printing of warnings about problematic thermo data, e.g.
Class to hold global data.
Class XML_Node is a tree-based representation of the contents of an XML file.
void writelogendl()
Write an endl to the screen and flush output.
XML_Node * get_XML_from_string(const std::string &text)
Read a CTI or CTML string and fill up an XML tree.
XML_Node * findID(const std::string &id, const int depth=100) const
This routine carries out a recursive search for an XML node based on the XML element attribute "id".
void writelog(const std::string &msg)
Write a message to the screen.
Base class for exceptions thrown by Cantera classes.
const size_t npos
index returned by functions to indicate "no position"
static void split_at_pound(const std::string &src, std::string &file, std::string &id)
split a string at a '#' sign. Used to separate a file name from an id string.
Namespace for the Cantera kernel.