fvExprDriverWriter.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) 2010-2018 Bernhard Gschaider
9 Copyright (C) 2019-2021 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 "fvExprDriverWriter.H"
30#include "fvExprDriver.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
36namespace expressions
37{
38
40
41} // namespace expressions
42} // namespace Foam
43
44
45// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46
48(
49 const word& name,
50 fvExprDriver& driver
51)
52:
54 (
56 (
57 name,
58 driver.mesh().time().timeName(),
59 "expressions",
60 driver.mesh().time(),
61 IOobject::READ_IF_PRESENT,
62 IOobject::AUTO_WRITE
63 )
64 ),
65 driver_(driver)
66{
67 if (headerOk())
68 {
69 readData(readStream("fvExprDriverWriter", true));
70 }
71}
72
73
74// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75
77{
78 dictionary dict(is);
79
80 // driver_.readDict(is);
81
82 driver_.getData(dict);
83
84 return !is.bad();
85}
86
87
89{
90 // driver_.writeDict(os);
91
93 driver_.prepareData(dict);
94 dict.write(os, false);
95
96 return os.good();
97}
98
99
100// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
bool bad() const noexcept
True if stream is corrupted.
Definition: IOstream.H:251
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
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Registered input/output for an expressions::fvExprDriver.
virtual bool writeData(Ostream &os) const
Pure virtual writeData function.
virtual bool readData(Istream &is)
Virtual readData function.
Base driver for parsing value expressions associated with an fvMesh.
Definition: fvExprDriver.H:139
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
Istream & readStream(const word &, const bool valid=true)
Return Istream and check object type against that given.
bool headerOk()
Read and check header info. Does not check the headerClassName.
Definition: regIOobject.C:438
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeName(Type)
Define the typeName.
Definition: className.H:96
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
word timeName
Definition: getTimeIndex.H:3
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
dictionary dict