This file contains a miscellaneous collection of global data functions and text for the globalData module (see Global Data), the logs module (see Diagnostic Output), and the HTML_logs module (see Writing HTML Logfiles). More...
#include <stdarg.h>
#include "global.h"
#include "ctexceptions.h"
#include "stringUtils.h"
#include "units.h"
#include "ct_defs.h"
#include <string>
#include <boost/thread/mutex.hpp>
#include "xml.h"
#include "ctml.h"
#include <vector>
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <memory>
#include <boost/shared_ptr.hpp>
Go to the source code of this file.
Classes | |
class | Application |
Class to hold global data. More... | |
class | Messages |
Class to carry out messages. More... | |
class | ThreadMessages |
Class that stores thread messages for each thread, and retrieves them based on the thread id. More... | |
Namespaces | |
namespace | Cantera |
Namespace for the Cantera kernel. | |
Defines | |
#define | DIR_LOCK() boost::mutex::scoped_lock d_lock(dir_mutex) |
Macro for locking input directory access. | |
#define | MSG_LOCK() boost::mutex::scoped_lock m_lock(msg_mutex) |
Macro for locking access to string messages. | |
#define | APP_LOCK() boost::mutex::scoped_lock a_lock(app_mutex) |
Macro for locking creating singletons in the application state. | |
#define | XML_LOCK() boost::mutex::scoped_lock x_lock(xml_mutex) |
Macro for locking XML file writing. | |
Functions | |
Application * | app () |
Return a pointer to the application object. | |
void | appdelete () |
Delete and free all memory associated with the application. | |
void | thread_complete () |
Delete and free memory allocated per thread in multithreaded applications. | |
XML_Node * | get_XML_File (std::string file, int debug=0) |
Return a pointer to the XML tree for a Cantera input file. | |
void | close_XML_File (std::string file) |
Close a Cantera input file. | |
void | setTmpDir (std::string tmp) |
Sets the temporary file directory. | |
std::string | tmpDir () |
Retrieves the directory name where temporary files are created. | |
std::string | sleep () |
Delay time in seconds. | |
int | nErrors () |
Return the number of errors that have been encountered so far. | |
void | popError () |
Discard the last error message. | |
std::string | lastErrorMessage () |
Returns the last error message. | |
void | showErrors (std::ostream &f) |
Prints all of the error messages to an ostream. | |
void | showErrors () |
Print all of the error messages using function writelog of class logger. | |
void | setError (std::string r, std::string msg) |
Set an error condition in the application class without throwing an exception. | |
void | addDirectory (std::string dir) |
Add a directory to the input file search path. | |
std::string | findInputFile (std::string name) |
Find an input file. | |
doublereal | toSI (std::string unit) |
Return the conversion factor to convert unit std::string 'unit' to SI units. | |
doublereal | actEnergyToSI (std::string unit) |
Return the conversion factor to convert activation energy unit std::string 'unit' to Kelvin. | |
std::string | canteraRoot () |
Returns root directory where Cantera where installed. | |
void | deprecatedMethod (std::string classnm, std::string oldnm, std::string newnm) |
Print a warning when a deprecated method is called. | |
void | removeAtVersion (std::string func, std::string version) |
Throw an error condition for a procedure that has been removed. | |
void | writelog (const std::string &msg) |
Write a message to the screen. | |
void | writelog (const char *msg) |
Write a message to the screen. | |
void | writelogf (const char *fmt,...) |
Write a formatted message to the screen. | |
void | writelogendl () |
Write an end of line character to the screen and flush output. | |
void | error (const std::string &msg) |
Write an error message and terminate execution. | |
int | userInterface () |
returns 1 for MATLAB, 2 for Python, and 0 for C++ or Fortran. | |
void | setLogger (Logger *logwriter) |
Install a logger. | |
void | beginLogGroup (std::string title, int loglevel=-99) |
Create a new group for log messages. | |
void | addLogEntry (std::string tag, std::string value) |
Add an entry to an HTML log file. | |
void | addLogEntry (std::string tag, doublereal value) |
Add an entry to an HTML log file. | |
void | addLogEntry (std::string tag, int value) |
Add an entry to an HTML log file. | |
void | addLogEntry (std::string msg) |
Add an entry msg string to an HTML log file. | |
void | endLogGroup (std::string title="") |
Close the current group of log messages. | |
void | write_logfile (std::string file="log.html") |
Write the HTML log file. | |
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 by the file part of the file_ID string. | |
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 by the file part of the file_ID string. |
This file contains a miscellaneous collection of global data functions and text for the globalData module (see Global Data), the logs module (see Diagnostic Output), and the HTML_logs module (see Writing HTML Logfiles).
These modules are defined here: globalData logs HTML_logs
Definition in file misc.cpp.
#define APP_LOCK | ( | ) | boost::mutex::scoped_lock a_lock(app_mutex) |
Macro for locking creating singletons in the application state.
Definition at line 69 of file misc.cpp.
Referenced by Application::ApplicationDestroy(), Application::getTmpDir(), Application::Instance(), Application::setTmpDir(), and Application::sleep().
#define DIR_LOCK | ( | ) | boost::mutex::scoped_lock d_lock(dir_mutex) |
Macro for locking input directory access.
Definition at line 63 of file misc.cpp.
Referenced by Application::addDataDirectory(), and Application::findInputFile().
#define MSG_LOCK | ( | ) | boost::mutex::scoped_lock m_lock(msg_mutex) |
Macro for locking access to string messages.
Definition at line 66 of file misc.cpp.
Referenced by ThreadMessages::operator->(), and ThreadMessages::removeThreadMessages().
#define XML_LOCK | ( | ) | boost::mutex::scoped_lock x_lock(xml_mutex) |
Macro for locking XML file writing.
Definition at line 72 of file misc.cpp.
Referenced by Application::close_XML_File(), and Application::get_XML_File().