1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::fvFieldDecomposer
29 Finite Volume volume and surface field decomposer.
33 fvFieldDecomposerDecomposeFields.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef fvFieldDecomposer_H
38 #define fvFieldDecomposer_H
41 #include "fvPatchFieldMapper.H"
42 #include "surfaceFields.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 /*---------------------------------------------------------------------------*\
52 Class fvFieldDecomposer Declaration
53 \*---------------------------------------------------------------------------*/
55 class fvFieldDecomposer
59 //- Patch field decomposer class
60 class patchFieldDecomposer
62 public fvPatchFieldMapper
66 labelList directAddressing_;
72 //- Construct given addressing
75 const unallocLabelList& addressingSlice,
76 const label addressingOffset
84 return directAddressing_.size();
92 const unallocLabelList& directAddressing() const
94 return directAddressing_;
99 //- Processor patch field decomposer class. Maps either owner or
100 // neighbour data (no interpolate anymore - processorFvPatchField
101 // holds neighbour data)
102 class processorVolPatchFieldDecomposer
104 public fvPatchFieldMapper
108 labelList directAddressing_;
112 //- Construct given addressing
113 processorVolPatchFieldDecomposer
116 const unallocLabelList& addressingSlice
124 return directAddressing_.size();
132 const unallocLabelList& directAddressing() const
134 return directAddressing_;
139 //- Processor patch field decomposer class. Surface field is assumed
140 // to have direction (so manipulates sign when mapping)
141 class processorSurfacePatchFieldDecomposer
143 public fvPatchFieldMapper
145 labelListList addressing_;
146 scalarListList weights_;
150 //- Construct given addressing
151 processorSurfacePatchFieldDecomposer
153 const unallocLabelList& addressingSlice
161 return addressing_.size();
169 const labelListList& addressing() const
174 const scalarListList& weights() const
185 //- Reference to complete mesh
186 const fvMesh& completeMesh_;
188 //- Reference to processor mesh
189 const fvMesh& procMesh_;
191 //- Reference to face addressing
192 const labelList& faceAddressing_;
194 //- Reference to cell addressing
195 const labelList& cellAddressing_;
197 //- Reference to boundary addressing
198 const labelList& boundaryAddressing_;
200 //- List of patch field decomposers
201 List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
203 List<processorVolPatchFieldDecomposer*>
204 processorVolPatchFieldDecomposerPtrs_;
206 List<processorSurfacePatchFieldDecomposer*>
207 processorSurfacePatchFieldDecomposerPtrs_;
210 // Private Member Functions
212 //- Disallow default bitwise copy construct
213 fvFieldDecomposer(const fvFieldDecomposer&);
215 //- Disallow default bitwise assignment
216 void operator=(const fvFieldDecomposer&);
223 //- Construct from components
226 const fvMesh& completeMesh,
227 const fvMesh& procMesh,
228 const labelList& faceAddressing,
229 const labelList& cellAddressing,
230 const labelList& boundaryAddressing
236 ~fvFieldDecomposer();
241 //- Decompose volume field
243 tmp<GeometricField<Type, fvPatchField, volMesh> >
246 const GeometricField<Type, fvPatchField, volMesh>& field
249 //- Decompose surface field
251 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
254 const GeometricField<Type, fvsPatchField, surfaceMesh>& field
257 template<class GeoField>
258 void decomposeFields(const PtrList<GeoField>& fields) const;
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 } // End namespace Foam
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 # include "fvFieldDecomposerDecomposeFields.C"
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 // ************************************************************************* //