exprResultStored.C
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-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
28
29#include "exprResultStored.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
36namespace expressions
37{
39
41 (
45 );
47 (
50 empty
51 );
52
53} // End namespace expressions
54} // End namespace Foam
55
56
57// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58
60:
61 expressions::exprResult(),
62 name_("none"),
63 startExpr_()
64{}
65
66
68(
69 const exprResultStored& rhs
70)
71:
72 expressions::exprResult(rhs),
73 name_(rhs.name_),
74 startExpr_(rhs.startExpr_)
75{}
76
77
79(
80 const dictionary& dict
81)
82:
83 expressions::exprResult(dict.subOrEmptyDict("value")),
84 name_(dict.get<word>("name")),
85 startExpr_(dict.get<string>("initialValue"), dict)
86{}
87
88
89// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
90
92{
93 os.beginBlock();
94
95 os.writeEntry("name", name_);
96 os.writeEntry("initialValue", startExpr_);
97
98 os.writeKeyword("value");
99 os << static_cast<const exprResult&>(*this);
100
101 os.endBlock();
102}
103
104
105// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
106
108(
109 const exprResultStored& rhs
110)
111{
112 if (this == &rhs)
113 {
114 return; // Self-assignment is a no-op
115 }
116
117 this->exprResult::operator=(rhs);
118
119 name_ = rhs.name_;
120 startExpr_ = rhs.startExpr_;
121}
122
123
125(
126 const exprResult& rhs
127)
128{
129 if (this == &rhs)
130 {
131 return; // Self-assignment is a no-op
132 }
133
134 this->exprResult::operator=(rhs);
135}
136
137
138// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
139
140Foam::Istream& Foam::operator>>
141(
142 Istream& is,
144)
145{
146 dictionary dict(is);
148
149 return is;
150}
151
152
153Foam::Ostream& Foam::operator<<
154(
155 Ostream& os,
157)
158{
159 data.writeDict(os);
160
161 return os;
162}
163
164
165// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
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
Database for solution data, solver performance and other reduced data.
Definition: data.H:58
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
An exprResult with persistence.
A polymorphic field/result from evaluating an expression.
Definition: exprResult.H:127
virtual void operator=(const exprResult &rhs)
Copy assignment.
Definition: exprResult.C:498
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
Foam::dictionary writeDict() const
Write to dictionary.
A class for handling character strings derived from std::string.
Definition: string.H:79
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeName(Type)
Define the typeName.
Definition: className.H:96
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dictionary dict