All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2018 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  //- Name of region (patch, zone, etc.)
78 
79  //- List of field names to operate on
81 
82  //- Output field values flag
84 
85  //- Results dictionary for external access of results
87 
88 
89  // Protected Member Functions
90 
91  //- Combine fields from all processor domains into single field
92  template<class Type>
94 
95  //- Combine fields from all processor domains into single field
96  template<class Type>
98 
99 
100 public:
101 
102  //- Run-time type information
103  TypeName("fieldValue");
104 
105  // Declare runtime constructor selection table
106 
108  (
109  autoPtr,
110  fieldValue,
111  dictionary,
112  (
113  const word& name,
114  const objectRegistry& obr,
115  const dictionary& dict
116  ),
117  (name, obr, dict)
118  );
119 
120 
121  // Constructors
122 
123  //- Construct from Time and dictionary
124  fieldValue
125  (
126  const word& name,
127  const Time& runTime,
128  const dictionary& dict,
129  const word& valueType
130  );
131 
132  //- Construct from objectRegistry and dictionary
133  fieldValue
134  (
135  const word& name,
136  const objectRegistry& obr,
137  const dictionary& dict,
138  const word& valueType
139  );
140 
141  //- Return a reference to the selected fieldValue
142  static autoPtr<fieldValue> New
143  (
144  const word& name,
145  const objectRegistry& obr,
146  const dictionary& dict,
147  const bool output = true
148  );
149 
150 
151  //- Destructor
152  virtual ~fieldValue();
153 
154 
155  // Member Functions
156 
157  //- Return the reference to the construction dictionary
158  inline const dictionary& dict() const;
159 
160  //- Return the region name
161  inline const word& regionName() const;
162 
163  //- Return the list of field names
164  inline const wordList& fields() const;
165 
166  //- Return the output field values flag
167  inline const Switch& writeFields() const;
168 
169  //- Return access to the latest set of results
170  inline const dictionary& resultDict() const;
171 
172  //- Read from dictionary
173  virtual bool read(const dictionary& dict);
174 
175  //- Execute
176  virtual bool execute();
177 
178  //- Write
179  virtual bool write();
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace functionObjects
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #include "fieldValueI.H"
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #ifdef NoRepository
195  #include "fieldValueTemplates.C"
196 #endif
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #endif
201 
202 // ************************************************************************* //
virtual bool execute()
Execute.
Definition: fieldValue.C:106
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:158
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:82
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:85
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:79
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
word regionName_
Name of region (patch, zone, etc.)
Definition: fieldValue.H:76
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
Specialization 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:112
functionObject base class for creating, maintaining and writing log files e.g. integrated of averaged...
Definition: logFiles.H:57