fieldValue.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 | Copyright (C) 2011-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "fieldValue.H"
27 #include "Time.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace functionObjects
35 {
36  defineTypeNameAndDebug(fieldValue, 0);
37  defineRunTimeSelectionTable(fieldValue, dictionary);
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 (
46  const word& name,
47  const Time& runTime,
48  const dictionary& dict,
49  const word& valueType
50 )
51 :
52  writeFiles(name, runTime, dict, name),
53  dict_(dict),
54  regionName_(word::null),
55  resultDict_(fileName("name"), dictionary::null)
56 {
57  read(dict);
58  resetName(valueType);
59 }
60 
61 
63 (
64  const word& name,
65  const objectRegistry& obr,
66  const dictionary& dict,
67  const word& valueType
68 )
69 :
70  writeFiles(name, obr, dict, name),
71  dict_(dict),
72  regionName_(word::null),
73  resultDict_(fileName("name"), dictionary::null)
74 {
75  read(dict);
76  resetName(valueType);
77 }
78 
79 
80 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
81 
83 {}
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
89 {
90  dict_ = dict;
91  writeFiles::read(dict);
92 
93  dict.lookup("fields") >> fields_;
94  dict.lookup("writeFields") >> writeFields_;
95 
96  return true;
97 }
98 
99 
101 {
102  return true;
103 }
104 
105 
107 {
109 
110  Log << type() << " " << name() << " write:" << nl;
111 
112  return true;
113 }
114 
115 
116 // ************************************************************************* //
dictionary dict
virtual bool execute()
Execute.
Definition: fieldValue.C:100
A class for handling file names.
Definition: fileName.H:69
virtual ~fieldValue()
Destructor.
Definition: fieldValue.C:82
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
functionObject base class for writing files
Definition: writeFiles.H:56
static const dictionary null
Null dictionary.
Definition: dictionary.H:193
virtual bool read(const dictionary &dict)
Read from dictionary.
Definition: fieldValue.C:88
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Macros for easy insertion into run-time selection tables.
virtual bool read(const dictionary &)
Read optional controls.
bool read(const char *, int32_t &)
Definition: int32IO.C:85
fieldValue(const word &name, const Time &runTime, const dictionary &dict, const word &valueType)
Construct from Time and dictionary.
Definition: fieldValue.C:45
A class for handling words, derived from string.
Definition: word.H:59
static const word null
An empty word.
Definition: word.H:77
static const char nl
Definition: Ostream.H:262
defineRunTimeSelectionTable(fieldValue, dictionary)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:461
virtual bool write()
Write function.
Definition: writeFiles.C:197
#define Log
Report write to Foam::Info if the local log switch is true.
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
Registry of regIOobjects.
Namespace for OpenFOAM.
virtual bool write()
Write to screen/file.
Definition: fieldValue.C:106
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:451