OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

curve.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::curve
00027 
00028 Description
00029     A single curve in a graph.
00030 
00031 SourceFiles
00032     curve.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef curve_H
00037 #define curve_H
00038 
00039 #include "string.H"
00040 #include "primitiveFields.H"
00041 #include "autoPtr.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 // Forward declaration of friend functions and operators
00049 
00050 class curve;
00051 Ostream& operator<<(Ostream&, const curve&);
00052 
00053 
00054 /*---------------------------------------------------------------------------*\
00055                            Class curve Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 class curve
00059 :
00060     public scalarField
00061 {
00062 
00063 public:
00064 
00065     //- The style (line, symbol, etc) of a curve
00066     class curveStyle
00067     {
00068 
00069     public:
00070 
00071         //- Enumeration definitions
00072         enum curveStyleNo
00073         {
00074             CONTINUOUS,
00075             SYMBOL,
00076             SYMBOL_CURVE,
00077             SYMBOL_WITH_ERROR_BARS,
00078             SYMBOL_WITH_VARIABLE_SIZE
00079         };
00080         
00081 
00082     private:
00083 
00084         //- Private data
00085         curveStyleNo CurveStyleNo;
00086 
00087 
00088     public:
00089 
00090 
00091         // Constructors
00092 
00093             //- Construct given a curveStyleNo
00094             curveStyle(const curveStyleNo csn)
00095             :
00096                 CurveStyleNo(csn)
00097             {}
00098 
00099             //- Construct from Istream
00100             curveStyle(Istream& is)
00101             :
00102                 CurveStyleNo(curveStyleNo(readInt(is)))
00103             {}
00104 
00105 
00106         // Ostream operator
00107 
00108             friend Ostream& operator<<(Ostream& os, const curveStyle& cs)
00109             {
00110                 os << int(cs.CurveStyleNo);
00111                 return os;
00112             }
00113     };
00114 
00115 
00116 private:
00117 
00118     // private data
00119 
00120         string name_;
00121         curveStyle style_;
00122 
00123 
00124 public:
00125 
00126     // Constructors
00127 
00128         //- Construct as interpolation of an existing curve
00129         //curve(const curve&, const label);
00130 
00131         //- Construct from name, style and size
00132         curve
00133         (
00134             const string& name,
00135             const curveStyle& style,
00136             const label l
00137         );
00138 
00139         //- Construct from the components
00140         curve
00141         (
00142             const string&,
00143             const curveStyle&,
00144             const scalarField& y
00145         );
00146 
00147         autoPtr<curve> clone() const
00148         {
00149             return autoPtr<curve>(new curve(*this));
00150         }
00151 
00152 
00153     // Member functions
00154 
00155         // Access
00156 
00157             const string& name() const
00158             {
00159                 return name_;
00160             }
00161 
00162             const curveStyle& style() const
00163             {
00164                 return style_;
00165             }
00166 
00167 
00168     // Friend functions
00169 
00170         //- Gradient of the curve
00171         //friend curve grad(const curve&);
00172 
00173 
00174     // Ostream operator
00175 
00176         friend Ostream& operator<<(Ostream&, const curve&);
00177 };
00178 
00179 
00180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00181 
00182 } // End namespace Foam
00183 
00184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00185 
00186 #endif
00187 
00188 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd