Cantera  2.5.1
ctml.h
Go to the documentation of this file.
1 /**
2  * @file ctml.h
3  * CTML ("Cantera Markup Language") is the variant of XML that Cantera uses
4  * to store data. These functions read and write it.
5  * (see \ref inputfiles and importCTML, ck2ctml)
6  */
7 
8 // This file is part of Cantera. See License.txt in the top-level directory or
9 // at https://cantera.org/license.txt for license and copyright information.
10 
11 #ifndef CT_CTML_H
12 #define CT_CTML_H
13 
14 #include "ct_defs.h"
15 #include "xml.h"
16 
17 namespace Cantera
18 {
19 class Array2D;
20 
21 //! This function adds a child node with the name, "float", with a value
22 //! consisting of a single floating point number
23 /*!
24  * This function will add a child node to the current XML node, with the name
25  * "float". It will have a title attribute, and the body of the XML node will be
26  * filled out with a single float
27  *
28  * Example:
29  *
30  * @code
31  * const XML_Node &node;
32  * std::string titleString = "activationEnergy";
33  * doublereal value = 50.3;
34  * doublereal maxval = 1.0E3;
35  * doublereal minval = 0.0;
36  * std::string typeString = "optional";
37  * std::string unitsString = "kcal/gmol";
38  * addFloat(node, titleString, value, unitsString, typeString, minval, maxval);
39  * @endcode
40  *
41  * Creates the following the snippet in the XML file:
42  *
43  * <parentNode>
44  * <float title="activationEnergy" type="optional" units="kcal/gmol" min="0.0" max="1.0E3">
45  * 50.3
46  * <\float>
47  * <\parentNode>
48  *
49  * @param node reference to the XML_Node object of the parent XML element
50  * @param titleString String name of the title attribute
51  * @param value Value - single integer
52  * @param unitsString String name of the Units attribute. The default is to
53  * have an empty string.
54  * @param typeString String type. This is an optional parameter. The default
55  * is to have an empty string.
56  * @param minval Minimum allowed value of the float. The default is the
57  * special double, Undef, which means to ignore the entry.
58  * @param maxval Maximum allowed value of the float. The default is the
59  * special double, Undef, which means to ignore the entry.
60  *
61  * @deprecated The XML input format is deprecated and will be removed in
62  * Cantera 3.0.
63  */
64 void addFloat(XML_Node& node, const std::string& titleString,
65  const doublereal value, const std::string& unitsString="",
66  const std::string& typeString="", const doublereal minval=Undef,
67  const doublereal maxval=Undef);
68 
69 //! This function adds a child node with the name, "floatArray", with a value
70 //! consisting of a comma separated list of floats
71 /*!
72  * This function will add a child node to the current XML node, with the name
73  * "floatArray". It will have a title attribute, and the body of the XML node
74  * will be filled out with a comma separated list of doublereals.
75  *
76  * Example:
77  *
78  * @code
79  * const XML_Node &node;
80  * std::string titleString = "additionalTemperatures";
81  * int n = 3;
82  * int Tcases[3] = [273.15, 298.15, 373.15];
83  * std::string typeString = "optional";
84  * std::string units = "Kelvin";
85  * addFloatArray(node, titleString, n, &cases[0], typeString, units);
86  * @endcode
87  *
88  * Creates the following the snippet in the XML file:
89  *
90  * <parentNode>
91  * <floatArray title="additionalTemperatures" type="optional" units="Kelvin">
92  * 273.15, 298.15, 373.15
93  * <\floatArray>
94  * <\parentNode>
95  *
96  * @param node reference to the XML_Node object of the parent XML element
97  * @param titleString String name of the title attribute
98  * @param n Length of the doubles vector.
99  * @param values Pointer to a vector of doubles
100  * @param unitsString String name of the Units attribute. This is an optional
101  * parameter. The default is to have an empty string.
102  * @param typeString String type. This is an optional parameter. The default
103  * is to have an empty string.
104  * @param minval Minimum allowed value of the int. This is an optional
105  * parameter. The default is the special double, Undef,
106  * which means to ignore the entry.
107  * @param maxval Maximum allowed value of the int. This is an optional
108  * parameter. The default is the special double,
109  * Undef, which means to ignore the entry.
110  *
111  * @deprecated The XML input format is deprecated and will be removed in
112  * Cantera 3.0.
113  */
114 void addFloatArray(XML_Node& node, const std::string& titleString,
115  const size_t n, const doublereal* const values,
116  const std::string& unitsString="", const std::string& typeString="",
117  const doublereal minval=Undef,
118  const doublereal maxval=Undef);
119 
120 //! This function adds a child node with the name given by the first parameter
121 //! with a value consisting of a comma separated list of floats
122 /*!
123  * This function will add a child node to the current XML node, with the name
124  * given in the list. It will have a title attribute, and the body of the XML
125  * node will be filled out with a comma separated list of integers
126  *
127  * Example:
128  *
129  * @code
130  * const XML_Node &node;
131  * std::string titleString = "additionalTemperatures";
132  * int n = 3;
133  * int Tcases[3] = [273.15, 298.15, 373.15];
134  * std::string typeString = "optional";
135  * std::string units = "Kelvin";
136  * addNamedFloatArray(node, titleString, n, &cases[0], typeString, units);
137  * @endcode
138  *
139  * Creates the following the snippet in the XML file:
140  *
141  * <parentNode>
142  * <additionalTemperatures type="optional" vtype="floatArray" size = "3" units="Kelvin">
143  * 273.15, 298.15, 373.15
144  * <\additionalTemperatures>
145  * <\parentNode>
146  *
147  * @param parentNode reference to the XML_Node object of the parent XML element
148  * @param name Name of the XML node
149  * @param n Length of the doubles vector.
150  * @param vals Pointer to a vector of doubles
151  * @param units String name of the Units attribute. This is an optional
152  * parameter. The default is to have an empty string.
153  * @param type String type. This is an optional parameter. The default
154  * is to have an empty string.
155  * @param minval Minimum allowed value of the int. This is an optional
156  * parameter. The default is the special double,
157  * Undef, which means to ignore the entry.
158  * @param maxval Maximum allowed value of the int. This is an optional
159  * parameter. The default is the special double,
160  * Undef, which means to ignore the entry.
161  *
162  * @deprecated The XML input format is deprecated and will be removed in
163  * Cantera 3.0.
164  */
165 void addNamedFloatArray(XML_Node& parentNode, const std::string& name, const size_t n,
166  const doublereal* const vals, const std::string units = "",
167  const std::string type = "",
168  const doublereal minval=Undef,
169  const doublereal maxval=Undef);
170 
171 //! This function adds a child node with the name string with a string value
172 //! to the current node
173 /*!
174  * This function will add a child node to the current XML node, with the name
175  * "string". It will have a title attribute, and the body of the XML node will
176  * be filled out with the valueString argument verbatim.
177  *
178  * Example:
179  *
180  * @code
181  * const XML_Node &node;
182  * addString(node, "titleString", "valueString", "typeString");
183  * @endcode
184  *
185  * Creates the following the snippet in the XML file:
186  *
187  * <string title="titleString" type="typeString">
188  * valueString
189  * <\string>
190  *
191  * @param node reference to the XML_Node object of the parent XML element
192  * @param valueString Value string to be used in the new XML node.
193  * @param titleString String name of the title attribute
194  * @param typeString String type. This is an optional parameter.
195  *
196  * @deprecated The XML input format is deprecated and will be removed in
197  * Cantera 3.0.
198  */
199 void addString(XML_Node& node, const std::string& titleString,
200  const std::string& valueString, const std::string& typeString="");
201 
202 //! This function reads the current node or a child node of the current node
203 //! with the default name, "floatArray", with a value field
204 //! consisting of a comma separated list of floats
205 /*!
206  * This function will read either the current XML node or a child node to the
207  * current XML node, with the name "floatArray". It will have a title
208  * attribute, and the body of the XML node will be filled out with a comma
209  * separated list of doublereals. Get an array of floats from the XML Node.
210  * The argument field is assumed to consist of an arbitrary number of comma
211  * separated floats, with an arbitrary amount of white space separating each
212  * field. If the node array has an units attribute field, then the units are
213  * used to convert the floats, iff convert is true.
214  *
215  * Example:
216  *
217  * @code
218  * const XML_Node &State_XMLNode;
219  * vector_fp v;
220  * bool convert = true;
221  * unitsString = "";
222  * nodeName="floatArray";
223  * getFloatArray(State_XMLNode, v, convert, unitsString, nodeName);
224  * @endcode
225  *
226  * reads the corresponding XML file:
227  *
228  * <state>
229  * <floatArray units="m3"> 32.4, 1, 100. <\floatArray>
230  * <\state>
231  *
232  * and will produce the vector:
233  *
234  * v[0] = 32.4
235  * v[1] = 1.0
236  * v[2] = 100.
237  *
238  * @param node XML parent node of the floatArray
239  * @param v Output vector of floats containing the floatArray information.
240  * @param convert Conversion to SI is carried out if this boolean is
241  * True. The default is true.
242  * @param unitsString String name of the type attribute. This is an optional
243  * parameter. The default is to have an empty string. The
244  * only string that is recognized is actEnergy. Anything
245  * else has no effect. This affects what units converter is
246  * used.
247  * @param nodeName XML Name of the XML node to read. The default value for
248  * the node name is floatArray
249  * @returns the number of floats read into v.
250  *
251  * @deprecated The XML input format is deprecated and will be removed in
252  * Cantera 3.0.
253  */
254 size_t getFloatArray(const XML_Node& node, vector_fp & v,
255  const bool convert=true, const std::string& unitsString="",
256  const std::string& nodeName = "floatArray");
257 
258 //! This function interprets the value portion of an XML element as a string. It
259 //! then separates the string up into tokens according to the location of white
260 //! space.
261 /*!
262  * The separate tokens are returned in the string vector
263  *
264  * @param node Node to get the value from
265  * @param v Output vector containing the string tokens
266  *
267  * @deprecated The XML input format is deprecated and will be removed in
268  * Cantera 3.0.
269  */
270 void getStringArray(const XML_Node& node, std::vector<std::string>& v);
271 
272 //! This routine is used to interpret the value portions of XML
273 //! elements that contain colon separated pairs.
274 /*!
275  * These are used, for example, in describing the element composition of
276  * species.
277  *
278  * <atomArray> H:4 C:1 <atomArray>
279  *
280  * The string is first separated into a string vector according to the location
281  * of white space. Then each string is again separated into two parts according
282  * to the location of a colon in the string. The first part of the string is
283  * used as the key, while the second part of the string is used as the value, in
284  * the return map. It is an error to not find a colon in each string pair.
285  *
286  * @param node Current node
287  * @param m Output Map containing the pairs of values found in the XML Node
288  *
289  * @deprecated The XML input format is deprecated and will be removed in
290  * Cantera 3.0.
291  */
292 void getMap(const XML_Node& node, std::map<std::string, std::string>& m);
293 
294 //! This function interprets the value portion of an XML element
295 //! as a series of "Pairs" separated by white space.
296 /*!
297  * Each pair consists of non-whitespace characters. The first ":" found in the
298  * pair string is used to separate the string into two parts. The first part
299  * is called the "key" The second part is called the "val". String vectors of
300  * key[i] and val[i] are returned in the argument list. Warning: No spaces are
301  * allowed in each pair. Quotes get included as part of the string. Example:
302  *
303  * <xmlNode>
304  * red:112 blue:34
305  * green:banana
306  * </xmlNode>
307  *
308  * Returns:
309  *
310  * index | key | val
311  * ----- | ------- | ---------
312  * 0 | "red" | "112"
313  * 1 | "blue" | "34"
314  * 2 | "green" | "banana"
315  *
316  * @param node XML Node
317  * @param key Vector of keys for each entry
318  * @param val Vector of values for each entry
319  * @returns the number of pairs found
320  *
321  * @deprecated The XML input format is deprecated and will be removed in
322  * Cantera 3.0.
323  */
324 int getPairs(const XML_Node& node, std::vector<std::string>& key,
325  std::vector<std::string>& val);
326 
327 //! This function interprets the value portion of an XML element as a series of
328 //! "Matrix ids and entries" separated by white space.
329 /*!
330  * Each pair consists of non-whitespace characters. The first two ":" found in
331  * the pair string is used to separate the string into three parts. The first
332  * part is called the first key. The second part is the second key. Both parts
333  * must match an entry in the keyString1 and keyString2, respectively, in
334  * order to provide a location to place the object in the matrix. The third
335  * part is called the value. It is expected to be a double. It is translated
336  * into a double and placed into the correct location in the matrix.
337  *
338  * Warning: No spaces are allowed in each triplet. Quotes are part of the
339  * string.
340  *
341  * Example:
342  * keyString = red, blue, black, green
343  *
344  * <xmlNode>
345  * red:green:112
346  * blue:black:3.3E-23
347  * </xmlNode>
348  *
349  * Returns:
350  *
351  * retnValues(0, 3) = 112
352  * retnValues(1, 2) = 3.3E-23
353  *
354  * @param node XML Node containing the information for the matrix
355  * @param keyStringRow Key string for the row
356  * @param keyStringCol Key string for the column entries
357  * @param returnValues Return Matrix.
358  * @param convert If this is true, and if the node has a units attribute,
359  * then conversion to SI units is carried out. Default is
360  * true.
361  * @param matrixSymmetric If true entries are made so that the matrix is always
362  * symmetric. Default is false.
363  *
364  * @deprecated The XML input format is deprecated and will be removed in
365  * Cantera 3.0.
366  */
367 void getMatrixValues(const XML_Node& node,
368  const std::vector<std::string>& keyStringRow,
369  const std::vector<std::string>& keyStringCol,
370  Array2D& returnValues, const bool convert = true,
371  const bool matrixSymmetric = false);
372 
373 //! Get a vector of integer values from a child element.
374 /*!
375  * Returns a std::map containing a keyed values for child XML_Nodes of the
376  * current node with the name, "integer". In the keyed mapping there will be a
377  * list of titles vs. values for all of the XML nodes. The integer XML_nodes
378  * are expected to be in a particular form, with one value per XML_node.
379  *
380  * Example:
381  * @code
382  * const XML_Node &State_XMLNode;
383  * std::map<std::string, integer> v;
384  * getInteger(State_XMLNode, v);
385  * @endcode
386  * reads the corresponding XML file:
387  *
388  * <state>
389  * <integer title="i1"> 1 <\integer>
390  * <integer title="i2"> 2 <\integer>
391  * <integer title="i3"> 3 <\integer>
392  * <\state>
393  *
394  * Will produce the mapping:
395  *
396  * v["i1"] = 1
397  * v["i2"] = 2
398  * v["i3"] = 3
399  *
400  * @param node Current XML node to get the values from
401  * @param v Output map of the results.
402  *
403  * @deprecated The XML input format is deprecated and will be removed in
404  * Cantera 3.0.
405  */
406 void getIntegers(const XML_Node& node, std::map<std::string,int>& v);
407 
408 //! Get a floating-point value from a child element.
409 /*!
410  * Returns a doublereal value for the child named 'name' of element 'parent'.
411  * If 'type' is supplied and matches a known unit type, unit conversion to SI
412  * will be done if the child element has an attribute 'units'.
413  *
414  * Note, it's an error for the child element not to exist.
415  *
416  * Example:
417  *
418  * @code
419  * const XML_Node &State_XMLNode;
420  * doublereal pres = OneAtm;
421  * if (state_XMLNode.hasChild("pressure")) {
422  * pres = getFloat(State_XMLNode, "pressure", "toSI");
423  * }
424  * @endcode
425  *
426  * reads the corresponding XML file:
427  *
428  * <state>
429  * <pressure units="Pa"> 101325.0 </pressure>
430  * <\state>
431  *
432  * @param parent reference to the XML_Node object of the parent XML element
433  * @param name Name of the XML child element
434  * @param type String type. Currently known types are "toSI" and "actEnergy",
435  * and "" , for no conversion. The default value is "",
436  * which implies that no conversion is allowed.
437  *
438  * @deprecated The XML input format is deprecated and will be removed in
439  * Cantera 3.0.
440  */
441 doublereal getFloat(const XML_Node& parent, const std::string& name,
442  const std::string& type="");
443 
444 //! Get a floating-point value from the current XML element
445 /*!
446  * Returns a doublereal value from the current element. If 'type' is supplied
447  * and matches a known unit type, unit conversion to SI will be done if the
448  * child element has an attribute 'units'.
449  *
450  * Note, it's an error for the child element not to exist.
451  *
452  * Example:
453  *
454  * @code
455  * const XML_Node &State_XMLNode;
456  * doublereal pres = OneAtm;
457  * if (state_XMLNode.hasChild("pressure")) {
458  * XML_Node *pres_XMLNode = State_XMLNode.getChild("pressure");
459  * pres = getFloatCurrent(pres_XMLNode, "toSI");
460  * }
461  * @endcode
462  *
463  * Reads the corresponding XML file:
464  *
465  * <state>
466  * <pressure units="Pa"> 101325.0 </pressure>
467  * <\state>
468  *
469  * @param currXML reference to the current XML_Node object
470  * @param type String type. Currently known types are "toSI" and "actEnergy",
471  * and "" , for no conversion. The default value is "",
472  * which implies that no conversion is allowed.
473  *
474  * @deprecated The XML input format is deprecated and will be removed in
475  * Cantera 3.0.
476  */
477 doublereal getFloatCurrent(const XML_Node& currXML, const std::string& type="");
478 
479 //! Get an optional floating-point value from a child element.
480 /*!
481  * Returns a doublereal value for the child named 'name' of element 'parent'.
482  * If 'type' is supplied and matches a known unit type, unit conversion to SI
483  * will be done if the child element has an attribute 'units'.
484  *
485  * Example:
486  *
487  * @code
488  * const XML_Node &State_XMLNode;
489  * doublereal pres = OneAtm;
490  * bool exists = getOptionalFloat(State_XMLNode, "pressure", pres, "toSI");
491  * @endcode
492  *
493  * reads the corresponding XML file:
494  *
495  * <state>
496  * <pressure units="Pa"> 101325.0 </pressure>
497  * <\state>
498  *
499  * @param parent reference to the XML_Node object of the parent XML element
500  * @param name Name of the XML child element
501  * @param fltRtn Float Return. It will be overridden if the XML element exists.
502  * @param type String type. Currently known types are "toSI" and
503  * "actEnergy", and "" , for no conversion. The default value is
504  * "", which implies that no conversion is allowed.
505  *
506  * @returns true if the child element named "name" exists
507  *
508  * @deprecated The XML input format is deprecated and will be removed in
509  * Cantera 3.0.
510  */
511 bool getOptionalFloat(const XML_Node& parent, const std::string& name,
512  doublereal& fltRtn, const std::string& type="");
513 
514 //! Get an integer value from a child element.
515 /*!
516  * Returns an integer value for the child named 'name' of element 'parent'.
517  * Note, it's an error for the child element not to exist.
518  *
519  * Example:
520  *
521  * @code
522  * const XML_Node &State_XMLNode;
523  * int number = 1;
524  * if (state_XMLNode.hasChild("NumProcs")) {
525  * number = getInteger(State_XMLNode, "numProcs");
526  * }
527  * @endcode
528  *
529  * reads the corresponding XML file:
530  *
531  * <state>
532  * <numProcs> 10 <numProcs/>
533  * <\state>
534  *
535  * @param parent reference to the XML_Node object of the parent XML element
536  * @param name Name of the XML child element
537  *
538  * @deprecated The XML input format is deprecated and will be removed in
539  * Cantera 3.0.
540  */
541 int getInteger(const XML_Node& parent, const std::string& name);
542 
543 //! Get an optional model name from a named child node.
544 /*!
545  * Returns the model name attribute for the child named 'nodeName' of element
546  * 'parent'. Note, it's optional for the child node to exist
547  *
548  * Example:
549  *
550  * @code
551  * std::string modelName = "";
552  * bool exists = getOptionalModel(transportNode, "compositionDependence",
553  * modelName);
554  * @endcode
555  *
556  * reads the corresponding XML file:
557  *
558  * <transport model="Simple">
559  * <compositionDependence model="Solvent_Only"/>
560  * </transport>
561  *
562  * On return modelName is set to "Solvent_Only".
563  *
564  * @param parent reference to the XML_Node object of the parent XML element
565  * @param nodeName Name of the XML child element
566  * @param modelName On return this contains the contents of the model attribute
567  * @return True if the nodeName XML node exists. False otherwise.
568  *
569  * @deprecated The XML input format is deprecated and will be removed in
570  * Cantera 3.0.
571  */
572 bool getOptionalModel(const XML_Node& parent, const std::string& nodeName,
573  std::string& modelName);
574 
575 //! Search the child nodes of the current node for an XML Node with a Title
576 //! attribute of a given name.
577 /*!
578  * @param node Current node from which to conduct the search
579  * @param title Name of the title attribute
580  * @returns a pointer to the matched child node. Returns 0 if no node is found.
581  *
582  * @deprecated The XML input format is deprecated and will be removed in
583  * Cantera 3.0.
584  */
585 XML_Node* getByTitle(const XML_Node& node, const std::string& title);
586 
587 //! This function reads a child node with the name string with a specific
588 //! title attribute named titleString
589 /*!
590  * This function will read a child node to the current XML node with the name
591  * "string". It must have a title attribute, named titleString, and the body
592  * of the XML node will be read into the valueString output argument.
593  *
594  * If the child node is not found then the empty string is returned.
595  *
596  * Example:
597  *
598  * @code
599  * const XML_Node &node;
600  * getString(XML_Node& node, std::string titleString, std::string valueString,
601  * std::string typeString);
602  * @endcode
603  *
604  * Reads the following the snippet in the XML file:
605  *
606  * <string title="titleString" type="typeString">
607  * valueString
608  * <\string>
609  *
610  * @param node Reference to the XML_Node object of the parent XML element
611  * @param titleString String name of the title attribute of the child node
612  * @param valueString Value string that is found in the child node. output
613  * variable
614  * @param typeString String type. This is an optional output variable. It
615  * is filled with the attribute "type" of the XML entry.
616  *
617  * @deprecated The XML input format is deprecated and will be removed in
618  * Cantera 3.0.
619  */
620 void getString(const XML_Node& node, const std::string& titleString,
621  std::string& valueString, std::string& typeString);
622 
623 //! This function reads a child node with the name, nameString, and returns
624 //! its XML value as the return string
625 /*!
626  * If the child XML_node named "name" doesn't exist, the empty string is returned.
627  *
628  * Example:
629  * @code
630  * const XML_Node &parent;
631  * string nameString = "vacancy_species";
632  * string valueString = getChildValue(parent, nameString
633  * std::string typeString);
634  * @endcode
635  *
636  * returns `valueString = "O(V)"` from the following the snippet in the XML file:
637  *
638  * <vacancySpecies>
639  * O(V)
640  * <\vacancySpecies>
641  *
642  * @param parent parent reference to the XML_Node object of the parent XML element
643  * @param nameString Name of the child XML_Node to read the value from.
644  * @return String value of the child XML_Node
645  *
646  * @deprecated The XML input format is deprecated and will be removed in
647  * Cantera 3.0.
648  */
649 std::string getChildValue(const XML_Node& parent,
650  const std::string& nameString);
651 
652 //! Convert a cti file into a ctml file
653 /*!
654  * @param file Pointer to the file
655  * @param debug Turn on debug printing
656  *
657  * @ingroup inputfiles
658  *
659  * @deprecated The XML input format is deprecated and will be removed in
660  * Cantera 3.0.
661  */
662 void ct2ctml(const char* file, const int debug = 0);
663 
664 //! Get a string with the ctml representation of a cti file.
665 /*!
666  * @param file Path to the input file in CTI format
667  * @return String containing the XML representation of the input file
668  *
669  * @ingroup inputfiles
670  *
671  * @deprecated The XML input format is deprecated and will be removed in
672  * Cantera 3.0.
673  */
674 std::string ct2ctml_string(const std::string& file);
675 
676 //! Get a string with the ctml representation of a cti input string.
677 /*!
678  * @param cti String containing the cti representation
679  * @return String containing the XML representation of the input
680  *
681  * @ingroup inputfiles
682  *
683  * @deprecated The XML input format is deprecated and will be removed in
684  * Cantera 3.0.
685  */
686 std::string ct_string2ctml_string(const std::string& cti);
687 
688 //! Convert a Chemkin-format mechanism into a CTI file.
689 /*!
690  * @param in_file input file containing species and reactions
691  * @param thermo_file optional input file containing thermo data
692  * @param transport_file optional input file containing transport parameters
693  * @param id_tag id of the phase
694  *
695  * @deprecated The CTI input format is deprecated and will be removed in
696  * Cantera 3.0.
697  */
698 void ck2cti(const std::string& in_file, const std::string& thermo_file="",
699  const std::string& transport_file="",
700  const std::string& id_tag="gas");
701 
702 }
703 
704 // namespace alias for backward compatibility
705 namespace ctml = Cantera;
706 
707 #endif
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
void ct2ctml(const char *file, const int debug)
Convert a cti file into a ctml file.
Definition: ct2ctml.cpp:56
std::string ct2ctml_string(const std::string &file)
Get a string with the ctml representation of a cti file.
Definition: ct2ctml.cpp:173
std::string ct_string2ctml_string(const std::string &cti)
Get a string with the ctml representation of a cti input string.
Definition: ct2ctml.cpp:178
const double Undef
Fairly random number to be used to initialize variables against to see if they are subsequently defin...
Definition: ct_defs.h:157
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:180
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
void getString(const XML_Node &node, const std::string &titleString, std::string &valueString, std::string &typeString)
This function reads a child node with the name string with a specific title attribute named titleStri...
Definition: ctml.cpp:139
void getStringArray(const XML_Node &node, std::vector< std::string > &v)
This function interprets the value portion of an XML element as a string.
Definition: ctml.cpp:427
XML_Node * getByTitle(const XML_Node &node, const std::string &title)
Search the child nodes of the current node for an XML Node with a Title attribute of a given name.
Definition: ctml.cpp:122
doublereal getFloatCurrent(const XML_Node &node, const std::string &type)
Get a floating-point value from the current XML element.
Definition: ctml.cpp:177
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
Definition: ctml.cpp:164
bool getOptionalFloat(const XML_Node &parent, const std::string &name, doublereal &fltRtn, const std::string &type)
Get an optional floating-point value from a child element.
Definition: ctml.cpp:212
std::string getChildValue(const XML_Node &parent, const std::string &nameString)
This function reads a child node with the name, nameString, and returns its XML value as the return s...
Definition: ctml.cpp:131
void addFloat(XML_Node &node, const std::string &title, const doublereal val, const std::string &units, const std::string &type, const doublereal minval, const doublereal maxval)
This function adds a child node with the name, "float", with a value consisting of a single floating ...
Definition: ctml.cpp:19
void ck2cti(const std::string &in_file, const std::string &thermo_file, const std::string &transport_file, const std::string &id_tag)
Convert a Chemkin-format mechanism into a CTI file.
Definition: ct2ctml.cpp:183
bool getOptionalModel(const XML_Node &parent, const std::string &nodeName, std::string &modelName)
Get an optional model name from a named child node.
Definition: ctml.cpp:224
int getPairs(const XML_Node &node, std::vector< std::string > &key, std::vector< std::string > &val)
This function interprets the value portion of an XML element as a series of "Pairs" separated by whit...
Definition: ctml.cpp:344
int getInteger(const XML_Node &parent, const std::string &name)
Get an integer value from a child element.
Definition: ctml.cpp:234
size_t getFloatArray(const XML_Node &node, vector_fp &v, const bool convert, const std::string &unitsString, const std::string &nodeName)
This function reads the current node or a child node of the current node with the default name,...
Definition: ctml.cpp:256
void getMatrixValues(const XML_Node &node, const std::vector< std::string > &keyStringRow, const std::vector< std::string > &keyStringCol, Array2D &retnValues, const bool convert, const bool matrixSymmetric)
This function interprets the value portion of an XML element as a series of "Matrix ids and entries" ...
Definition: ctml.cpp:362
void addString(XML_Node &node, const std::string &titleString, const std::string &valueString, const std::string &typeString)
This function adds a child node with the name string with a string value to the current node.
Definition: ctml.cpp:111
void addFloatArray(XML_Node &node, const std::string &title, const size_t n, const doublereal *const vals, const std::string &units, const std::string &type, const doublereal minval, const doublereal maxval)
This function adds a child node with the name, "floatArray", with a value consisting of a comma separ...
Definition: ctml.cpp:40
void addNamedFloatArray(XML_Node &node, const std::string &name, const size_t n, const doublereal *const vals, const std::string units, const std::string type, const doublereal minval, const doublereal maxval)
This function adds a child node with the name given by the first parameter with a value consisting of...
Definition: ctml.cpp:73
void getIntegers(const XML_Node &node, std::map< std::string, int > &v)
Get a vector of integer values from a child element.
Definition: ctml.cpp:152
void getMap(const XML_Node &node, std::map< std::string, std::string > &m)
This routine is used to interpret the value portions of XML elements that contain colon separated pai...
Definition: ctml.cpp:330
Classes providing support for XML data files.