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 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 name_;
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  //- Calculate the field
104  virtual bool execute();
105 
106  //- Write the field
107  virtual bool write();
108 
109  //- Clear the field from the objectRegistry
110  virtual bool clear();
111 };
112 
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 } // End namespace functionObjects
117 } // End namespace Foam
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #endif
122 
123 // ************************************************************************* //
const word & name() const
Return the name of this functionObject.
uniform(const word &name, const Time &, const dictionary &)
Construct from Time and dictionary.
Definition: uniform.C:46
virtual bool write()
Write the field.
Definition: uniform.C:134
Dimension set for the base types.
Definition: dimensionSet.H:120
TypeName("uniform")
Runtime type information.
A class for handling words, derived from string.
Definition: word.H:59
Generate a uniform field.
Definition: uniform.H:55
virtual ~uniform()
Destructor.
Definition: uniform.C:63
virtual bool execute()
Calculate the field.
Definition: uniform.C:110
#define valueType(Type, none)
The field&#39;s value.
Definition: uniform.H:71
virtual bool read(const dictionary &)
Read the uniform data.
Definition: uniform.C:69
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
virtual bool clear()
Clear the field from the objectRegistry.
Definition: uniform.C:140
Namespace for OpenFOAM.