FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <finiteVolume/fvMesh.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 unallocLabelList& 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 
92  {
93  return directAddressing_;
94  }
95  };
96 
97 
98  //- Processor patch field decomposer class. Maps either owner or
99  // neighbour data (no interpolate anymore - processorFvPatchField
100  // holds neighbour data)
102  :
103  public fvPatchFieldMapper
104  {
105  // Private data
106 
107  labelList directAddressing_;
108 
109  public:
110 
111  //- Construct given addressing
113  (
114  const fvMesh& mesh,
115  const unallocLabelList& addressingSlice
116  );
117 
118 
119  // Member functions
120 
121  label size() const
122  {
123  return directAddressing_.size();
124  }
125 
126  bool direct() const
127  {
128  return true;
129  }
130 
132  {
133  return directAddressing_;
134  }
135  };
136 
137 
138  //- Processor patch field decomposer class. Surface field is assumed
139  // to have direction (so manipulates sign when mapping)
141  :
142  public fvPatchFieldMapper
143  {
144  labelListList addressing_;
145  scalarListList weights_;
146 
147  public:
148 
149  //- Construct given addressing
151  (
152  const unallocLabelList& addressingSlice
153  );
154 
155 
156  // Member functions
157 
158  label size() const
159  {
160  return addressing_.size();
161  }
162 
163  bool direct() const
164  {
165  return false;
166  }
167 
168  const labelListList& addressing() const
169  {
170  return addressing_;
171  }
172 
173  const scalarListList& weights() const
174  {
175  return weights_;
176  }
177  };
178 
179 
180 private:
181 
182  // Private data
183 
184  //- Reference to complete mesh
185  const fvMesh& completeMesh_;
186 
187  //- Reference to processor mesh
188  const fvMesh& procMesh_;
189 
190  //- Reference to face addressing
191  const labelList& faceAddressing_;
192 
193  //- Reference to cell addressing
194  const labelList& cellAddressing_;
195 
196  //- Reference to boundary addressing
197  const labelList& boundaryAddressing_;
198 
199  //- List of patch field decomposers
200  List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
201 
203  processorVolPatchFieldDecomposerPtrs_;
204 
206  processorSurfacePatchFieldDecomposerPtrs_;
207 
208 
209  // Private Member Functions
210 
211  //- Disallow default bitwise copy construct
213 
214  //- Disallow default bitwise assignment
215  void operator=(const fvFieldDecomposer&);
216 
217 
218 public:
219 
220  // Constructors
221 
222  //- Construct from components
224  (
225  const fvMesh& completeMesh,
226  const fvMesh& procMesh,
227  const labelList& faceAddressing,
228  const labelList& cellAddressing,
229  const labelList& boundaryAddressing
230  );
231 
232 
233  // Destructor
234 
236 
237 
238  // Member Functions
239 
240  //- Decompose volume field
241  template<class Type>
244  (
246  ) const;
247 
248  //- Decompose surface field
249  template<class Type>
252  (
254  ) const;
255 
256  template<class GeoField>
257  void decomposeFields(const PtrList<GeoField>& fields) const;
258 };
259 
260 
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 
263 } // End namespace Foam
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 #ifdef NoRepository
269 #endif
270 
271 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
272 
273 #endif
274 
275 // ************************ vim: set sw=4 sts=4 et: ************************ //