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-2024 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 a list of pointers for each patch field with only those
176  // pointing to interfaces being set
178 
179  //- Return a list of pointers for each patch field with only those
180  // pointing to interfaces being set
182 
183  //- Reset the boundary field contents to the given field
184  // Used for mesh to mesh mapping
185  void reset(const GeometricBoundaryField&);
186 
187  //- Write boundary field as dictionary entry
188  void writeEntry(const word& keyword, Ostream& os) const;
189 
190 
191  // Member Operators
192 
193  //- Assignment operator
194  void operator=(const GeometricBoundaryField&);
195 
196  //- Move assignment operator
198 
199  //- Assignment to FieldField<GeoMesh::template PatchField, Type>
201 
202  //- Assignment to FieldField<OtherPatchField, Type>
203  template<template<class> class OtherPatchField>
205 
206  //- Assignment to Type
207  void operator=(const Type&);
208 
209  //- Forced assignment to
210  // BoundaryField<Type, GeoMesh::template PatchField, BoundaryMesh>
211  void operator==(const GeometricBoundaryField&);
212 
213  //- Forced assignment to FieldField<GeoMesh::template PatchField, Type>
215 
216  //- Forced assignment to FieldField<OtherPatchField, Type>
217  template<template<class> class OtherPatchField>
219 
220  //- Forced assignment to Type
221  void operator==(const Type&);
222 };
223 
224 
225 template<class Type, class GeoMesh, template<class> class PrimitiveField>
226 Ostream& operator<<
227 (
228  Ostream&,
230 );
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #ifdef NoRepository
240  #include "GeometricBoundaryField.C"
241 #endif
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #endif
246 
247 // ************************************************************************* //
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
MESH::BoundaryMesh BoundaryMesh
Boundary mesh type.
Definition: GeoMesh.H:65
Generic GeometricBoundaryField class.
tmp< GeometricBoundaryField > boundaryNeighbourField() const
Return BoundaryField of 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:62
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:54
dictionary dict