Loading...
Searching...
No Matches
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,2022 OpenFOAM Foundation
9 Copyright (C) 2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::SlicedGeometricField
29
30Description
31 Specialization of GeometricField which holds slices of given complete
32 fields in a form that they act as a GeometricField.
33
34 The destructor is wrapped to avoid deallocation of the storage of the
35 complete fields when this is destroyed.
36
37 SlicedGeometricField can only be instantiated with a valid form of
38 SlicedPatchField to handle the slicing and storage deallocation of the
39 boundary field.
40
41SourceFiles
42 SlicedGeometricField.C
43
44\*---------------------------------------------------------------------------*/
45
46#ifndef Foam_SlicedGeometricField_H
47#define Foam_SlicedGeometricField_H
48
49#include "GeometricField.H"
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54namespace Foam
55{
56
57/*---------------------------------------------------------------------------*\
58 Class SlicedGeometricField Declaration
59\*---------------------------------------------------------------------------*/
60
61template
62<
63 class Type,
64 template<class> class PatchField,
65 template<class> class SlicedPatchField,
66 class GeoMesh
67>
69:
70 public GeometricField<Type, PatchField, GeoMesh>
72public:
73
74 // Public Typedefs
75
76 typedef typename GeoMesh::Mesh Mesh;
78
79 //- The internal field slice for this SlicedGeometricField
81
82
83private:
84
85 // Private Member Functions
86
87 //- Return true if field size is too small to be the complete field
88 //- (ie, it must be boundary field addressing)
89 static bool
90 isBoundaryAddressing(const Mesh& mesh, const label fieldSize);
91
92 //- Slice the given field and a create a PtrList of SlicedPatchField
93 // from which the boundary field is built
95 makeBoundary
96 (
97 const Mesh& mesh,
98 const Field<Type>& completeOrBoundaryField,
99 const bool preserveCouples,
100 const bool preserveProcessorOnly = false,
101 const bool isBoundaryOnly = false
102 ) const;
103
104 //- Slice the given field and a create a PtrList of SlicedPatchField
105 // from which the boundary field is built
107 makeBoundary
108 (
109 const Mesh& mesh,
110 const FieldField<PatchField, Type>& bField,
111 const bool preserveCouples
112 ) const;
113
114 // Note - copy construct allowed
115
116 //- No copy assignment
117 void operator=(const SlicedGeometricField&) = delete;
118
119 //- No copy assignment from GeometricField,
120 // == assignment is allowed.
121 void operator=
122 (
124 ) = delete;
125
126 //- No copy assignment from tmp<GeometricField>,
127 // == assignment is allowed.
128 void operator=
129 (
131 ) = delete;
132
133
134public:
135
136 // Constructors
137
138 //- Construct from components and field to slice
140 (
141 const IOobject&,
142 const Mesh&,
143 const dimensionSet& dims,
144 const Field<Type>& completeField,
145 const bool preserveCouples = true
146 );
147
148 //- Construct from components and separate fields to slice for the
149 //- internal field and boundary field
151 (
152 const IOobject&,
153 const Mesh&,
154 const dimensionSet& dims,
155 const Field<Type>& completeIField,
156 const Field<Type>& completeBField,
157 const bool preserveCouples = true,
158 const bool preserveProcessorOnly = false
159 );
160
161 //- Construct from GeometricField. Reuses full internal and
162 //- patch fields except on couples (preserveCouples=true).
164 (
165 const IOobject&,
167 const bool preserveCouples = true
168 );
169
170 //- Copy construct
172 (
174 <
175 Type,
176 PatchField,
177 SlicedPatchField,
178 GeoMesh
179 >&
180 );
181
182 //- Clone
184 clone() const;
185
186
187 //- Destructor
189
190
191 // Member Functions
193 //- Correct boundary field
195};
196
197
198// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199
200} // End namespace Foam
201
202// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203
204#ifdef NoRepository
205 #include "SlicedGeometricField.C"
206#endif
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210#endif
211
212// ************************************************************************* //
A field of fields is a PtrList of fields with reference counting.
Definition FieldField.H:77
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition GeoMesh.H:46
MESH::BoundaryMesh BoundaryMesh
Definition GeoMesh.H:62
GeometricField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=PatchField< Type >::calculatedType())
Construct given IOobject, mesh, dimensions and patch type.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
Specialisation of DimensionedField that holds a slice of a given field so that it acts as a Dimension...
tmp< SlicedGeometricField< Type, PatchField, SlicedPatchField, GeoMesh > > clone() const
Clone.
SlicedGeometricField(const IOobject &, const Mesh &, const dimensionSet &dims, const Field< Type > &completeIField, const Field< Type > &completeBField, const bool preserveCouples=true, const bool preserveProcessorOnly=false)
Construct from components and separate fields to slice for the internal field and boundary field.
SlicedGeometricField(const IOobject &, const Mesh &, const dimensionSet &dims, const Field< Type > &completeField, const bool preserveCouples=true)
Construct from components and field to slice.
SlicedGeometricField(const SlicedGeometricField< Type, PatchField, SlicedPatchField, GeoMesh > &)
Copy construct.
void correctBoundaryConditions()
Correct boundary field.
SlicedGeometricField(const IOobject &, const GeometricField< Type, PatchField, GeoMesh > &, const bool preserveCouples=true)
Construct from GeometricField. Reuses full internal and patch fields except on couples (preserveCoupl...
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
A class for managing temporary objects.
Definition tmp.H:75
Namespace for OpenFOAM.