SlicedGeometricField.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-2019 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::SlicedGeometricField
26 
27 Description
28  Specialization of GeometricField which holds slices of given complete
29  fields in a form that they act as a GeometricField.
30 
31  The destructor is wrapped to avoid deallocation of the storage of the
32  complete fields when this is destroyed.
33 
34  SlicedGeometricField can only be instantiated with a valid form of
35  SlicedPatchField to handle the slicing and storage deallocation of the
36  boundary field.
37 
38 SourceFiles
39  SlicedGeometricField.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef SlicedGeometricField_H
44 #define SlicedGeometricField_H
45 
46 #include "GeometricField.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class SlicedGeometricField Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template
58 <
59  class Type,
60  template<class> class PatchField,
61  template<class> class SlicedPatchField,
62  class GeoMesh
63 >
64 class SlicedGeometricField
65 :
66  public GeometricField<Type, PatchField, GeoMesh>
67 {
68 public:
69 
70  typedef typename GeoMesh::Mesh Mesh;
71  typedef typename GeoMesh::BoundaryMesh BoundaryMesh;
72 
73  class Internal;
74 
75 
76 private:
77 
78  // Private Member Functions
79 
80  //- Slice the given field and a create a PtrList of SlicedPatchField
81  // from which the boundary field is built
82  tmp<FieldField<PatchField, Type>> slicedBoundaryField
83  (
84  const Mesh& mesh,
85  const Field<Type>& completeField,
86  const bool preserveCouples,
87  const bool preserveProcessorOnly = false
88  );
89 
90  //- Slice the given field and a create a PtrList of SlicedPatchField
91  // from which the boundary field is built
92  tmp<FieldField<PatchField, Type>> slicedBoundaryField
93  (
94  const Mesh& mesh,
95  const FieldField<PatchField, Type>& bField,
96  const bool preserveCouples
97  );
98 
99 
100 public:
101 
102  // Constructors
103 
104  //- Construct from components and field to slice
106  (
107  const IOobject&,
108  const Mesh&,
109  const dimensionSet&,
110  const Field<Type>& completeField,
111  const bool preserveCouples=true
112  );
113 
114  //- Construct from components and separate fields to slice for the
115  // internal field and boundary field
117  (
118  const IOobject&,
119  const Mesh&,
120  const dimensionSet&,
121  const Field<Type>& completeIField,
122  const Field<Type>& completeBField,
123  const bool preserveCouples=true,
124  const bool preserveProcessorOnly = false
125  );
126 
127  //- Construct from GeometricField. Reuses full internal and
128  // patch fields except on couples (preserveCouples=true).
130  (
131  const IOobject&,
133  const bool preserveCouples=true
134  );
135 
136  //- Copy constructor
138  (
140  <
141  Type,
142  PatchField,
143  SlicedPatchField,
144  GeoMesh
145  >&
146  );
147 
148  //- Clone
150  clone() const;
151 
152 
153  //- Destructor
155 
156 
157  // Member Functions
158 
159  //- Correct boundary field
161 
162 
163  // Member Operators
164 
165  //- Disallow default bitwise assignment
166  void operator=(const SlicedGeometricField&) = delete;
167 
168  //- Disallow standard assignment to GeometricField,
169  // == assignment is allowed.
170  void operator=
171  (
173  ) = delete;
174 
175  //- Disallow standard assignment to tmp<GeometricField>,
176  // == assignment is allowed.
177  void operator=
178  (
180  ) = delete;
181 };
182 
183 
184 /*---------------------------------------------------------------------------*\
185  Class SlicedGeometricField::Internal Declaration
186 \*---------------------------------------------------------------------------*/
187 
188 //- The internalField of a SlicedGeometricField
189 template
190 <
191  class Type,
192  template<class> class PatchField,
193  template<class> class SlicedPatchField,
194  class GeoMesh
195 >
196 class SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
197 Internal
198 :
199  public GeometricField<Type, PatchField, GeoMesh>::Internal
200 {
201 
202 public:
203 
204  // Constructors
205 
206  //- Construct from components and field to slice
207  Internal
208  (
209  const IOobject&,
210  const Mesh&,
211  const dimensionSet&,
212  const Field<Type>& iField
213  );
214 
215 
216  //- Destructor
217  ~Internal();
218 };
219 
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 } // End namespace Foam
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #ifdef NoRepository
228  #include "SlicedGeometricField.C"
229 #endif
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************************************************************* //
GeoMesh::BoundaryMesh BoundaryMesh
MESH::BoundaryMesh BoundaryMesh
Definition: GeoMesh.H:62
Generic GeometricField class.
DimensionedField< Type, GeoMesh > Internal
Type of the internal field from which this GeometricField is derived.
Dimension set for the base types.
Definition: dimensionSet.H:120
Pre-declare SubField and related Field type.
Definition: Field.H:56
void operator=(const SlicedGeometricField &)=delete
Disallow default bitwise assignment.
GeoMesh::Mesh Mesh
Type of mesh on which this DimensionedField is instantiated.
const Mesh & mesh() const
Return mesh.
tmp< SlicedGeometricField< Type, PatchField, SlicedPatchField, GeoMesh > > clone() const
Clone.
void correctBoundaryConditions()
Correct boundary field.
MESH Mesh
Definition: GeoMesh.H:61
The internalField of a SlicedGeometricField.
SlicedGeometricField(const IOobject &, const Mesh &, const dimensionSet &, const Field< Type > &completeField, const bool preserveCouples=true)
Construct from components and field to slice.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:46
A class for managing temporary objects.
Definition: PtrList.H:53
Specialization of GeometricField which holds slices of given complete fields in a form that they act ...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.