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-2022 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  Specialisation 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 #include "SlicedDimensionedField.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class SlicedGeometricField Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template
59 <
60  class Type,
61  template<class> class PatchField,
62  template<class> class SlicedPatchField,
63  class GeoMesh
64 >
66 :
67  public GeometricField<Type, PatchField, GeoMesh>
68 {
69 public:
70 
71  // Public Typedefs
72 
73  //- Type of mesh on which this SlicedGeometricField is instantiated
74  typedef typename GeoMesh::Mesh Mesh;
75 
76  //- Type of the internal field from which this SlicedGeometricField is
77  // derived
79 
80 
81 private:
82 
83  // Private Member Functions
84 
85  //- Slice the given field and a create a PtrList of SlicedPatchField
86  // from which the boundary field is built
87  tmp<FieldField<PatchField, Type>> slicedBoundaryField
88  (
89  const Mesh& mesh,
90  const Field<Type>& completeField,
91  const bool preserveCouples,
92  const bool preserveProcessorOnly = false
93  );
94 
95  //- Slice the given field and a create a PtrList of SlicedPatchField
96  // from which the boundary field is built
97  tmp<FieldField<PatchField, Type>> slicedBoundaryField
98  (
99  const Mesh& mesh,
100  const FieldField<PatchField, Type>& bField,
101  const bool preserveCouples
102  );
103 
104 
105 public:
106 
107  // Constructors
108 
109  //- Construct from components and field to slice
111  (
112  const IOobject&,
113  const Mesh&,
114  const dimensionSet&,
115  const Field<Type>& completeField,
116  const bool preserveCouples=true
117  );
118 
119  //- Construct from components and separate fields to slice for the
120  // internal field and boundary field
122  (
123  const IOobject&,
124  const Mesh&,
125  const dimensionSet&,
126  const Field<Type>& completeIField,
127  const Field<Type>& completeBField,
128  const bool preserveCouples=true,
129  const bool preserveProcessorOnly = false
130  );
131 
132  //- Construct from GeometricField. Reuses full internal and
133  // patch fields except on couples (preserveCouples=true).
135  (
136  const IOobject&,
138  const bool preserveCouples=true
139  );
140 
141  //- Copy constructor
143  (
145  <
146  Type,
147  PatchField,
148  SlicedPatchField,
149  GeoMesh
150  >&
151  );
152 
153  //- Clone
155  clone() const;
156 
157 
158  //- Destructor
160 
161 
162  // Member Functions
163 
164  //- Splice the sliced field and return the complete field
165  tmp<Field<Type>> splice() const;
166 
167  //- Correct boundary field
169 
170 
171  // Member Operators
172 
173  //- Disallow default bitwise assignment
174  void operator=(const SlicedGeometricField&) = delete;
175 
176  //- Disallow standard assignment to GeometricField,
177  // == assignment is allowed.
178  void operator=
179  (
181  ) = delete;
182 
183  //- Disallow standard assignment to tmp<GeometricField>,
184  // == assignment is allowed.
185  void operator=
186  (
188  ) = delete;
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #ifdef NoRepository
199  #include "SlicedGeometricField.C"
200 #endif
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #endif
205 
206 // ************************************************************************* //
GeoMesh::Mesh Mesh
Type of mesh on which this DimensionedField is instantiated.
const Mesh & mesh() const
Return mesh.
Pre-declare SubField and related Field type.
Definition: Field.H:83
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:47
MESH Mesh
Definition: GeoMesh.H:61
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
Specialisation of DimensionedField which holds a slice of a given complete field in such a form that ...
Specialisation of GeometricField which holds slices of given complete fields in a form that they act ...
SlicedDimensionedField< Type, GeoMesh > Internal
Type of the internal field from which this SlicedGeometricField is.
GeoMesh::Mesh Mesh
Type of mesh on which this SlicedGeometricField is instantiated.
tmp< SlicedGeometricField< Type, PatchField, SlicedPatchField, GeoMesh > > clone() const
Clone.
void operator=(const SlicedGeometricField &)=delete
Disallow default bitwise assignment.
SlicedGeometricField(const IOobject &, const Mesh &, const dimensionSet &, const Field< Type > &completeField, const bool preserveCouples=true)
Construct from components and field to slice.
tmp< Field< Type > > splice() const
Splice the sliced field and return the complete field.
void correctBoundaryConditions()
Correct boundary field.
Dimension set for the base types.
Definition: dimensionSet.H:125
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.