All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
uniform.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) 2021-2023 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::uniform
26 
27 Description
28  Generate a uniform field
29 
30 See also
31  Foam::functionObjects::fieldExpression
32  Foam::functionObjects::fvMeshFunctionObject
33 
34 SourceFiles
35  uniform.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef functionObjects_uniform_H
40 #define functionObjects_uniform_H
41 
42 #include "fvMeshFunctionObject.H"
43 #include "volFields.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 namespace functionObjects
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class uniform Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class uniform
57 :
59 {
60  // Private Data
61 
62  //- The type of the field to be written
63  word fieldType_;
64 
65  //- The field's name
66  word fieldName_;
67 
68  //- The field's dimensions
69  dimensionSet dimensions_;
70 
71  //- The field's value
72  #define valueType(Type, none) Type Type##Value_;
73  FOR_ALL_FIELD_TYPES(valueType);
74  #undef valueType
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("uniform");
81 
82 
83  // Constructors
84 
85  //- Construct from Time and dictionary
86  uniform
87  (
88  const word& name,
89  const Time&,
90  const dictionary&
91  );
92 
93 
94  //- Destructor
95  virtual ~uniform();
96 
97 
98  // Member Functions
99 
100  //- Read the uniform data
101  virtual bool read(const dictionary&);
102 
103  //- Return the list of fields required
104  virtual wordList fields() const
105  {
106  return wordList::null();
107  }
108 
109  //- Calculate the field
110  virtual bool execute();
111 
112  //- Write the field
113  virtual bool write();
114 
115  //- Clear the field from the objectRegistry
116  virtual bool clear();
117 };
118 
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 } // End namespace functionObjects
123 } // End namespace Foam
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 #endif
128 
129 // ************************************************************************* //
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Dimension set for the base types.
Definition: dimensionSet.H:125
const word & name() const
Return the name of this functionObject.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Generate a uniform field.
Definition: uniform.H:58
virtual wordList fields() const
Return the list of fields required.
Definition: uniform.H:103
virtual bool clear()
Clear the field from the objectRegistry.
Definition: uniform.C:143
TypeName("uniform")
Runtime type information.
virtual ~uniform()
Destructor.
Definition: uniform.C:63
virtual bool execute()
Calculate the field.
Definition: uniform.C:112
virtual bool write()
Write the field.
Definition: uniform.C:137
uniform(const word &name, const Time &, const dictionary &)
Construct from Time and dictionary.
Definition: uniform.C:46
virtual bool read(const dictionary &)
Read the uniform data.
Definition: uniform.C:69
A class for handling words, derived from string.
Definition: word.H:62
#define valueType(Type, none)
The field's value.
Definition: uniform.H:71
Namespace for OpenFOAM.