1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Class to create, store and output qgraph files.
34 \*---------------------------------------------------------------------------*/
41 #include "HashPtrTable.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of friend functions and operators
53 Ostream& operator<<(Ostream&, const graph&);
56 /*---------------------------------------------------------------------------*\
57 Class graph Declaration
58 \*---------------------------------------------------------------------------*/
62 public HashPtrTable<curve>
82 friend bool operator==(const xy& a, const xy& b)
84 return equal(a.x_, b.x_) && equal(a.y_, b.y_);
87 friend bool operator!=(const xy& a, const xy& b)
92 friend Istream& operator>>(Istream& is, xy& xyd)
94 is >> xyd.x_ >> xyd.y_;
98 friend Ostream& operator<<(Ostream& os, const xy& xyd)
100 os << xyd.x_ << ' ' << xyd.y_;
106 // private member functions
108 void readCurves(Istream&);
115 //- Construct from title and labels (no curves)
124 //- Construct from title, labels and y data for 1 curve
130 const scalarField& x,
134 //- Construct from Istream given title and labels
143 //- Construct from Istream
151 const string& title() const
156 const string& xName() const
161 const string& yName() const
167 const scalarField& x() const
178 const scalarField& y() const;
185 //- Abstract base class for a graph writer
193 const scalarField& x,
194 const scalarField& y,
200 //- Runtime type information
203 //- Declare run-time constructor selection table
204 declareRunTimeSelectionTable
216 //- Return a reference to the selected writer
217 static autoPtr<writer> New
219 const word& writeFormat
240 //- Return the appropriate fileName extension
241 // for this graph format
242 virtual const word& ext() const = 0;
247 //- Write graph in appropriate format
248 virtual void write(const graph&, Ostream&) const = 0;
251 //- Write out graph data as a simple table
252 void writeTable(Ostream&) const;
254 //- Write graph to stream in given format
255 void write(Ostream&, const word& format) const;
257 //- Write graph to file in given format
258 void write(const fileName& fName, const word& format) const;
264 friend Ostream& operator<<(Ostream&, const graph&);
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 } // End namespace Foam
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 // ************************************************************************* //