SlicedGeometricField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::SlicedGeometricField
28 
29 Description
30  Specialization of GeometricField which holds slices of given complete
31  fields in a form that they act as a GeometricField.
32 
33  The destructor is wrapped to avoid deallocation of the storage of the
34  complete fields when this is destroyed.
35 
36  SlicedGeometricField can only be instantiated with a valid form of
37  SlicedPatchField to handle the slicing and storage deallocation of the
38  boundary field.
39 
40 SourceFiles
41  SlicedGeometricField.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef SlicedGeometricField_H
46 #define SlicedGeometricField_H
47 
48 #include "GeometricField.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class SlicedGeometricField Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template
60 <
61  class Type,
62  template<class> class PatchField,
63  template<class> class SlicedPatchField,
64  class GeoMesh
65 >
66 class SlicedGeometricField
67 :
68  public GeometricField<Type, PatchField, GeoMesh>
69 {
70 public:
71 
72  typedef typename GeoMesh::Mesh Mesh;
73  typedef typename GeoMesh::BoundaryMesh BoundaryMesh;
74 
75  class Internal;
76 
77 
78 private:
79 
80  // Private Member Functions
81 
82  //- Slice the given field and a create a PtrList of SlicedPatchField
83  // from which the boundary field is built
84  tmp<FieldField<PatchField, Type>> slicedBoundaryField
85  (
86  const Mesh& mesh,
87  const Field<Type>& completeField,
88  const bool preserveCouples,
89  const bool preserveProcessorOnly = false
90  );
91 
92  //- Slice the given field and a create a PtrList of SlicedPatchField
93  // from which the boundary field is built
94  tmp<FieldField<PatchField, Type>> slicedBoundaryField
95  (
96  const Mesh& mesh,
97  const FieldField<PatchField, Type>& bField,
98  const bool preserveCouples
99  );
100 
101  // Note - copy construct allowed
102 
103  //- No copy assignment
104  void operator=(const SlicedGeometricField&) = delete;
105 
106  //- No copy assignment from GeometricField,
107  // == assignment is allowed.
108  void operator=
109  (
111  ) = delete;
112 
113  //- No copy assignment from tmp<GeometricField>,
114  // == assignment is allowed.
115  void operator=
116  (
118  ) = delete;
119 
120 
121 public:
122 
123  // Constructors
124 
125  //- Construct from components and field to slice
127  (
128  const IOobject&,
129  const Mesh&,
130  const dimensionSet&,
131  const Field<Type>& completeField,
132  const bool preserveCouples=true
133  );
134 
135  //- Construct from components and separate fields to slice for the
136  // internal field and boundary field
138  (
139  const IOobject&,
140  const Mesh&,
141  const dimensionSet&,
142  const Field<Type>& completeIField,
143  const Field<Type>& completeBField,
144  const bool preserveCouples=true,
145  const bool preserveProcessorOnly = false
146  );
147 
148  //- Construct from GeometricField. Reuses full internal and
149  // patch fields except on couples (preserveCouples=true).
151  (
152  const IOobject&,
154  const bool preserveCouples=true
155  );
156 
157  //- Construct as copy
159  (
161  <
162  Type,
163  PatchField,
164  SlicedPatchField,
165  GeoMesh
166  >&
167  );
168 
169  //- Clone
171  clone() const;
172 
173 
174  //- Destructor
176 
177 
178  // Member functions
179 
180  //- Correct boundary field
182 };
183 
184 
185 /*---------------------------------------------------------------------------*\
186  Class SlicedGeometricField::Internal Declaration
187 \*---------------------------------------------------------------------------*/
188 
189 //- The internalField of a SlicedGeometricField
190 template
191 <
192  class Type,
193  template<class> class PatchField,
194  template<class> class SlicedPatchField,
195  class GeoMesh
196 >
197 class SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
198 Internal
199 :
200  public GeometricField<Type, PatchField, GeoMesh>::Internal
201 {
202 
203 public:
204 
205  // Constructors
206 
207  //- Construct from components and field to slice
208  Internal
209  (
210  const IOobject&,
211  const Mesh&,
212  const dimensionSet&,
213  const Field<Type>& iField
214  );
215 
216 
217  //- Destructor
218  ~Internal();
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace Foam
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #ifdef NoRepository
229  #include "SlicedGeometricField.C"
230 #endif
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::FieldField< PatchField, Type >
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::SlicedGeometricField::clone
tmp< SlicedGeometricField< Type, PatchField, SlicedPatchField, GeoMesh > > clone() const
Clone.
Foam::SlicedGeometricField::correctBoundaryConditions
void correctBoundaryConditions()
Correct boundary field.
Definition: SlicedGeometricField.C:414
Foam::dimensionSet
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:108
Foam::SlicedGeometricField::SlicedGeometricField
SlicedGeometricField(const IOobject &, const Mesh &, const dimensionSet &, const Field< Type > &completeField, const bool preserveCouples=true)
Construct from components and field to slice.
Definition: SlicedGeometricField.C:214
Foam::DimensionedField::Mesh
GeoMesh::Mesh Mesh
Type of mesh on which this DimensionedField is instantiated.
Definition: DimensionedField.H:86
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::SlicedGeometricField::BoundaryMesh
GeoMesh::BoundaryMesh BoundaryMesh
Definition: SlicedGeometricField.H:72
SlicedGeometricField.C
Foam::GeoMesh::BoundaryMesh
MESH::BoundaryMesh BoundaryMesh
Definition: GeoMesh.H:63
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::GeoMesh
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:48
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SlicedGeometricField::Mesh
GeoMesh::Mesh Mesh
Definition: SlicedGeometricField.H:71
GeometricField.H
Foam::SlicedGeometricField::Internal
The internalField of a SlicedGeometricField.
Definition: SlicedGeometricField.H:196
Foam::SlicedGeometricField
Specialization of GeometricField which holds slices of given complete fields in a form that they act ...
Definition: slicedSurfaceFieldsFwd.H:58
Foam::SlicedGeometricField::~SlicedGeometricField
~SlicedGeometricField()
Destructor.
Definition: SlicedGeometricField.C:380
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::GeoMesh::Mesh
MESH Mesh
Definition: GeoMesh.H:62