exprResultStored.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) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::expressions::exprResultStored
29 
30 Description
31  An exprResult with persistence.
32 
33  \heading Dictionary parameters
34  \table
35  Property | Description | Required | Default
36  name | The result name | yes |
37  initialValue | The initial value | yes |
38  value | The expression result (dictionary) | no |
39  \endtable
40 
41 SourceFiles
42  StoredExpressionResult.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef expressions_exprResultStored_H
47 #define expressions_exprResultStored_H
48 
49 #include "exprResult.H"
50 #include "exprString.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 namespace expressions
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class exprResultStored Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class exprResultStored
64 :
65  public expressions::exprResult
66 {
67  // Private Data
68 
69  //- The name of the expression
70  word name_;
71 
72  //- The initial value expression
73  expressions::exprString startExpr_;
74 
75 
76 protected:
77 
78  // Protected Member Functions
79 
80  //- Reset at new timestep - disabling locally
81  virtual void resetImpl() {}
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeNameNoDebug("exprResultStored");
88 
89 
90  // Constructors
91 
92  //- Default construct
94 
95  //- Copy construct
97 
98  //- Construct from a dictionary
99  explicit exprResultStored(const dictionary& dict);
100 
101 
102  // Selectors
103 
104  virtual autoPtr<exprResult> clone() const
105  {
106  return autoPtr<exprResult>
107  (
108  new exprResultStored(*this)
109  );
110  }
111 
112 
113  //- Destructor
114  virtual ~exprResultStored() = default;
115 
116 
117  // Member Functions
118 
119  //- The name of the expression
120  const word& name() const
121  {
122  return name_;
123  }
124 
125  //- The initial value expression
127  {
128  return startExpr_;
129  }
130 
131 
132  void writeDict(Ostream& os) const;
133 
134 
135  // Member Operators
136 
137  //- Copy assignment
138  void operator=(const exprResultStored& rhs);
139 
140  //- Copy assignment
141  void operator=(const exprResult& rhs);
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace expressions
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 // IO Operators
154 
155 // Comparison
156 inline bool operator!=
157 (
160 )
161 {
162  return (&a != &b);
163 }
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::expressions::exprResultStored::name
const word & name() const
The name of the expression.
Definition: exprResultStored.H:139
Foam::expressions::exprResultStored::initialValueExpression
const expressions::exprString & initialValueExpression() const
The initial value expression.
Definition: exprResultStored.H:145
exprString.H
Foam::expressions::exprResultStored::operator=
void operator=(const exprResultStored &rhs)
Copy assignment.
Definition: exprResultStored.C:108
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::expressions::exprResult
A polymorphic field/result from evaluating an expression.
Definition: exprResult.H:124
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::expressions::exprResultStored::resetImpl
virtual void resetImpl()
Reset at new timestep - disabling locally.
Definition: exprResultStored.H:100
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::expressions::exprResultStored
An exprResult with persistence.
Definition: exprResultStored.H:82
Foam::expressions::exprResultStored::~exprResultStored
virtual ~exprResultStored()=default
Destructor.
Foam::expressions::exprResultStored::writeDict
void writeDict(Ostream &os) const
Definition: exprResultStored.C:91
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::expressions::exprString
Definition: exprString.H:60
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::expressions::exprResultStored::clone
virtual autoPtr< exprResult > clone() const
Clone.
Definition: exprResultStored.H:123
Foam::expressions::exprResultStored::exprResultStored
exprResultStored()
Default construct.
Definition: exprResultStored.C:59
Foam::expressions::exprResultStored::TypeNameNoDebug
TypeNameNoDebug("exprResultStored")
Runtime type information.
exprResult.H
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55