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 with new mesh
108  (
110  const GeoMesh&
111  );
112 
113  //- Construct by mapping given FunctionalDimensionedField
115  (
117  const GeoMesh&,
118  const fieldMapper&
119  );
120 
121  //- Copy constructor
123  (
125  );
126 
127 
128  // Member Functions
129 
130  //- Map if mapping direct or evaluate if function defined
131  void map
132  (
134  const fieldMapper& mapper
135  );
136 
137  //- Reset
138  void reset();
139 
140  //- Update
141  bool update();
142 
143  using regIOobject::write;
144 
145  //- Write
146  void write(Ostream&) const;
147 
148 
149  // Global functions
150 
151  friend void writeEntry <Type, GeoMesh>
152  (
153  Ostream& os,
155  );
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #ifdef NoRepository
167 #endif
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
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.
FunctionalDimensionedField(const word &name, const word &funcName, const GeoMesh &, const dimensionSet &dimensions, const dictionary &)
Construct from name, mesh, dimensions, field and dictionary.
void map(const DimensionedField< Type, GeoMesh > &df, const fieldMapper &mapper)
Map if mapping direct or evaluate if function defined.
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
Abstract base class for field mapping.
Definition: fieldMapper.H:48
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 writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)