GeometricBoundaryField.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) 2011-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::GeometricBoundaryField
26 
27 Description
28  Generic GeometricBoundaryField class.
29 
30 SourceFiles
31  GeometricBoundaryField.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef GeometricBoundaryField_H
36 #define GeometricBoundaryField_H
37 
38 #include "dimensionedTypes.H"
39 #include "DimensionedField.H"
40 #include "FieldField.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class dictionary;
50 
51 /*---------------------------------------------------------------------------*\
52  Class GeometricBoundaryField Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class Type, class GeoMesh, template<class> class PrimitiveField>
57 :
58  public FieldField<GeoMesh::template PatchField, Type>
59 {
60 public:
61 
62  // Public Typedefs
63 
64  //- Type of boundary mesh on which this boundary is instantiated
65  typedef typename GeoMesh::BoundaryMesh BoundaryMesh;
66 
67  //- Type of the internal field from which this GeometricField is derived
69 
70  //- Type of the patch field of which the Boundary is composed
71  typedef typename GeoMesh::template PatchField<Type> Patch;
72 
73 
74 private:
75 
76  // Private Data
77 
78  //- Reference to BoundaryMesh for which this field is defined
79  const BoundaryMesh& bmesh_;
80 
81 
82 public:
83 
84  //- Declare friendship with other geometric boundary fields
85  template<class Type2, class GeoMesh2, template<class> class PrimitiveField2>
86  friend class GeometricBoundaryField;
87 
88 
89  // Constructors
90 
91  //- Construct from a BoundaryMesh
93 
94  //- Construct from a BoundaryMesh,
95  // reference to the internal field
96  // and a patch field type
98  (
99  const BoundaryMesh&,
100  const Internal&,
101  const word&
102  );
103 
104  //- Construct from a BoundaryMesh,
105  // reference to the internal field
106  // and a wordList of patch field types and optionally
107  // the actual patch types (to override constraint patches)
109  (
110  const BoundaryMesh&,
111  const Internal&,
112  const wordList& wantedPatchTypes,
113  const wordList& actualPatchTypes = wordList()
114  );
115 
116  //- Construct from a BoundaryMesh,
117  // reference to the internal field
118  // and a PtrList<Patch>
120  (
121  const BoundaryMesh&,
122  const Internal&,
123  const PtrList<Patch>&
124  );
125 
126  //- Construct as copy setting the reference to the internal field
128 
129  //- Construct as copy setting the reference to the internal field
130  template<template<class> class PrimitiveField2>
131  explicit GeometricBoundaryField
132  (
133  const Internal& field,
135  );
136 
137  //- Copy constructor deleted
138  // as it would not set the internalField reference correctly
140 
141  //- Move constructor deleted
142  // as it would not set the internalField reference correctly
144 
145  //- Construct from dictionary
147  (
148  const BoundaryMesh&,
149  const Internal&,
150  const dictionary&
151  );
152 
153 
154  // Member Functions
155 
156  //- Read the boundary field
157  void readField(const Internal& field, const dictionary& dict);
158 
159  //- Update the boundary condition coefficients
160  void updateCoeffs();
161 
162  //- Evaluate boundary conditions
163  void evaluate();
164 
165  //- Return a list of the patch field types
166  wordList types() const;
167 
168  //- Return BoundaryField of the cell values neighbouring
169  // the boundary
171 
172  //- Return BoundaryField of the values on the other side of couples
174 
175  //- Return BoundaryField with the values on the other side of couples
177 
178  //- Return a list of pointers for each patch field with only those
179  // pointing to interfaces being set
181 
182  //- Return a list of pointers for each patch field with only those
183  // pointing to interfaces being set
185 
186  //- Reset the boundary field contents to the given field
187  // Used for mesh to mesh mapping
188  void reset(const GeometricBoundaryField&);
189 
190  //- Write boundary field as dictionary entry
191  void writeEntry(const word& keyword, Ostream& os) const;
192 
193 
194  // Member Operators
195 
196  //- Assignment operator
197  void operator=(const GeometricBoundaryField&);
198 
199  //- Move assignment operator
201 
202  //- Assignment to FieldField<GeoMesh::template PatchField, Type>
204 
205  //- Assignment to FieldField<OtherPatchField, Type>
206  template<template<class> class OtherPatchField>
208 
209  //- Assignment to Type
210  void operator=(const Type&);
211 
212  //- Forced assignment to
213  // BoundaryField<Type, GeoMesh::template PatchField, BoundaryMesh>
214  void operator==(const GeometricBoundaryField&);
215 
216  //- Forced assignment to FieldField<GeoMesh::template PatchField, Type>
218 
219  //- Forced assignment to FieldField<OtherPatchField, Type>
220  template<template<class> class OtherPatchField>
222 
223  //- Forced assignment to Type
224  void operator==(const Type&);
225 };
226 
227 
228 template<class Type, class GeoMesh, template<class> class PrimitiveField>
229 Ostream& operator<<
230 (
231  Ostream&,
233 );
234 
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 } // End namespace Foam
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 #ifdef NoRepository
243  #include "GeometricBoundaryField.C"
244 #endif
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #endif
249 
250 // ************************************************************************* //
List of coupled interface fields to be used in coupling.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic field type.
Definition: FieldField.H:77
Generic GeometricBoundaryField class.
PtrList< Field< Type > > coupledNeighbourField() const
Return BoundaryField of the values on the other side of couples.
tmp< GeometricBoundaryField > boundaryNeighbourField() const
Return BoundaryField with the values on the other side of couples.
lduInterfaceFieldPtrsList scalarInterfaces() const
Return a list of pointers for each patch field with only those.
friend class GeometricBoundaryField
Declare friendship with other geometric boundary fields.
void readField(const Internal &field, const dictionary &dict)
Read the boundary field.
wordList types() const
Return a list of the patch field types.
void evaluate()
Evaluate boundary conditions.
LduInterfaceFieldPtrsList< Type > interfaces() const
Return a list of pointers for each patch field with only those.
void operator==(const GeometricBoundaryField &)
Forced assignment to.
DimensionedField< Type, GeoMesh, PrimitiveField > Internal
Type of the internal field from which this GeometricField is derived.
void writeEntry(const word &keyword, Ostream &os) const
Write boundary field as dictionary entry.
void updateCoeffs()
Update the boundary condition coefficients.
GeoMesh::BoundaryMesh BoundaryMesh
Type of boundary mesh on which this boundary is instantiated.
tmp< GeometricBoundaryField > boundaryInternalField() const
Return BoundaryField of the cell values neighbouring.
GeoMesh::template PatchField< Type > Patch
Type of the patch field of which the Boundary is composed.
void reset(const GeometricBoundaryField &)
Reset the boundary field contents to the given field.
void operator=(const GeometricBoundaryField &)
Assignment operator.
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
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:54
dictionary dict