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  fvMeshFunctionObject(name, runTime, dict),
53  logFiles(obr_, name),
54  dict_(dict),
55  regionName_(word::null),
56  resultDict_(fileName("name"), dictionary::null)
57 {
58  read(dict);
59  resetName(valueType);
60 }
61 
62 
64 (
65  const word& name,
66  const objectRegistry& obr,
67  const dictionary& dict,
68  const word& valueType
69 )
70 :
71  fvMeshFunctionObject(name, obr, dict),
72  logFiles(obr_, name),
73  dict_(dict),
74  regionName_(word::null),
75  resultDict_(fileName("name"), dictionary::null)
76 {
77  read(dict);
78  resetName(valueType);
79 }
80 
81 
82 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
83 
85 {}
86 
87 
88 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
89 
91 {
92  if (dict != dict_)
93  {
94  dict_ = dict;
95  }
96 
98 
99  dict.lookup("fields") >> fields_;
100  dict.lookup("writeFields") >> writeFields_;
101 
102  return true;
103 }
104 
105 
107 {
108  return true;
109 }
110 
111 
113 {
114  logFiles::write();
115 
116  Log << type() << " " << name() << " write:" << nl;
117 
118  return true;
119 }
120 
121 
122 // ************************************************************************* //
dictionary dict
virtual bool execute()
Execute.
Definition: fieldValue.C:106
virtual bool write()
Write function.
Definition: logFiles.C:180
A class for handling file names.
Definition: fileName.H:69
virtual ~fieldValue()
Destructor.
Definition: fieldValue.C:84
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
static const dictionary null
Null dictionary.
Definition: dictionary.H:202
virtual bool read(const dictionary &dict)
Read from dictionary.
Definition: fieldValue.C:90
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 &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:485
#define Log
Report write to Foam::Info if the local log switch is true.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
Registry of regIOobjects.
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:576
virtual bool write()
Write.
Definition: fieldValue.C:112
functionObject base class for creating, maintaining and writing log files e.g. integrated of averaged...
Definition: logFiles.H:57