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;
File contains the FactoryBase class declarations.
Class to hold global data.
XML_Node * get_XML_File(const std::string &file, int debug=0)
Return a pointer to the XML tree for a Cantera input file.
void suppress_deprecation_warnings()
Globally disable printing of deprecation warnings.
void writelog(const std::string &msg)
Write a message to the screen.
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
void setLogger(Logger *logwriter)
Install a logger.
void make_deprecation_warnings_fatal()
Turns deprecation warnings into exceptions.
XML_Node * get_XML_from_string(const std::string &text)
Read a CTI or CTML string and fill up an XML tree.
void close_XML_File(const std::string &file)
Close an XML File.
void thread_complete()
Delete and free memory allocated per thread in multithreaded applications.
void suppress_thermo_warnings(bool suppress=true)
Globally disable printing of warnings about problematic thermo data, e.g.
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.
void writelogendl()
Write an endl to the screen and flush output.
Base class for exceptions thrown by Cantera classes.
Base class for 'loggers' that write text messages to log files.
virtual void error(const std::string &msg)
Write an error message and quit.
Class XML_Node is a tree-based representation of the contents of an XML file.
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".
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...
const size_t npos
index returned by functions to indicate "no position"
Namespace for the Cantera kernel.
static Application * app()
Return a pointer to the application object.
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.
Header for units conversion utilities, which are used to translate user input from input files (See I...
Classes providing support for XML data files.