Cantera
3.0.0
|
Handling of Cantera input files. More...
Handling of Cantera input files.
The properties of phases and interfaces are specified in text files. These procedures handle various aspects of reading these files. Input files should be read using the newSolution() or newInterface() service functions (see Objects Representing Phases).
For input files not specified by an absolute pathname, Cantera searches for input files along a path that includes platform-specific default locations, and possibly user-specified locations:
"."
is always searched first. Then, on Windows, the registry is checked to find the Cantera installation directory, and the data
subdirectory of the installation directory will be added to the search path.CANTERA_DATA
is set to a directory name or a list of directory names separated with the OS-dependent path separator (that is, ";"
on Windows, ":"
elsewhere), then these directories will be added to the search path.Cantera input files are written using YAML syntax. For more information on using YAML files in Cantera, see the YAML Users' Guide or the YAML Input File API Reference. Cantera provides the ck2yaml
tool for converting Chemkin-format mechanisms to the YAML format. The utilities cti2yaml
and ctml2yaml
should be used to convert legacy CTI and XML input files (from Cantera 2.6 and earlier) to the YAML format.
Functions | |
void | addDataDirectory (const string &dir) |
Add a directory to the data file search path. | |
string | findInputFile (const string &name) |
Find an input file. | |
string | getDataDirectories (const string &sep) |
Get the Cantera data directories. | |
void | setDefaultDirectories () |
Set the default directories for input files. | |
string | findInputFile (const string &name) |
Find an input file. | |
void | addDirectory (const string &dir) |
Add a directory to the data file search path. | |
string | getDataDirectories (const string &sep) |
Get the Cantera data directories. | |
void addDataDirectory | ( | const string & | dir | ) |
Add a directory to the data file search path.
dir | String name for the directory to be added to the search path |
Definition at line 284 of file application.cpp.
string findInputFile | ( | const string & | name | ) |
Find an input file.
This routine will search for a file in the default locations specified for the application. See the routine setDefaultDirectories() listed above. The first directory searched is usually the current working directory.
The default set of directories will not be searched if an absolute path (for example, one starting with /
or C:\
) or a path relative to the user's home directory (for example, starting with ~/
) is specified.
The presence of the file is determined by whether the file can be opened for reading by the current user.
name | Name of the input file to be searched for |
If the file is not found a CanteraError exception is thrown.
Definition at line 313 of file application.cpp.
|
inline |
Get the Cantera data directories.
This routine returns a string including the names of all the directories searched by Cantera for data files.
sep | Separator to use between directories in the string |
Definition at line 279 of file application.h.
|
protected |
Set the default directories for input files.
Cantera searches for input files along a path that includes platform- specific default locations, and possibly user-specified locations. This function installs the platform-specific directories on the search path. It is invoked at startup by appinit(), and never should need to be called by user programs.
The current directory (".") is always searched first. Then, on Windows, the registry is checked to find the Cantera installation directory, and the 'data' subdirectory of the installation directory will be added to the search path.
On any platform, if environment variable CANTERA_DATA is set to a directory name or a list of directory names separated with the OS-dependent path separator (that is, ";" on Windows, ":" elsewhere), then these directories will be added to the search path.
Finally, the location where the data files were installed when Cantera was built is added to the search path.
Additional directories may be added by calling function addDirectory.
Definition at line 216 of file application.cpp.
string findInputFile | ( | const string & | name | ) |
Find an input file.
This routine will search for a file in the default locations specified for the application. See the routine setDefaultDirectories() listed above. The first directory searched is usually the current working directory.
The default set of directories will not be searched if an absolute path (for example, one starting with /
or C:\
) or a path relative to the user's home directory (for example, starting with ~/
) is specified.
The presence of the file is determined by whether the file can be opened for reading by the current user.
name | Name of the input file to be searched for |
If the file is not found a CanteraError exception is thrown.
Definition at line 169 of file global.cpp.
void addDirectory | ( | const string & | dir | ) |
Add a directory to the data file search path.
dir | String name for the directory to be added to the search path |
Definition at line 159 of file global.cpp.
string getDataDirectories | ( | const string & | sep | ) |
Get the Cantera data directories.
This routine returns a string including the names of all the directories searched by Cantera for data files.
sep | Separator to use between directories in the string |
Definition at line 164 of file global.cpp.