19 return Application::Instance();
28 }
catch (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)
82 std::mutex Unit::units_mutex;
86 Application::ApplicationDestroy();
87 FactoryBase::deleteFactories();
135 doublereal
toSI(
const std::string& unit)
137 doublereal f = Unit::units()->toSI(unit);
141 throw CanteraError(
"toSI",
"unknown unit string: "+unit);
148 doublereal f = Unit::units()->actEnergyToSI(unit);
157 char* ctroot = getenv(
"CANTERA_ROOT");
159 return string(ctroot);
162 return string(CANTERA_ROOT);
177 static void split_at_pound(
const std::string& src, std::string& file, std::string&
id)
179 string::size_type ipound = src.find(
'#');
181 id = src.substr(ipound+1,src.size());
182 file = src.substr(0,ipound);
191 std::string fname, idstr;
196 "no file name given. file_ID = "+file_ID);
197 db = root->
findID(idstr, 3);
203 if (fname.rfind(
".xml") == fname.size() - 4) {
204 fname.replace(fname.size() - 3, 3,
"cti");
205 }
else if (fname.rfind(
".cti") == fname.size() - 4) {
206 fname.replace(fname.size() - 3, 3,
"xml");
217 "get_XML_File failed trying to open "+fname);
218 db = doc->
findID(idstr, 3);
222 "id tag '"+idstr+
"' not found.");
228 const std::string& file_ID,
231 string fname, idTarget;
249 std::vector<FactoryBase*> FactoryBase::s_vFactoryRegistry;
XML_Node * get_XML_Node(const std::string &file_ID, XML_Node *root)
This routine will locate an XML node in either the input XML tree or in another input file specified ...
void make_deprecation_warnings_fatal()
Turns deprecation warnings into exceptions.
XML_Node * get_XML_File(const std::string &file, int debug)
Return a pointer to the XML tree for a Cantera input file.
void writelogendl()
Write an endl to the screen and flush output.
Base class for 'loggers' that write text messages to log files.
Class to hold global data.
doublereal actEnergyToSI(const std::string &unit)
Return the conversion factor to convert activation energy unit std::string 'unit' to Kelvin...
doublereal toSI(const std::string &unit)
Return the conversion factor to convert unit std::string 'unit' to SI units.
void thread_complete()
Delete and free memory allocated per thread in multithreaded applications.
const size_t npos
index returned by functions to indicate "no position"
void setLogger(Logger *logwriter)
Install a logger.
static Application * app()
Return a pointer to the application object.
Class XML_Node is a tree-based representation of the contents of an XML file.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
virtual void error(const std::string &msg)
Write an error message and quit.
void writelog(const std::string &msg)
Write a message to the screen.
XML_Node * get_XML_from_string(const std::string &text)
Read a CTI or CTML string and fill up an XML tree.
XML_Node * get_XML_from_string(const std::string &text)
Read a CTI or CTML string and fill up an XML tree.
std::string gitCommit()
Returns the hash of the git commit from which Cantera was compiled, if known.
void suppress_thermo_warnings(bool suppress)
Globally disable printing of warnings about problematic thermo data, e.g.
void close_XML_File(const std::string &file)
Close an XML File.
Classes providing support for XML data files.
Base class for exceptions thrown by Cantera classes.
void suppress_deprecation_warnings()
Globally disable printing of deprecation warnings.
void warn_deprecated(const std::string &method, const std::string &extra="")
Print a warning indicating that method is deprecated.
Header for units conversion utilities, which are used to translate user input from input files (See I...
void appdelete()
Delete and free all memory associated with the application.
XML_Node * get_XML_File(const std::string &file, int debug=0)
Return a pointer to the XML tree for a Cantera input file.
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 thread_complete()
Delete and free memory allocated per thread in multithreaded applications.
void writelogendl()
Write an end of line character to the screen and flush output.
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
void suppress_deprecation_warnings()
Globally disable printing of deprecation warnings.
void make_deprecation_warnings_fatal()
Turns deprecation warnings into exceptions.
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
Namespace for the Cantera kernel.
void suppress_thermo_warnings(bool suppress=true)
Globally disable printing of warnings about problematic thermo data, e.g.
XML_Node * get_XML_NameID(const std::string &nameTarget, const std::string &file_ID, XML_Node *root)
This routine will locate an XML node in either the input XML tree or in another input file specified ...
File contains the FactoryBase class declarations.
void writelog_direct(const std::string &msg)
Write a message to the screen.
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...
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.
void setLogger(Logger *logwriter)
Install a logger.
void close_XML_File(const std::string &file)
Close an XML File.