graph.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef graph_H
00037 #define graph_H
00038
00039 #include "string.H"
00040 #include "point.H"
00041 #include "HashPtrTable.H"
00042 #include "curve.H"
00043
00044
00045
00046 namespace Foam
00047 {
00048
00049
00050
00051 class graph;
00052
00053 Ostream& operator<<(Ostream&, const graph&);
00054
00055
00056
00057
00058
00059
00060 class graph
00061 :
00062 public HashPtrTable<curve>
00063 {
00064
00065
00066 string title_;
00067 string xName_;
00068 string yName_;
00069
00070 scalarField x_;
00071
00072
00073 struct xy
00074 {
00075 scalar x_, y_;
00076
00077 xy()
00078 {}
00079
00080
00081
00082 friend bool operator==(const xy& a, const xy& b)
00083 {
00084 return equal(a.x_, b.x_) && equal(a.y_, b.y_);
00085 }
00086
00087 friend bool operator!=(const xy& a, const xy& b)
00088 {
00089 return !(a == b);
00090 }
00091
00092 friend Istream& operator>>(Istream& is, xy& xyd)
00093 {
00094 is >> xyd.x_ >> xyd.y_;
00095 return is;
00096 }
00097
00098 friend Ostream& operator<<(Ostream& os, const xy& xyd)
00099 {
00100 os << xyd.x_ << ' ' << xyd.y_;
00101 return os;
00102 }
00103 };
00104
00105
00106
00107
00108 void readCurves(Istream&);
00109
00110
00111 public:
00112
00113
00114
00115
00116 graph
00117 (
00118 const string& title,
00119 const string& xName,
00120 const string& yName,
00121 const scalarField& x
00122 );
00123
00124
00125 graph
00126 (
00127 const string& title,
00128 const string& xName,
00129 const string& yName,
00130 const scalarField& x,
00131 const scalarField& y
00132 );
00133
00134
00135 graph
00136 (
00137 const string& title,
00138 const string& xName,
00139 const string& yName,
00140 Istream& is
00141 );
00142
00143
00144 graph(Istream& is);
00145
00146
00147
00148
00149
00150
00151 const string& title() const
00152 {
00153 return title_;
00154 }
00155
00156 const string& xName() const
00157 {
00158 return xName_;
00159 }
00160
00161 const string& yName() const
00162 {
00163 return yName_;
00164 }
00165
00166
00167 const scalarField& x() const
00168 {
00169 return x_;
00170 }
00171
00172 scalarField& x()
00173 {
00174 return x_;
00175 }
00176
00177
00178 const scalarField& y() const;
00179
00180 scalarField& y();
00181
00182
00183
00184
00185
00186 class writer
00187 {
00188
00189 protected:
00190
00191 void writeXY
00192 (
00193 const scalarField& x,
00194 const scalarField& y,
00195 Ostream&
00196 ) const;
00197
00198 public:
00199
00200
00201 TypeName("writer");
00202
00203
00204 declareRunTimeSelectionTable
00205 (
00206 autoPtr,
00207 writer,
00208 word,
00209 (),
00210 ()
00211 );
00212
00213
00214
00215
00216
00217 static autoPtr<writer> New
00218 (
00219 const word& writeFormat
00220 );
00221
00222
00223
00224
00225
00226 writer()
00227 {}
00228
00229
00230
00231
00232 virtual ~writer()
00233 {}
00234
00235
00236
00237
00238
00239
00240
00241
00242 virtual const word& ext() const = 0;
00243
00244
00245
00246
00247
00248 virtual void write(const graph&, Ostream&) const = 0;
00249 };
00250
00251
00252 void writeTable(Ostream&) const;
00253
00254
00255 void write(Ostream&, const word& format) const;
00256
00257
00258 void write(const fileName& fName, const word& format) const;
00259
00260
00261
00262
00263
00264 friend Ostream& operator<<(Ostream&, const graph&);
00265 };
00266
00267
00268
00269
00270 }
00271
00272
00273
00274 #endif
00275
00276
Copyright © 2000-2009 OpenCFD Ltd