fieldValue.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 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 {
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  valueType_(valueType),
55  resultDict_("result")
56 {
57  read(dict);
58 }
59 
60 
62 (
63  const word& name,
64  const objectRegistry& obr,
65  const dictionary& dict,
66  const word& valueType
67 )
68 :
70  logFiles(obr_, name),
71  valueType_(valueType),
72  resultDict_("result")
73 {
74  read(dict);
75 }
76 
77 
78 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
79 
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
87 {
89 
90  dict.lookup("fields") >> fields_;
91  dict.lookup("writeFields") >> writeFields_;
92 
93  resetName(valueType_);
94 
95  return true;
96 }
97 
98 
100 {
101  return true;
102 }
103 
104 
106 {
107  logFiles::write();
108 
109  Log << type() << " " << name() << " write:" << nl;
110 
111  return true;
112 }
113 
114 
115 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Base class for field value -based function objects.
Definition: fieldValue.H:66
const dictionary & dict() const
Return the reference to the construction dictionary.
virtual ~fieldValue()
Destructor.
Definition: fieldValue.C:80
virtual bool read(const dictionary &dict)
Read from dictionary.
Definition: fieldValue.C:86
fieldValue(const word &name, const Time &runTime, const dictionary &dict, const word &valueType)
Construct from Time and dictionary.
Definition: fieldValue.C:45
virtual bool execute()
Execute.
Definition: fieldValue.C:99
virtual bool write()
Write.
Definition: fieldValue.C:105
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
functionObject base class for creating, maintaining and writing log files e.g. integrated of averaged...
Definition: logFiles.H:60
virtual bool write()
Write function.
Definition: logFiles.C:173
virtual bool read(const dictionary &)
Read optional controls.
Registry of regIOobjects.
A class for handling words, derived from string.
Definition: word.H:62
#define Log
Report write to Foam::Info if the local log switch is true.
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
defineRunTimeSelectionTable(fieldValue, dictionary)
Namespace for OpenFOAM.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
static const char nl
Definition: Ostream.H:267
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
dictionary dict
#define valueType(Type, none)
The field's value.
Definition: uniform.H:71