1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Class to create, store and output qgraph files.
33 \*---------------------------------------------------------------------------*/
38 #include "foamString.H"
40 #include "HashPtrTable.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Forward declaration of friend functions and operators
52 Ostream& operator<<(Ostream&, const graph&);
55 /*---------------------------------------------------------------------------*\
56 Class graph Declaration
57 \*---------------------------------------------------------------------------*/
61 public HashPtrTable<curve>
81 friend bool operator==(const xy& a, const xy& b)
83 return equal(a.x_, b.x_) && equal(a.y_, b.y_);
86 friend bool operator!=(const xy& a, const xy& b)
91 friend Istream& operator>>(Istream& is, xy& xyd)
93 is >> xyd.x_ >> xyd.y_;
97 friend Ostream& operator<<(Ostream& os, const xy& xyd)
99 os << xyd.x_ << ' ' << xyd.y_;
105 // Private Member Functions
107 void readCurves(Istream&);
114 //- Construct from title and labels (no curves)
123 //- Construct from title, labels and y data for 1 curve
129 const scalarField& x,
133 //- Construct from Istream given title and labels
142 //- Construct from Istream
150 const string& title() const
155 const string& xName() const
160 const string& yName() const
166 const scalarField& x() const
177 const scalarField& y() const;
184 //- Abstract base class for a graph writer
192 const scalarField& x,
193 const scalarField& y,
199 //- Runtime type information
202 //- Declare run-time constructor selection table
203 declareRunTimeSelectionTable
214 //- Return a reference to the selected writer
215 static autoPtr<writer> New
217 const word& writeFormat
238 //- Return the appropriate fileName extension
239 // for this graph format
240 virtual const word& ext() const = 0;
245 //- Write graph in appropriate format
246 virtual void write(const graph&, Ostream&) const = 0;
249 //- Write out graph data as a simple table
250 void writeTable(Ostream&) const;
252 //- Write graph to stream in given format
253 void write(Ostream&, const word& format) const;
255 //- Write graph to file in given format
256 void write(const fileName& fName, const word& format) const;
262 friend Ostream& operator<<(Ostream&, const graph&);
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268 } // End namespace Foam
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
274 // ************************************************************************* //