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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::curve
28
29Description
30 A single curve in a graph.
31
32SourceFiles
33 curve.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef Foam_curve_H
38#define Foam_curve_H
39
40#include "string.H"
41#include "primitiveFields.H"
42#include "autoPtr.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49// Forward Declarations
50class curve;
51Ostream& operator<<(Ostream&, const curve&);
52
53
54/*---------------------------------------------------------------------------*\
55 Class curve Declaration
56\*---------------------------------------------------------------------------*/
58class curve
59:
60 public scalarField
61{
62public:
63
64 //- The style (line, symbol, etc) of a curve
65 class curveStyle
66 {
67 public:
68
69 //- Enumeration definitions
70 enum curveStyleNo
71 {
77 };
78
79
80 private:
81
82 //- Private data
83 curveStyleNo CurveStyleNo;
84
85
86 public:
87
88
89 // Constructors
90
91 //- Construct given a curveStyleNo
92 curveStyle(const curveStyleNo csn)
93 :
94 CurveStyleNo(csn)
95 {}
96
97 //- Construct from Istream
99 :
100 CurveStyleNo(curveStyleNo(readInt(is)))
101 {}
102
103
104 // Ostream operator
106 friend Ostream& operator<<(Ostream& os, const curveStyle& cs)
107 {
108 os << int(cs.CurveStyleNo);
109 return os;
110 }
111 };
112
113
114private:
115
116 // Private Data
117
118 string name_;
119
120 curveStyle style_;
121
122
123public:
124
125 // Constructors
126
127 //- Construct from name, style and size
128 curve
129 (
130 const string& name,
131 const curveStyle& style,
132 const label l
133 );
134
135 //- Construct from the components
136 curve
137 (
138 const string&,
139 const curveStyle&,
140 const scalarField& y
141 );
143 autoPtr<curve> clone() const
144 {
145 return autoPtr<curve>::New(*this);
146 }
147
148
149 // Member Functions
150
151 // Access
153 const string& name() const
154 {
155 return name_;
156 }
158 const curveStyle& style() const
159 {
160 return style_;
161 }
162
163
164 // Ostream operator
166 friend Ostream& operator<<(Ostream&, const curve&);
167};
168
169
170// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171
172} // End namespace Foam
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176#endif
177
178// ************************************************************************* //
scalar y
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
The style (line, symbol, etc) of a curve.
Definition: curve.H:65
friend Ostream & operator<<(Ostream &os, const curveStyle &cs)
Definition: curve.H:105
curveStyle(Istream &is)
Construct from Istream.
Definition: curve.H:97
curveStyle(const curveStyleNo csn)
Construct given a curveStyleNo.
Definition: curve.H:91
curveStyleNo
Enumeration definitions.
Definition: curve.H:70
A single curve in a graph.
Definition: curve.H:60
friend Ostream & operator<<(Ostream &, const curve &)
const curveStyle & style() const
Definition: curve.H:157
autoPtr< curve > clone() const
Definition: curve.H:142
const string & name() const
Definition: curve.H:152
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
int readInt(Istream &is)
Read int from stream.
Definition: intIO.C:80
Specialisations of Field<T> for scalar, vector and tensor.