Loading...
Searching...
No Matches
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
9 Copyright (C) 2019-2022 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"
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34namespace Foam
35{
36namespace expressions
37{
41 (
45 );
47 (
50 empty
51 );
53} // End namespace expressions
54} // End namespace Foam
55
56
57// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58
62 name_("none"),
63 startExpr_()
64{}
65
66
68(
70)
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_("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");
101 os.endBlock();
102}
103
104
105// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
106
107void Foam::expressions::exprResultStored::operator=
108(
109 const exprResultStored& rhs
110)
111{
112 if (this == &rhs)
113 {
114 return; // Self-assignment is a no-op
115 }
116
118
119 name_ = rhs.name_;
120 startExpr_ = rhs.startExpr_;
121}
122
123
124void Foam::expressions::exprResultStored::operator=
125(
126 const exprResult& rhs
127)
128{
129 if (this == &rhs)
130 {
131 return; // Self-assignment is a no-op
132 }
135}
136
137
138// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
139
140Foam::Istream& Foam::operator>>
141(
142 Istream& is,
143 expressions::exprResultStored& data
144)
145{
148
149 return is;
150}
151
152
153Foam::Ostream& Foam::operator<<
154(
155 Ostream& os,
156 const expressions::exprResultStored& data
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:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
An exprResult with persistence.
A polymorphic field/result from evaluating an expression.
Definition exprResult.H:122
virtual void operator=(const exprResult &rhs)
Copy assignment.
Definition exprResult.C:467
exprResult()
Default construct.
Definition exprResult.C:173
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeName(Type)
Define the typeName.
Definition className.H:113
OBJstream os(runTime.globalPath()/outputName)
A namespace for expression-related classes/traits etc.
Namespace for OpenFOAM.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
dictionary dict