1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
28 Class to create, store and output qgraph files.
33 \*---------------------------------------------------------------------------*/
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
215 //- Return a reference to the selected writer
216 static autoPtr<writer> New
218 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 path-name and format
256 void write(const fileName& pName, const word& format) const;
258 //- Write graph to file in given path, name and format
261 const fileName& path,
270 friend Ostream& operator<<(Ostream&, const graph&);
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 } // End namespace Foam
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 // ************************************************************************* //