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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fvFieldDecomposer
28 
29 Description
30  Finite Volume volume and surface field decomposer.
31 
32 SourceFiles
33  fvFieldDecomposer.C
34  fvFieldDecomposerDecomposeFields.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef fvFieldDecomposer_H
39 #define fvFieldDecomposer_H
40 
41 #include "fvMesh.H"
42 #include "fvPatchFieldMapper.H"
43 #include "surfaceFields.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 class IOobjectList;
51 
52 /*---------------------------------------------------------------------------*\
53  Class fvFieldDecomposer Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 {
58 public:
59 
60  //- Patch field decomposer class
62  :
63  public fvPatchFieldMapper
64  {
65  // Private data
66 
67  labelList directAddressing_;
68 
69  public:
70 
71  // Constructors
72 
73  //- Construct given addressing
75  (
76  const labelUList& addressingSlice,
77  const label addressingOffset
78  );
79 
80 
81  // Member functions
82 
83  label size() const
84  {
85  return directAddressing_.size();
86  }
87 
88  bool direct() const
89  {
90  return true;
91  }
92 
93  //- Are there unmapped values
94  bool hasUnmapped() const
95  {
96  return false;
97  }
98 
99  const labelUList& directAddressing() const
100  {
101  return directAddressing_;
102  }
103  };
104 
105 
106  //- Processor patch field decomposer class. Maps either owner or
107  // neighbour data (no interpolate anymore - processorFvPatchField
108  // holds neighbour data)
110  :
111  public fvPatchFieldMapper
112  {
113  // Private data
114 
115  labelList directAddressing_;
116 
117  public:
118 
119  //- Construct given addressing
121  (
122  const fvMesh& mesh,
123  const labelUList& addressingSlice
124  );
125 
126 
127  // Member functions
128 
129  label size() const
130  {
131  return directAddressing_.size();
132  }
133 
134  bool direct() const
135  {
136  return true;
137  }
138 
139  //- Are there unmapped values
140  bool hasUnmapped() const
141  {
142  return false;
143  }
144 
145  const labelUList& directAddressing() const
146  {
147  return directAddressing_;
148  }
149  };
150 
151 
152  //- Processor patch field decomposer class. Surface field is assumed
153  // to have direction (so manipulates sign when mapping)
155  :
156  public fvPatchFieldMapper
157  {
158  labelListList addressing_;
159  scalarListList weights_;
160 
161  public:
162 
163  //- Construct given addressing
165  (
166  const labelUList& addressingSlice
167  );
168 
169 
170  // Member functions
171 
172  label size() const
173  {
174  return addressing_.size();
175  }
176 
177  bool direct() const
178  {
179  return false;
180  }
181 
182  //- Are there unmapped values
183  bool hasUnmapped() const
184  {
185  return false;
186  }
187 
188  const labelListList& addressing() const
189  {
190  return addressing_;
191  }
192 
193  const scalarListList& weights() const
194  {
195  return weights_;
196  }
197  };
198 
199 
200 private:
201 
202  // Private data
203 
204  //- Reference to complete mesh
205  const fvMesh& completeMesh_;
206 
207  //- Reference to processor mesh
208  const fvMesh& procMesh_;
209 
210  //- Reference to face addressing
211  const labelList& faceAddressing_;
212 
213  //- Reference to cell addressing
214  const labelList& cellAddressing_;
215 
216  //- Reference to boundary addressing
217  const labelList& boundaryAddressing_;
218 
219  //- List of patch field decomposers
220  PtrList<patchFieldDecomposer> patchFieldDecomposerPtrs_;
221 
223  processorVolPatchFieldDecomposerPtrs_;
224 
226  processorSurfacePatchFieldDecomposerPtrs_;
227 
228 
229  PtrList<scalarField> faceSign_;
230 
231 
232  // Private Member Functions
233 
234  //- No copy construct
235  fvFieldDecomposer(const fvFieldDecomposer&) = delete;
236 
237  //- No copy assignment
238  void operator=(const fvFieldDecomposer&) = delete;
239 
240 
241 public:
242 
243  // Constructors
244 
245  //- Construct from components
247  (
248  const fvMesh& completeMesh,
249  const fvMesh& procMesh,
250  const labelList& faceAddressing,
251  const labelList& cellAddressing,
252  const labelList& boundaryAddressing
253  );
254 
255 
256  //- Destructor
258 
259 
260  // Member Functions
261 
262  //- Decompose volume field
263  template<class Type>
266  (
268  const bool allowUnknownPatchFields = false
269  ) const;
270 
271  //- Decompose surface field
272  template<class Type>
275  (
277  ) const;
278 
279  template<class GeoField>
280  void decomposeFields(const PtrList<GeoField>& fields) const;
281 };
282 
283 
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 
286 } // End namespace Foam
287 
288 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289 
290 #ifdef NoRepository
292 #endif
293 
294 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
295 
296 #endif
297 
298 // ************************************************************************* //
Foam::fvFieldDecomposer::decomposeField
tmp< GeometricField< Type, fvPatchField, volMesh > > decomposeField(const GeometricField< Type, fvPatchField, volMesh > &field, const bool allowUnknownPatchFields=false) const
Decompose volume field.
Foam::fvFieldDecomposer::processorVolPatchFieldDecomposer::size
label size() const
Definition: fvFieldDecomposer.H:128
Foam::fvFieldDecomposer::processorSurfacePatchFieldDecomposer::hasUnmapped
bool hasUnmapped() const
Are there unmapped values.
Definition: fvFieldDecomposer.H:182
Foam::fvFieldDecomposer::processorSurfacePatchFieldDecomposer::size
label size() const
Definition: fvFieldDecomposer.H:171
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fvFieldDecomposer::patchFieldDecomposer::size
label size() const
Definition: fvFieldDecomposer.H:82
Foam::fvFieldDecomposer::processorSurfacePatchFieldDecomposer::processorSurfacePatchFieldDecomposer
processorSurfacePatchFieldDecomposer(const labelUList &addressingSlice)
Construct given addressing.
Definition: fvFieldDecomposer.C:99
surfaceFields.H
Foam::surfaceFields.
fvPatchFieldMapper.H
Foam::fvFieldDecomposer::processorSurfacePatchFieldDecomposer::weights
const scalarListList & weights() const
Definition: fvFieldDecomposer.H:192
Foam::fvFieldDecomposer::~fvFieldDecomposer
~fvFieldDecomposer()
Destructor.
Definition: fvFieldDecomposer.C:207
Foam::fvFieldDecomposer::processorVolPatchFieldDecomposer
Processor patch field decomposer class. Maps either owner or.
Definition: fvFieldDecomposer.H:108
Foam::fvFieldDecomposer::patchFieldDecomposer
Patch field decomposer class.
Definition: fvFieldDecomposer.H:60
Foam::fvFieldDecomposer::processorVolPatchFieldDecomposer::hasUnmapped
bool hasUnmapped() const
Are there unmapped values.
Definition: fvFieldDecomposer.H:139
Foam::fvFieldDecomposer::decomposeFields
void decomposeFields(const PtrList< GeoField > &fields) const
Definition: fvFieldDecomposerDecomposeFields.C:337
Foam::fvFieldDecomposer::patchFieldDecomposer::hasUnmapped
bool hasUnmapped() const
Are there unmapped values.
Definition: fvFieldDecomposer.H:93
field
rDeltaTY field()
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:62
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvFieldDecomposer::processorVolPatchFieldDecomposer::processorVolPatchFieldDecomposer
processorVolPatchFieldDecomposer(const fvMesh &mesh, const labelUList &addressingSlice)
Construct given addressing.
Definition: fvFieldDecomposer.C:51
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fvFieldDecomposer::processorVolPatchFieldDecomposer::directAddressing
const labelUList & directAddressing() const
Definition: fvFieldDecomposer.H:144
Foam::fvFieldDecomposer
Finite Volume volume and surface field decomposer.
Definition: fvFieldDecomposer.H:55
Foam::fvFieldDecomposer::patchFieldDecomposer::directAddressing
const labelUList & directAddressing() const
Definition: fvFieldDecomposer.H:98
Foam::fvFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
patchFieldDecomposer(const labelUList &addressingSlice, const label addressingOffset)
Construct given addressing.
Definition: fvFieldDecomposer.C:34
Foam::List< label >
Foam::fvFieldDecomposer::processorSurfacePatchFieldDecomposer::direct
bool direct() const
Definition: fvFieldDecomposer.H:176
Foam::UList< label >
Foam::fvFieldDecomposer::processorVolPatchFieldDecomposer::direct
bool direct() const
Definition: fvFieldDecomposer.H:133
fvFieldDecomposerDecomposeFields.C
Foam::fvFieldDecomposer::processorSurfacePatchFieldDecomposer
Processor patch field decomposer class. Surface field is assumed.
Definition: fvFieldDecomposer.H:153
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::fvFieldDecomposer::patchFieldDecomposer::direct
bool direct() const
Definition: fvFieldDecomposer.H:87
Foam::fvFieldDecomposer::processorSurfacePatchFieldDecomposer::addressing
const labelListList & addressing() const
Definition: fvFieldDecomposer.H:187
fields
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97