FunctionalDimensionedField.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) 2026 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::FunctionalDimensionedField
26 
27 Description
28  DimensionedField with a corresponding run-time selected function
29  to evaluate and update the field.
30 
31 See also
32  Foam::DimensionedField
33  Foam::DimensionedFieldFunction
34  Foam::UFunctionalDimensionedField
35 
36 SourceFiles
37  FunctionalDimensionedField.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef FunctionalDimensionedField_H
42 #define FunctionalDimensionedField_H
43 
45 #include "DimensionedField.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declaration of friend functions
54 template<class Type, class GeoMesh>
55 void writeEntry
56 (
57  Ostream& os,
58  const FunctionalDimensionedField<Type, GeoMesh>& udff
59 );
60 
61 /*---------------------------------------------------------------------------*\
62  Class FunctionalDimensionedField Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class Type, class GeoMesh>
67 :
68  public DimensionedField<Type, GeoMesh>
69 {
70  // Private Data
71 
72  //- Name of the function entry/sub dictionary
73  const word funcName_;
74 
75  //- Optional function pointer
77  funcPtr_;
78 
79 
80 public:
81 
82  // Constructors
83 
84  //- Construct from name, mesh, dimensions, field and dictionary
86  (
87  const word& name,
88  const word& funcName,
89  const GeoMesh&,
90  const dimensionSet& dimensions,
91  const dictionary&
92  );
93 
94  //- Construct from name, mesh, dimensions, field, dictionary
95  // and default value
97  (
98  const word& name,
99  const word& funcName,
100  const GeoMesh&,
101  const dimensionSet& dimensions,
102  const dictionary&,
103  const Type& defaultValue
104  );
105 
106  //- Construct from given FunctionalDimensionedField
107  // with new mesh and field
109  (
111  const GeoMesh&
112  );
113 
114  //- Copy constructor
116  (
118  );
119 
120 
121  // Member Functions
122 
123  //- Map and optionally evaluate
124  void map(const bool evaluate);
125 
126  //- Reset
127  void reset();
128 
129  //- Update
130  bool update();
131 
132  using regIOobject::write;
133 
134  //- Write
135  void write(Ostream&) const;
136 
137 
138  // Global functions
139 
140  friend void writeEntry <Type, GeoMesh>
141  (
142  Ostream& os,
144  );
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #ifdef NoRepository
156 #endif
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionSet & dimensions() const
Return dimensions.
DimensionedField with a corresponding run-time selected function to evaluate and update the field.
virtual bool write(const bool write=true) const
Write using setting from DB.
void map(const bool evaluate)
Map and optionally evaluate.
FunctionalDimensionedField(const word &name, const word &funcName, const GeoMesh &, const dimensionSet &dimensions, const dictionary &)
Construct from name, mesh, dimensions, field and dictionary.
const word & name() const
Return name.
Definition: IOobject.H:307
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Dimension set for the base types.
Definition: dimensionSet.H:125
virtual bool write(const bool write=true) const
Write using setting from DB.
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
void evaluate(GeometricField< Type, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, GeoMesh > &x)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)