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-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::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<class Type, class GeoMesh>
60 :
61  public GeometricField<Type, GeoMesh>
62 {
63 public:
64 
65  // Public Typedefs
66 
67  //- Type of mesh on which this SlicedGeometricField is instantiated
68  typedef typename GeoMesh::Mesh Mesh;
69 
70  //- Type of the internal field from which this SlicedGeometricField is
71  // derived
73 
74  //- Type of the patch field of which the Boundary is composed
75  typedef typename GeoMesh::template PatchField<Type> Patch;
76 
77  //- Type of the sliced patch field of which the Boundary is composed
78  typedef typename Patch::Sliced SlicedPatch;
79 
80 
81 private:
82 
83  // Private Member Functions
84 
85  //- Slice the given field and a create a PtrList of sliced patch fields
86  // from which the boundary field is built
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 sliced patch fields
96  // from which the boundary field is built
98  (
99  const Mesh& mesh,
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 
144  //- Clone
146 
147 
148  //- Destructor
150 
151 
152  // Member Functions
153 
154  //- Splice the sliced field and return the complete field
155  tmp<Field<Type>> splice() const;
156 
157  //- Correct boundary field
159 
160 
161  // Member Operators
162 
163  //- Disallow default bitwise assignment
164  void operator=(const SlicedGeometricField&) = delete;
165 
166  //- Disallow standard assignment to GeometricField,
167  // == assignment is allowed.
168  void operator=(const GeometricField<Type, GeoMesh>&) = delete;
169 
170  //- Disallow standard assignment to tmp<GeometricField>,
171  // == assignment is allowed.
172  void operator=(const tmp<GeometricField<Type, GeoMesh>>&) = delete;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #ifdef NoRepository
183  #include "SlicedGeometricField.C"
184 #endif
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
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
MESH Mesh
Mesh type.
Definition: GeoMesh.H:62
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.
tmp< SlicedGeometricField< Type, GeoMesh > > clone() const
Clone.
GeoMesh::Mesh Mesh
Type of mesh on which this SlicedGeometricField is instantiated.
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.
Patch::Sliced SlicedPatch
Type of the sliced patch field of which the Boundary is composed.
void correctBoundaryConditions()
Correct boundary field.
GeoMesh::template PatchField< Type > Patch
Type of the patch field of which the Boundary is composed.
Dimension set for the base types.
Definition: dimensionSet.H:125
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.