OpenFOAM logo
Open Source CFD Toolkit

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-2005 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     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 /*---------------------------------------------------------------------------*\
00049                            Class curve Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 class curve
00053 :
00054     public scalarField
00055 {
00056 
00057 public:
00058 
00059     class curveStyle
00060     {
00061 
00062     public:
00063 
00064         //- Enumeration definitions
00065         enum curveStyleNo
00066         {
00067             CONTINUOUS,
00068             SYMBOL,
00069             SYMBOL_CURVE,
00070             SYMBOL_WITH_ERROR_BARS,
00071             SYMBOL_WITH_VARIABLE_SIZE
00072         };
00073         
00074 
00075     private:
00076 
00077         //- Private data
00078         curveStyleNo CurveStyleNo;
00079 
00080 
00081     public:
00082 
00083 
00084         // Constructors
00085 
00086             //- Construct given a curveStyleNo
00087             curveStyle(const curveStyleNo csn)
00088             :
00089                 CurveStyleNo(csn)
00090             {}
00091 
00092             //- Construct from Istream
00093             curveStyle(Istream& is)
00094             :
00095                 CurveStyleNo(curveStyleNo(readInt(is)))
00096             {}
00097 
00098 
00099         // Ostream operator
00100 
00101             friend Ostream& operator<<(Ostream& os, const curveStyle& cs)
00102             {
00103                 os << int(cs.CurveStyleNo);
00104                 return os;
00105             }
00106     };
00107 
00108 
00109 private:
00110 
00111     // private data
00112 
00113         string name_;
00114         curveStyle style_;
00115 
00116 
00117 public:
00118 
00119     // Constructors
00120 
00121         //- Construct as interpolation of an existing curve
00122         //curve(const curve&, const label);
00123 
00124         //- Construct from name, style and size
00125         curve
00126         (
00127             const string& name,
00128             const curveStyle& style,
00129             const label l
00130         );
00131 
00132         //- Construct from the components
00133         curve
00134         (
00135             const string&,
00136             const curveStyle&,
00137             const scalarField& y
00138         );
00139 
00140         autoPtr<curve> clone() const
00141         {
00142             return autoPtr<curve>(new curve(*this));
00143         }
00144 
00145 
00146     // Member functions
00147 
00148         // Access
00149 
00150             const string& name() const
00151             {
00152                 return name_;
00153             }
00154 
00155             const curveStyle& style() const
00156             {
00157                 return style_;
00158             }
00159 
00160 
00161     // Friend functions
00162 
00163         //- Gradient of the curve
00164         //friend curve grad(const curve&);
00165 
00166 
00167     // Ostream operator
00168 
00169         friend Ostream& operator<<(Ostream&, const curve&);
00170 };
00171 
00172 
00173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00174 
00175 } // End namespace Foam
00176 
00177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00178 
00179 #endif
00180 
00181 // ************************************************************************* //
For further information go to www.openfoam.org