14 const std::string& plotTitle,
15 const std::vector<std::string> &names,
18 ofstream f(fname.c_str());
20 throw CanteraError(
"writePlotFile",
"could not open file "+fname+
26 }
else if (fmt ==
"XL" || fmt ==
"CSV") {
31 "unsupported plot type:" + fmt);
35 void outputTEC(std::ostream& s,
const std::string& title,
36 const std::vector<std::string>& names,
40 int npts =
static_cast<int>(data.
nColumns());
41 int nv =
static_cast<int>(data.
nRows());
42 s <<
"TITLE = \"" + title +
"\"" << endl;
43 s <<
"VARIABLES = " << endl;
44 for (i = 0; i < nv; i++) {
45 s <<
"\"" << names[i] <<
"\"" << endl;
47 s <<
"ZONE T=\"zone1\"" << endl;
48 s <<
" I=" << npts <<
",J=1,K=1,F=POINT" << endl;
50 for (i = 0; i < nv; i++) {
54 for (i = 0; i < npts; i++) {
55 for (j = 0; j < nv; j++) {
56 s << data(j,i) <<
" ";
63 const std::vector<std::string>& names,
67 int npts =
static_cast<int>(data.
nColumns());
68 int nv =
static_cast<int>(data.
nRows());
69 s << title +
"," << endl;
70 for (i = 0; i < nv; i++) {
77 for (i = 0; i < npts; i++) {
78 for (j = 0; j < nv; j++) {
size_t nRows() const
Number of rows.
Contains declarations for utility functions for outputing to plotting programs.
void writePlotFile(const std::string &fname, const std::string &fmt, const std::string &plotTitle, const std::vector< std::string > &names, const Array2D &data)
Write a Plotting file.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
void outputExcel(std::ostream &s, const std::string &title, const std::vector< std::string > &names, const Array2D &data)
Write an Excel spreadsheet in 'csv' form.
size_t nColumns() const
Number of columns.
Base class for exceptions thrown by Cantera classes.
void outputTEC(std::ostream &s, const std::string &title, const std::vector< std::string > &names, const Array2D &data)
Write a Tecplot data file.