FunctionalGeometricField.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::FunctionalGeometricField
26 
27 Description
28  GeometricField with a corresponding run-time selected function
29  to evaluate and update the field.
30 
31 See also
32  Foam::GeometricField
33  Foam::DimensionedFieldFunction
34  Foam::UFunctionalDimensionedField
35 
36 SourceFiles
37  FunctionalGeometricField.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef FunctionalGeometricField_H
42 #define FunctionalGeometricField_H
43 
45 #include "GeometricField.H"
47 #include "SlicedDimensionedField.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward declaration of friend functions
55 template<class Type, class GeoMesh>
56 void writeEntry
57 (
58  Ostream& os,
59  const FunctionalGeometricField<Type, GeoMesh>& udff
60 );
61 
62 /*---------------------------------------------------------------------------*\
63  Class FunctionalGeometricField Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class Type, class GeoMesh>
68 :
69  public GeometricField<Type, GeoMesh>
70 {
71  // Private Type Definitions
72 
73  //- The type of the patch
74  typedef typename GeoMesh::BoundaryMesh::value_type GeoPatch;
75 
76 
77  // Private Member Functions
78 
79  //- Set the patch field pointers
80  void setPatchFields();
81 
82  //- Read the functions
83  bool readFuncs(const dictionary& dict);
84 
85  //- Clone the functions
86  void cloneFuncs(const FunctionalGeometricField<Type, GeoMesh>& udff);
87 
88 
89  // Private Data
90 
91  //- Name of the function entry/sub dictionary
92  const word funcName_;
93 
94  //- Optional internal function pointer
96  internalFuncPtr_;
97 
98  //- Optional patch field pointers
100  patchFieldPtrs_;
101 
102  //- Optional patch function pointers
104  patchFuncPtrs_;
105 
106  //- Optional default value
107  const Type defaultValue_;
108 
109 
110 public:
111 
112  // Constructors
113 
114  //- Construct from name, mesh, dimensions, field and dictionary
116  (
117  const word& name,
118  const word& funcName,
119  const GeoMesh&,
120  const dimensionSet& dimensions,
121  const dictionary&
122  );
123 
124  //- Construct from name, mesh, dimensions, field, dictionary
125  // and default value
127  (
128  const word& name,
129  const word& funcName,
130  const GeoMesh&,
131  const dimensionSet& dimensions,
132  const dictionary&,
133  const Type& defaultValue
134  );
135 
136  //- Construct from given FunctionalGeometricField
137  // with new mesh and field
139  (
141  const GeoMesh&
142  );
143 
144  //- Copy constructor
146  (
148  );
149 
150 
151  // Member Functions
152 
153  //- Reset
154  void reset();
155 
156  //- Update
157  bool update();
158 
159  using regIOobject::write;
160 
161  //- Write
162  void write(Ostream&) const;
163 
164 
165  // Global functions
166 
167  friend void writeEntry <Type, GeoMesh>
168  (
169  Ostream& os,
171  );
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #ifdef NoRepository
182  #include "FunctionalGeometricField.C"
183 #endif
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
const dimensionSet & dimensions() const
Return dimensions.
GeometricField 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.
FunctionalGeometricField(const word &name, const word &funcName, const GeoMesh &, const dimensionSet &dimensions, const dictionary &)
Construct from name, mesh, dimensions, field and dictionary.
Generic GeometricField class.
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
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
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 writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
dictionary dict