Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
db
scalarRange
scalarRange.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
11
OpenFOAM is free software: you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Class
25
Foam::scalarRange
26
27
Description
28
A scalar range specifier.
29
30
The range selector can be specified as an "LOWER:UPPER" range, as a
31
"LOWER:" bound, as an ":UPPER" bound or simply as an "EXACT" value.
32
The read constructor uses a colon (:) as a range marker and a comma (,)
33
to delimit the next possible range selector.
34
35
SourceFiles
36
scalarRange.C
37
38
\*---------------------------------------------------------------------------*/
39
#ifndef scalarRange_H
40
#define scalarRange_H
41
42
#include <
OpenFOAM/scalar.H
>
43
44
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46
namespace
Foam
47
{
48
49
// Forward declaration of classes
50
class
Istream;
51
class
Ostream;
52
53
// Forward declaration of friend functions and operators
54
class
scalarRange;
55
Istream&
operator>>
(Istream&, scalarRange&);
56
Ostream&
operator<<
(Ostream&,
const
scalarRange&);
57
58
59
/*---------------------------------------------------------------------------*\
60
Class scalarRange Declaration
61
\*---------------------------------------------------------------------------*/
62
63
class
scalarRange
64
{
65
//- Enumeration defining the types of token
66
enum
rangeType
67
{
68
EMPTY = 0,
69
EXACT,
70
LOWER,
71
UPPER,
72
RANGE
73
};
74
75
76
// Private data
77
78
enum
rangeType type_;
79
scalar value_;
80
scalar value2_;
81
82
83
public
:
84
85
static
int
debug
;
86
87
88
// Constructors
89
90
//- Construct Null
91
scalarRange
();
92
93
//- Construct a Range
94
scalarRange
(
const
scalar&
lower
,
const
scalar&
upper
);
95
96
//- Construct from Istream.
97
// Since commas can be used as list delimiters,
98
// leading and trailing commas are ignored.
99
scalarRange
(
Istream
&);
100
101
102
// Member Functions
103
104
//- Is the range non-empty?
105
bool
isDefined
()
const
;
106
107
//- Is the range 'EXACT'?
108
bool
isExact
()
const
;
109
110
//- The value constituting an 'EXACT' match
111
// or the values for 'UPPER' or 'LOWER' limits
112
scalar
value
()
const
;
113
114
//- The lower limit
115
scalar
lower
()
const
;
116
117
//- The upper limit
118
scalar
upper
()
const
;
119
120
//- Return true if the value is within the range
121
bool
selected
(
const
scalar&)
const
;
122
123
124
// Member Operators
125
126
bool
operator==
(
const
scalarRange
&)
const
;
127
bool
operator!=
(
const
scalarRange
&)
const
;
128
129
130
// IOstream Operators
131
132
friend
Istream
&
operator>>
(
Istream
&,
scalarRange
&);
133
friend
Ostream
&
operator<<
(
Ostream
&,
const
scalarRange
&);
134
};
135
136
137
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139
}
// End namespace Foam
140
141
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142
143
#endif
144
145
// ************************ vim: set sw=4 sts=4 et: ************************ //