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