Cantera
2.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
converters
CKReader.h
Go to the documentation of this file.
1
/**
2
* @file CKReader.h
3
*
4
*/
5
6
// Copyright 2001 California Institute of Technology
7
8
#ifndef CKR_CKRREADER_H
9
#define CKR_CKRREADER_H
10
11
#include <fstream>
12
#include <iostream>
13
#include <string>
14
#include <map>
15
#include <vector>
16
17
#include "
CKParser.h
"
18
19
#include <string>
20
#include <vector>
21
22
namespace
ckr
23
{
24
25
class
Group
26
{
27
public
:
28
29
/// Construct a new empty Group object
30
Group() : name(
"<empty>"
), index(-1) {}
31
32
Group(
const
std::string& nm) : name(nm), index(-1) {}
33
34
/// Destructor
35
~Group() {}
36
37
std::string name;
//!< name
38
int
index;
//!< index number
39
std::map<std::string, double> comp;
//!< elemental composition
40
41
bool
operator==(
const
Group& g)
const
{
42
return
(name == g.name);
43
}
44
bool
operator!=(
const
Group& g)
const
{
45
return
!(*
this
== g);
46
}
47
};
48
49
/// a list (vector) of Groups
50
typedef
std::vector<Group>
groupList
;
51
52
53
/**
54
* Chemkin file reader class. Class CKReader parses and validates a file
55
* containing a description of a chemical reaction mechanism in Chemkin
56
* format. See the Examples section for examples of how CKReader is
57
* used in user programs.
58
*/
59
60
class
CKReader
61
{
62
public
:
63
64
/**
65
* Constructor. Construct a new CKReader instance. By default,
66
* validation is enabled, as well as verbose output to the log file.
67
*/
68
CKReader
() :
verbose
(true),
validate
(true),
debug
(false) {}
69
70
/// Destructor. Does nothing.
71
~CKReader
() {}
72
73
elementList
elements
;
///< a list of Element objects
74
speciesList
species
;
///< a list of Species objects
75
reactionList
reactions
;
///< a list of Reaction objects
76
groupList
groups
;
///< a list of Groups
77
speciesTable
speciesData
;
///< a map from species names to Species objects
78
ReactionUnits
units
;
///< reaction units
79
80
/**
81
* Read and optionally validate a Chemkin input file.
82
* @param inputFile path to the input file.
83
* @param thermoDatabase path to the species thermodynamic property database.
84
* If no database is required, enter a null string.
85
* @param logFile file to write logging and error messages to.
86
* @return true if no errors encountered, false otherwise.
87
*/
88
bool
read
(
const
std::string& inputFile,
89
const
std::string& thermoDatabase,
const
std::string& logFile);
90
91
void
write
(
string
outputFile);
///< not implemented.
92
93
bool
verbose
;
///< print detailed messages to log file
94
bool
validate
;
///< validate elements, species, and reaction
95
bool
debug
;
///< enable debugging output
96
97
private
:
98
99
// void validateElements(ostream& log);
100
bool
validateSpecies
(ostream& log);
///< validate the species.
101
bool
validateReactions
(ostream& log);
///< validate the reactions.
102
bool
writeReactions
(ostream& log);
103
};
104
105
106
bool
checkBalance
(ostream& f,
speciesTable
& speciesData,
reactionList
& r,
107
vector<int>& unbalanced,
double
tolerance=1.0e-3);
108
bool
checkThermo
(ostream& f,
speciesList
& species,
double
tol);
109
110
bool
filter(
const
string
& infile,
const
string
& database,
111
const
string
& outfile,
const
vector<int>& species,
const
vector<int>& reactions);
112
113
}
114
115
116
#endif
117
118
119
Generated by
1.8.2