fieldDictionary.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) 2011-2015 OpenFOAM Foundation
9 Copyright (C) 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
27Class
28 Foam::fieldDictionary
29
30Description
31 Read field as dictionary (without mesh).
32
33\*---------------------------------------------------------------------------*/
34
35#ifndef fieldDictionary_H
36#define fieldDictionary_H
37
38#include "regIOobject.H"
39#include "dictionary.H"
40
41// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42
43namespace Foam
44{
45
46/*---------------------------------------------------------------------------*\
47 Class fieldDictionary Declaration
48\*---------------------------------------------------------------------------*/
51:
52 public regIOobject,
53 public dictionary
54{
55
56 // Private Data
57
58 const word type_;
59
60
61public:
62
63 // Constructors
64
65 //- Construct from ioobject and overloaded typename.
66 fieldDictionary(const IOobject& io, const word& type)
67 :
70 type_(type)
71 {
72 close();
73 }
74
75
76 // Member Functions
77
78 //- Redefine type name to be of the instantiated type
79 virtual const word& type() const
80 {
81 return type_;
82 }
84 bool writeData(Ostream& os) const
85 {
86 static_cast<const dictionary&>(*this).write(os, false);
87
88 return os.good();
89 }
90};
91
92
93// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94
95} // End namespace Foam
96
97// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98
99#endif
100
101// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
bool good() const noexcept
True if next operation might succeed.
Definition: IOstream.H:233
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
void write(Ostream &os, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
Definition: dictionaryIO.C:206
Read field as dictionary (without mesh).
fieldDictionary(const IOobject &io, const word &type)
Construct from ioobject and overloaded typename.
bool writeData(Ostream &os) const
Pure virtual writeData function.
virtual const word & type() const
Redefine type name to be of the instantiated type.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
void close()
Close Istream.
Istream & readStream(const word &, const bool valid=true)
Return Istream and check object type against that given.
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.