curve.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::curve
28 
29 Description
30  A single curve in a graph.
31 
32 SourceFiles
33  curve.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef curve_H
38 #define curve_H
39 
40 #include "string.H"
41 #include "primitiveFields.H"
42 #include "autoPtr.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of friend functions and operators
50 
51 class curve;
52 Ostream& operator<<(Ostream&, const curve&);
53 
54 
55 /*---------------------------------------------------------------------------*\
56  Class curve Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class curve
60 :
61  public scalarField
62 {
63 
64 public:
65 
66  //- The style (line, symbol, etc) of a curve
67  class curveStyle
68  {
69 
70  public:
71 
72  //- Enumeration definitions
73  enum curveStyleNo
74  {
80  };
81 
82 
83  private:
84 
85  //- Private data
86  curveStyleNo CurveStyleNo;
87 
88 
89  public:
90 
91 
92  // Constructors
93 
94  //- Construct given a curveStyleNo
95  curveStyle(const curveStyleNo csn)
96  :
97  CurveStyleNo(csn)
98  {}
99 
100  //- Construct from Istream
101  curveStyle(Istream& is)
102  :
103  CurveStyleNo(curveStyleNo(readInt(is)))
104  {}
105 
106 
107  // Ostream operator
108 
109  friend Ostream& operator<<(Ostream& os, const curveStyle& cs)
110  {
111  os << int(cs.CurveStyleNo);
112  return os;
113  }
114  };
115 
116 
117 private:
118 
119  // private data
120 
121  string name_;
122  curveStyle style_;
123 
124 
125 public:
126 
127  // Constructors
128 
129  //- Construct as interpolation of an existing curve
130  //curve(const curve&, const label);
131 
132  //- Construct from name, style and size
133  curve
134  (
135  const string& name,
136  const curveStyle& style,
137  const label l
138  );
139 
140  //- Construct from the components
141  curve
142  (
143  const string&,
144  const curveStyle&,
145  const scalarField& y
146  );
147 
148  autoPtr<curve> clone() const
149  {
150  return autoPtr<curve>::New(*this);
151  }
152 
153 
154  // Member functions
155 
156  // Access
157 
158  const string& name() const
159  {
160  return name_;
161  }
162 
163  const curveStyle& style() const
164  {
165  return style_;
166  }
167 
168 
169  // Friend functions
170 
171  //- Gradient of the curve
172  //friend curve grad(const curve&);
173 
174 
175  // Ostream operator
176 
177  friend Ostream& operator<<(Ostream&, const curve&);
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::curve::curveStyle::SYMBOL_WITH_ERROR_BARS
Definition: curve.H:77
string.H
primitiveFields.H
Specialisations of Field<T> for scalar, vector and tensor.
Foam::curve::clone
autoPtr< curve > clone() const
Definition: curve.H:147
Foam::curve::curveStyle::curveStyleNo
curveStyleNo
Enumeration definitions.
Definition: curve.H:72
Foam::curve::curveStyle::curveStyle
curveStyle(Istream &is)
Construct from Istream.
Definition: curve.H:100
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::curve::operator<<
friend Ostream & operator<<(Ostream &, const curve &)
Gradient of the curve.
Foam::Field< scalar >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::curve::curve
curve(const string &name, const curveStyle &style, const label l)
Construct as interpolation of an existing curve.
Definition: curve.C:34
Foam::curve::curveStyle::operator<<
friend Ostream & operator<<(Ostream &os, const curveStyle &cs)
Definition: curve.H:108
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::curve::curveStyle
The style (line, symbol, etc) of a curve.
Definition: curve.H:66
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::curve::curveStyle::SYMBOL
Definition: curve.H:75
Foam::curve::curveStyle::SYMBOL_WITH_VARIABLE_SIZE
Definition: curve.H:78
Foam::curve::curveStyle::CONTINUOUS
Definition: curve.H:74
Foam::curve::curveStyle::curveStyle
curveStyle(const curveStyleNo csn)
Construct given a curveStyleNo.
Definition: curve.H:94
Foam::curve::style
const curveStyle & style() const
Definition: curve.H:162
Foam::curve::curveStyle::SYMBOL_CURVE
Definition: curve.H:76
Foam::curve
A single curve in a graph.
Definition: curve.H:58
Foam::curve::name
const string & name() const
Definition: curve.H:157
Foam::readInt
int readInt(Istream &is)
Read int from stream.
Definition: intIO.C:80
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
y
scalar y
Definition: LISASMDCalcMethod1.H:14
autoPtr.H