fieldValue.H
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-2021 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 Class
25  Foam::functionObjects::fieldValue
26 
27 Description
28  Base class for field value -based function objects.
29 
30 See also
31  Foam::functionObject
32  Foam::functionObjects::fvMeshFunctionObject
33  Foam::functionObjects::logFiles
34 
35 SourceFiles
36  fieldValue.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef functionObjects_fieldValue_H
41 #define functionObjects_fieldValue_H
42 
43 #include "fvMeshFunctionObject.H"
44 #include "logFiles.H"
45 #include "Switch.H"
46 #include "Field.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declaration of classes
54 class fvMesh;
55 
56 namespace functionObjects
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class fieldValue Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class fieldValue
64 :
65  public fvMeshFunctionObject,
66  public logFiles
67 {
68 
69 protected:
70 
71  // Protected data
72 
73  //- Construction dictionary
75 
76  //- The name of the type of value (volFieldValue, or surfaceFieldValue)
77  const word valueType_;
78 
79  //- Name of region (patch, zone, etc.)
81 
82  //- List of field names to operate on
84 
85  //- Output field values flag
87 
88  //- Results dictionary for external access of results
90 
91 
92  // Protected Member Functions
93 
94  //- Combine fields from all processor domains into single field
95  template<class Type>
97 
98  //- Combine fields from all processor domains into single field
99  template<class Type>
100  void combineFields(tmp<Field<Type>>&);
101 
102 
103 public:
104 
105  //- Run-time type information
106  TypeName("fieldValue");
107 
108  // Declare runtime constructor selection table
109 
111  (
112  autoPtr,
113  fieldValue,
114  dictionary,
115  (
116  const word& name,
117  const objectRegistry& obr,
118  const dictionary& dict
119  ),
120  (name, obr, dict)
121  );
122 
123 
124  // Constructors
125 
126  //- Construct from Time and dictionary
127  fieldValue
128  (
129  const word& name,
130  const Time& runTime,
131  const dictionary& dict,
132  const word& valueType
133  );
134 
135  //- Construct from objectRegistry and dictionary
136  fieldValue
137  (
138  const word& name,
139  const objectRegistry& obr,
140  const dictionary& dict,
141  const word& valueType
142  );
143 
144  //- Return a reference to the selected fieldValue
145  static autoPtr<fieldValue> New
146  (
147  const word& name,
148  const objectRegistry& obr,
149  const dictionary& dict,
150  const bool output = true
151  );
152 
153 
154  //- Destructor
155  virtual ~fieldValue();
156 
157 
158  // Member Functions
159 
160  //- Return the reference to the construction dictionary
161  inline const dictionary& dict() const;
162 
163  //- Return the region name
164  inline const word& regionName() const;
165 
166  //- Return the list of field names
167  inline const wordList& fields() const;
168 
169  //- Return the output field values flag
170  inline const Switch& writeFields() const;
171 
172  //- Return access to the latest set of results
173  inline const dictionary& resultDict() const;
174 
175  //- Read from dictionary
176  virtual bool read(const dictionary& dict);
177 
178  //- Execute
179  virtual bool execute();
180 
181  //- Write
182  virtual bool write();
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace functionObjects
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #include "fieldValueI.H"
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #ifdef NoRepository
198  #include "fieldValueTemplates.C"
199 #endif
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
virtual bool execute()
Execute.
Definition: fieldValue.C:108
dictionary dict_
Construction dictionary.
Definition: fieldValue.H:73
virtual ~fieldValue()
Destructor.
Definition: fieldValue.C:84
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
const word valueType_
The name of the type of value (volFieldValue, or surfaceFieldValue)
Definition: fieldValue.H:76
engineTime & runTime
virtual bool read(const dictionary &dict)
Read from dictionary.
Definition: fieldValue.C:90
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
const Switch & writeFields() const
Return the output field values flag.
Definition: fieldValueI.H:50
Switch writeFields_
Output field values flag.
Definition: fieldValue.H:85
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
dictionary resultDict_
Results dictionary for external access of results.
Definition: fieldValue.H:88
TypeName("fieldValue")
Run-time type information.
void combineFields(Field< Type > &field)
Combine fields from all processor domains into single field.
Pre-declare SubField and related Field type.
Definition: Field.H:56
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
const dictionary & resultDict() const
Return access to the latest set of results.
Definition: fieldValueI.H:57
const dictionary & dict() const
Return the reference to the construction dictionary.
Definition: fieldValueI.H:31
static autoPtr< fieldValue > New(const word &name, const objectRegistry &obr, const dictionary &dict, const bool output=true)
Return a reference to the selected fieldValue.
Definition: fieldValueNew.C:32
wordList fields_
List of field names to operate on.
Definition: fieldValue.H:82
declareRunTimeSelectionTable(autoPtr, fieldValue, dictionary,(const word &name, const objectRegistry &obr, const dictionary &dict),(name, obr, dict))
const wordList & fields() const
Return the list of field names.
Definition: fieldValueI.H:43
#define valueType(Type, none)
The field&#39;s value.
Definition: uniform.H:71
word regionName_
Name of region (patch, zone, etc.)
Definition: fieldValue.H:79
const word & regionName() const
Return the region name.
Definition: fieldValueI.H:37
Base class for field value -based function objects.
Definition: fieldValue.H:62
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
rDeltaTY field()
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
Namespace for OpenFOAM.
virtual bool write()
Write.
Definition: fieldValue.C:114
functionObject base class for creating, maintaining and writing log files e.g. integrated of averaged...
Definition: logFiles.H:57