fvFieldDecomposer.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-2016 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::fvFieldDecomposer
26 
27 Description
28  Finite Volume volume and surface field decomposer.
29 
30 SourceFiles
31  fvFieldDecomposer.C
32  fvFieldDecomposerDecomposeFields.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef fvFieldDecomposer_H
37 #define fvFieldDecomposer_H
38 
39 #include "fvMesh.H"
40 #include "fvPatchFieldMapper.H"
41 #include "surfaceFields.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 class IOobjectList;
49 
50 /*---------------------------------------------------------------------------*\
51  Class fvFieldDecomposer Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 {
56 public:
57 
58  //- Patch field decomposer class
60  :
61  public fvPatchFieldMapper
62  {
63  // Private data
64 
65  labelList directAddressing_;
66 
67  public:
68 
69  // Constructors
70 
71  //- Construct given addressing
73  (
74  const labelUList& addressingSlice,
75  const label addressingOffset
76  );
77 
78 
79  // Member functions
80 
81  label size() const
82  {
83  return directAddressing_.size();
84  }
85 
86  bool direct() const
87  {
88  return true;
89  }
90 
91  //- Are there unmapped values
92  bool hasUnmapped() const
93  {
94  return false;
95  }
96 
97  const labelUList& directAddressing() const
98  {
99  return directAddressing_;
100  }
101  };
102 
103 
104  //- Processor patch field decomposer class. Maps either owner or
105  // neighbour data (no interpolate anymore - processorFvPatchField
106  // holds neighbour data)
108  :
109  public fvPatchFieldMapper
110  {
111  // Private data
112 
113  labelList directAddressing_;
114 
115  public:
116 
117  //- Construct given addressing
119  (
120  const fvMesh& mesh,
121  const labelUList& addressingSlice
122  );
123 
124 
125  // Member functions
127  label size() const
128  {
129  return directAddressing_.size();
130  }
132  bool direct() const
133  {
134  return true;
135  }
136 
137  //- Are there unmapped values
138  bool hasUnmapped() const
139  {
140  return false;
141  }
143  const labelUList& directAddressing() const
144  {
145  return directAddressing_;
146  }
147  };
148 
149 
150  //- Processor patch field decomposer class. Surface field is assumed
151  // to have direction (so manipulates sign when mapping)
153  :
154  public fvPatchFieldMapper
155  {
156  labelListList addressing_;
157  scalarListList weights_;
158 
159  public:
160 
161  //- Construct given addressing
163  (
164  const labelUList& addressingSlice
165  );
166 
167 
168  // Member functions
170  label size() const
171  {
172  return addressing_.size();
173  }
175  bool direct() const
176  {
177  return false;
178  }
179 
180  //- Are there unmapped values
181  bool hasUnmapped() const
182  {
183  return false;
184  }
186  const labelListList& addressing() const
187  {
188  return addressing_;
189  }
191  const scalarListList& weights() const
192  {
193  return weights_;
194  }
195  };
196 
197 
198 private:
199 
200  // Private data
201 
202  //- Reference to complete mesh
203  const fvMesh& completeMesh_;
204 
205  //- Reference to processor mesh
206  const fvMesh& procMesh_;
207 
208  //- Reference to face addressing
209  const labelList& faceAddressing_;
210 
211  //- Reference to cell addressing
212  const labelList& cellAddressing_;
213 
214  //- Reference to boundary addressing
215  const labelList& boundaryAddressing_;
216 
217  //- List of patch field decomposers
218  List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
219 
221  processorVolPatchFieldDecomposerPtrs_;
222 
224  processorSurfacePatchFieldDecomposerPtrs_;
225 
226 
227  // Private Member Functions
228 
229  //- Disallow default bitwise copy construct
231 
232  //- Disallow default bitwise assignment
233  void operator=(const fvFieldDecomposer&);
234 
235 
236 public:
237 
238  // Constructors
239 
240  //- Construct from components
242  (
243  const fvMesh& completeMesh,
244  const fvMesh& procMesh,
245  const labelList& faceAddressing,
246  const labelList& cellAddressing,
247  const labelList& boundaryAddressing
248  );
249 
250 
251  //- Destructor
253 
254 
255  // Member Functions
256 
257  //- Decompose volume field
258  template<class Type>
261  (
263  const bool allowUnknownPatchFields = false
264  ) const;
265 
266  //- Decompose surface field
267  template<class Type>
270  (
272  ) const;
273 
274  template<class GeoField>
275  void decomposeFields(const PtrList<GeoField>& fields) const;
276 };
277 
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 } // End namespace Foam
282 
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284 
285 #ifdef NoRepository
287 #endif
288 
289 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 
291 #endif
292 
293 // ************************************************************************* //
Foam::surfaceFields.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:163
virtual const labelListList & addressing() const
Definition: FieldMapper.H:94
Generic GeometricField class.
virtual const scalarListList & weights() const
Definition: FieldMapper.H:103
tmp< GeometricField< Type, fvPatchField, volMesh > > decomposeField(const GeometricField< Type, fvPatchField, volMesh > &field, const bool allowUnknownPatchFields=false) const
Decompose volume field.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:104
dynamicFvMesh & mesh
Foam::fvPatchFieldMapper.
Processor patch field decomposer class. Surface field is assumed.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
Finite Volume volume and surface field decomposer.
Processor patch field decomposer class. Maps either owner or.
patchFieldDecomposer(const labelUList &addressingSlice, const label addressingOffset)
Construct given addressing.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:63
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
~fvFieldDecomposer()
Destructor.
A class for managing temporary objects.
Definition: PtrList.H:53
void decomposeFields(const PtrList< GeoField > &fields) const
bool hasUnmapped() const
Are there unmapped values.
Namespace for OpenFOAM.