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 | Copyright (C) 2011-2012 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 
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
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
93  (
94  const Mesh& mesh,
95  const FieldField<PatchField, Type>& bField,
96  const bool preserveCouples
97  );
98 
100  //SlicedGeometricField(const SlicedGeometricField&);
101 
102  //- Disallow default bitwise assignment
103  void operator=(const SlicedGeometricField&);
104 
105  //- Disallow standard assignment to GeometricField,
106  // == assignment is allowed.
108 
109  //- Disallow standard assignment to tmp<GeometricField>,
110  // == assignment is allowed.
112 
113 
114 public:
115 
116  // Constructors
117 
118  //- Construct from components and field to slice
120  (
121  const IOobject&,
122  const Mesh&,
123  const dimensionSet&,
124  const Field<Type>& completeField,
125  const bool preserveCouples=true
126  );
127 
128  //- Construct from components and separate fields to slice for the
129  // internal field and boundary field
131  (
132  const IOobject&,
133  const Mesh&,
134  const dimensionSet&,
135  const Field<Type>& completeIField,
136  const Field<Type>& completeBField,
137  const bool preserveCouples=true,
138  const bool preserveProcessorOnly = false
139  );
140 
141  //- Construct from GeometricField. Reuses full internal and
142  // patch fields except on couples (preserveCouples=true).
144  (
145  const IOobject&,
147  const bool preserveCouples=true
148  );
149 
150  //- Construct as copy
152  (
154  <
155  Type,
156  PatchField,
157  SlicedPatchField,
158  GeoMesh
159  >&
160  );
161 
162 
163  //- Destructor
165 
166 
167  // Member functions
168 
169  //- Correct boundary field
171 };
172 
173 
174 /*---------------------------------------------------------------------------*\
175  Class SlicedGeometricField::DimensionedInternalField Declaration
176 \*---------------------------------------------------------------------------*/
177 
178 //- The internalField of a SlicedGeometricField
179 template
180 <
181  class Type,
182  template<class> class PatchField,
183  template<class> class SlicedPatchField,
184  class GeoMesh
185 >
186 class SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
188 :
189  public GeometricField<Type, PatchField, GeoMesh>::DimensionedInternalField
190 {
191 
192 public:
193 
194  // Constructors
195 
196  //- Construct from components and field to slice
198  (
199  const IOobject&,
200  const Mesh&,
201  const dimensionSet&,
202  const Field<Type>& iField
203  );
204 
205 
206  //- Destructor
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #ifdef NoRepository
218 # include "SlicedGeometricField.C"
219 #endif
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #endif
224 
225 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::FieldField< PatchField, Type >
Foam::SlicedGeometricField::DimensionedInternalField
The internalField of a SlicedGeometricField.
Definition: SlicedGeometricField.H:185
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::SlicedGeometricField::correctBoundaryConditions
void correctBoundaryConditions()
Correct boundary field.
Foam::SlicedGeometricField::slicedBoundaryField
tmp< FieldField< PatchField, Type > > slicedBoundaryField(const Mesh &mesh, const Field< Type > &completeField, const bool preserveCouples, const bool preserveProcessorOnly=false)
Slice the given field and a create a PtrList of SlicedPatchField.
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:116
Foam::SlicedGeometricField::operator=
void operator=(const SlicedGeometricField &)
Disallow default bitwise assignment.
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.
Foam::DimensionedField::Mesh
GeoMesh::Mesh Mesh
Definition: DimensionedField.H:81
Foam::Field< Type >
Foam::SlicedGeometricField::BoundaryMesh
GeoMesh::BoundaryMesh BoundaryMesh
Definition: SlicedGeometricField.H:70
SlicedGeometricField.C
Foam::GeoMesh::BoundaryMesh
MESH::BoundaryMesh BoundaryMesh
Definition: GeoMesh.H:62
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::GeoMesh
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:46
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::SlicedGeometricField::Mesh
GeoMesh::Mesh Mesh
Definition: SlicedGeometricField.H:69
GeometricField.H
Foam::SlicedGeometricField
Specialization of GeometricField which holds slices of given complete fields in a form that they act ...
Definition: slicedSurfaceFieldsFwd.H:56
Foam::SlicedGeometricField::~SlicedGeometricField
~SlicedGeometricField()
Destructor.
Definition: SlicedGeometricField.C:353
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::GeoMesh::Mesh
MESH Mesh
Definition: GeoMesh.H:61