FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::curve
00026 
00027 Description
00028     A single curve in a graph.
00029 
00030 SourceFiles
00031     curve.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef curve_H
00036 #define curve_H
00037 
00038 #include <OpenFOAM/string.H>
00039 #include <OpenFOAM/primitiveFields.H>
00040 #include <OpenFOAM/autoPtr.H>
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 // Forward declaration of friend functions and operators
00048 
00049 class curve;
00050 Ostream& operator<<(Ostream&, const curve&);
00051 
00052 
00053 /*---------------------------------------------------------------------------*\
00054                            Class curve Declaration
00055 \*---------------------------------------------------------------------------*/
00056 
00057 class curve
00058 :
00059     public scalarField
00060 {
00061 
00062 public:
00063 
00064     //- The style (line, symbol, etc) of a curve
00065     class curveStyle
00066     {
00067 
00068     public:
00069 
00070         //- Enumeration definitions
00071         enum curveStyleNo
00072         {
00073             CONTINUOUS,
00074             SYMBOL,
00075             SYMBOL_CURVE,
00076             SYMBOL_WITH_ERROR_BARS,
00077             SYMBOL_WITH_VARIABLE_SIZE
00078         };
00079         
00080 
00081     private:
00082 
00083         //- Private data
00084         curveStyleNo CurveStyleNo;
00085 
00086 
00087     public:
00088 
00089 
00090         // Constructors
00091 
00092             //- Construct given a curveStyleNo
00093             curveStyle(const curveStyleNo csn)
00094             :
00095                 CurveStyleNo(csn)
00096             {}
00097 
00098             //- Construct from Istream
00099             curveStyle(Istream& is)
00100             :
00101                 CurveStyleNo(curveStyleNo(readInt(is)))
00102             {}
00103 
00104 
00105         // Ostream operator
00106 
00107             friend Ostream& operator<<(Ostream& os, const curveStyle& cs)
00108             {
00109                 os << int(cs.CurveStyleNo);
00110                 return os;
00111             }
00112     };
00113 
00114 
00115 private:
00116 
00117     // private data
00118 
00119         string name_;
00120         curveStyle style_;
00121 
00122 
00123 public:
00124 
00125     // Constructors
00126 
00127         //- Construct as interpolation of an existing curve
00128         //curve(const curve&, const label);
00129 
00130         //- Construct from name, style and size
00131         curve
00132         (
00133             const string& name,
00134             const curveStyle& style,
00135             const label l
00136         );
00137 
00138         //- Construct from the components
00139         curve
00140         (
00141             const string&,
00142             const curveStyle&,
00143             const scalarField& y
00144         );
00145 
00146         autoPtr<curve> clone() const
00147         {
00148             return autoPtr<curve>(new curve(*this));
00149         }
00150 
00151 
00152     // Member functions
00153 
00154         // Access
00155 
00156             const string& name() const
00157             {
00158                 return name_;
00159             }
00160 
00161             const curveStyle& style() const
00162             {
00163                 return style_;
00164             }
00165 
00166 
00167     // Friend functions
00168 
00169         //- Gradient of the curve
00170         //friend curve grad(const curve&);
00171 
00172 
00173     // Ostream operator
00174 
00175         friend Ostream& operator<<(Ostream&, const curve&);
00176 };
00177 
00178 
00179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00180 
00181 } // End namespace Foam
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 #endif
00186 
00187 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines