faFieldDecomposer.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) 2016-2017 Wikki Ltd
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::faFieldDecomposer
28 
29 Description
30  Finite Area area and edge field decomposer.
31 
32 Author
33  Zeljko Tukovic, FSB Zagreb
34  Hrvoje Jasak, Wikki Ltd.
35 
36 SourceFiles
37  faFieldDecomposer.C
38  faFieldDecomposerDecomposeFields.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef faFieldDecomposer_H
43 #define faFieldDecomposer_H
44 
45 #include "faMesh.H"
46 #include "faPatchFieldMapper.H"
47 #include "edgeFields.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 class IOobjectList;
55 
56 /*---------------------------------------------------------------------------*\
57  Class faFieldDecomposer Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 {
62 public:
63 
64  //- Patch field decomposer class
66  :
67  public faPatchFieldMapper
68  {
69  // Private data
70 
71  label sizeBeforeMapping_;
72  labelList directAddressing_;
73 
74  public:
75 
76  // Constructors
77 
78  //- Construct given addressing
80  (
81  const label sizeBeforeMapping,
82  const labelUList& addressingSlice,
83  const label addressingOffset
84  );
85 
86 
87  // Member functions
88 
89  label size() const
90  {
91  return directAddressing_.size();
92  }
93 
94  virtual label sizeBeforeMapping() const
95  {
96  return sizeBeforeMapping_;
97  }
98 
99  bool direct() const
100  {
101  return true;
102  }
103 
104  virtual bool hasUnmapped() const
105  {
106  return false;
107  }
108 
109  const labelUList& directAddressing() const
110  {
111  return directAddressing_;
112  }
113  };
114 
115 
116  //- Processor patch field decomposer class
118  :
119  public faPatchFieldMapper
120  {
121  // Private data
122 
123  label sizeBeforeMapping_;
124  labelListList addressing_;
125  scalarListList weights_;
126 
127  public:
128 
129  //- Construct given addressing
131  (
132  const faMesh& mesh,
133  const labelUList& addressingSlice
134  );
135 
136 
137  // Member functions
138 
139  label size() const
140  {
141  return addressing_.size();
142  }
143 
144  virtual label sizeBeforeMapping() const
145  {
146  return sizeBeforeMapping_;
147  }
148 
149  bool direct() const
150  {
151  return false;
152  }
153 
154  virtual bool hasUnmapped() const
155  {
156  return false;
157  }
158 
159  const labelListList& addressing() const
160  {
161  return addressing_;
162  }
163 
164  const scalarListList& weights() const
165  {
166  return weights_;
167  }
168  };
169 
170 
171  //- Processor patch field decomposer class
173  :
174  public faPatchFieldMapper
175  {
176  label sizeBeforeMapping_;
177  labelListList addressing_;
178  scalarListList weights_;
179 
180  public:
181 
182  //- Construct given addressing
184  (
185  label sizeBeforeMapping,
186  const labelUList& addressingSlice
187  );
188 
189 
190  // Member functions
191 
192  label size() const
193  {
194  return addressing_.size();
195  }
196 
197  virtual label sizeBeforeMapping() const
198  {
199  return sizeBeforeMapping_;
200  }
201 
202  bool direct() const
203  {
204  return false;
205  }
206 
207  virtual bool hasUnmapped() const
208  {
209  return false;
210  }
211 
212  const labelListList& addressing() const
213  {
214  return addressing_;
215  }
216 
217  const scalarListList& weights() const
218  {
219  return weights_;
220  }
221  };
222 
223 
224 private:
225 
226  // Private data
227 
228  //- Reference to complete mesh
229  const faMesh& completeMesh_;
230 
231  //- Reference to processor mesh
232  const faMesh& procMesh_;
233 
234  //- Reference to edge addressing
235  const labelList& edgeAddressing_;
236 
237  //- Reference to face addressing
238  const labelList& faceAddressing_;
239 
240  //- Reference to boundary addressing
241  const labelList& boundaryAddressing_;
242 
243  //- List of patch field decomposers
244  List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
245 
247  processorAreaPatchFieldDecomposerPtrs_;
248 
250  processorEdgePatchFieldDecomposerPtrs_;
251 
252 
253  // Private Member Functions
254 
255  //- No copy construct
256  faFieldDecomposer(const faFieldDecomposer&) = delete;
257 
258  //- No copy assignment
259  void operator=(const faFieldDecomposer&) = delete;
260 
261 
262 public:
263 
264  // Constructors
265 
266  //- Construct from components
268  (
269  const faMesh& completeMesh,
270  const faMesh& procMesh,
271  const labelList& edgeAddressing,
272  const labelList& faceAddressing,
273  const labelList& boundaryAddressing
274  );
275 
276 
277  // Destructor
278 
280 
281 
282  // Member Functions
283 
284  //- Decompose area field
285  template<class Type>
288  (
290  ) const;
291 
292  //- Decompose surface field
293  template<class Type>
296  (
298  ) const;
299 
300  template<class GeoField>
301  void decomposeFields(const PtrList<GeoField>& fields) const;
302 };
303 
304 
305 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306 
307 } // End namespace Foam
308 
309 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310 
311 #ifdef NoRepository
313 #endif
314 
315 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316 
317 #endif
318 
319 // ************************************************************************* //
Foam::faFieldDecomposer::processorAreaPatchFieldDecomposer
Processor patch field decomposer class.
Definition: faFieldDecomposer.H:116
Foam::faFieldDecomposer::~faFieldDecomposer
~faFieldDecomposer()
Foam::faFieldDecomposer::processorAreaPatchFieldDecomposer::direct
bool direct() const
Definition: faFieldDecomposer.H:148
Foam::faFieldDecomposer::processorAreaPatchFieldDecomposer::addressing
const labelListList & addressing() const
Definition: faFieldDecomposer.H:158
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::faFieldDecomposer
Finite Area area and edge field decomposer.
Definition: faFieldDecomposer.H:59
Foam::faFieldDecomposer::decomposeField
tmp< GeometricField< Type, faPatchField, areaMesh > > decomposeField(const GeometricField< Type, faPatchField, areaMesh > &field) const
Decompose area field.
faMesh.H
Foam::faFieldDecomposer::patchFieldDecomposer::size
label size() const
Definition: faFieldDecomposer.H:88
Foam::faPatchFieldMapper
Definition: faPatchFieldMapper.H:44
Foam::faFieldDecomposer::processorEdgePatchFieldDecomposer::direct
bool direct() const
Definition: faFieldDecomposer.H:201
faPatchFieldMapper.H
Foam::faFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
patchFieldDecomposer(const label sizeBeforeMapping, const labelUList &addressingSlice, const label addressingOffset)
Construct given addressing.
Foam::faFieldDecomposer::processorAreaPatchFieldDecomposer::size
label size() const
Definition: faFieldDecomposer.H:138
Foam::faFieldDecomposer::patchFieldDecomposer::directAddressing
const labelUList & directAddressing() const
Definition: faFieldDecomposer.H:108
Foam::faFieldDecomposer::patchFieldDecomposer::sizeBeforeMapping
virtual label sizeBeforeMapping() const
Definition: faFieldDecomposer.H:93
Foam::faFieldDecomposer::processorEdgePatchFieldDecomposer
Processor patch field decomposer class.
Definition: faFieldDecomposer.H:171
edgeFields.H
Foam::faFieldDecomposer::processorEdgePatchFieldDecomposer::processorEdgePatchFieldDecomposer
processorEdgePatchFieldDecomposer(label sizeBeforeMapping, const labelUList &addressingSlice)
Construct given addressing.
Foam::faFieldDecomposer::processorEdgePatchFieldDecomposer::hasUnmapped
virtual bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: faFieldDecomposer.H:206
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
Foam::faFieldDecomposer::patchFieldDecomposer::direct
bool direct() const
Definition: faFieldDecomposer.H:98
Foam::faFieldDecomposer::patchFieldDecomposer::hasUnmapped
virtual bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: faFieldDecomposer.H:103
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::faFieldDecomposer::processorEdgePatchFieldDecomposer::weights
const scalarListList & weights() const
Definition: faFieldDecomposer.H:216
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::faFieldDecomposer::processorAreaPatchFieldDecomposer::processorAreaPatchFieldDecomposer
processorAreaPatchFieldDecomposer(const faMesh &mesh, const labelUList &addressingSlice)
Construct given addressing.
Foam::faFieldDecomposer::processorAreaPatchFieldDecomposer::sizeBeforeMapping
virtual label sizeBeforeMapping() const
Definition: faFieldDecomposer.H:143
Foam::faFieldDecomposer::processorAreaPatchFieldDecomposer::weights
const scalarListList & weights() const
Definition: faFieldDecomposer.H:163
Foam::faFieldDecomposer::patchFieldDecomposer
Patch field decomposer class.
Definition: faFieldDecomposer.H:64
Foam::List< label >
Foam::UList< label >
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:77
Foam::faFieldDecomposer::processorEdgePatchFieldDecomposer::size
label size() const
Definition: faFieldDecomposer.H:191
Foam::faFieldDecomposer::decomposeFields
void decomposeFields(const PtrList< GeoField > &fields) const
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::faFieldDecomposer::processorEdgePatchFieldDecomposer::sizeBeforeMapping
virtual label sizeBeforeMapping() const
Definition: faFieldDecomposer.H:196
fields
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
faFieldDecomposerDecomposeFields.C
Foam::faFieldDecomposer::processorEdgePatchFieldDecomposer::addressing
const labelListList & addressing() const
Definition: faFieldDecomposer.H:211
Foam::faFieldDecomposer::processorAreaPatchFieldDecomposer::hasUnmapped
virtual bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: faFieldDecomposer.H:153