BUGFIX: Uninitialised member variables
[foam-extend-3.2.git] / applications / utilities / parallelProcessing / decomposePar / faFieldDecomposer.H
blob4e90c2c4a02564f6ad656c87487cd9c13faf0c09
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     faFieldDecomposer
28 Description
29     Finite Area area and edge field decomposer.
31 Author
32     Zeljko Tukovic, FSB Zagreb.  All rights reserved
34 SourceFiles
35     faFieldDecomposer.C
36     faFieldDecomposerDecomposeFields.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef faFieldDecomposer_H
41 #define faFieldDecomposer_H
43 // #include "faMesh.H"
44 // #include "faPatchFieldMapper.H"
45 #include "faMesh.H"
46 #include "faPatchFieldMapper.H"
47 #include "edgeFields.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 namespace Foam
54 class IOobjectList;
56 /*---------------------------------------------------------------------------*\
57                     Class faFieldDecomposer Declaration
58 \*---------------------------------------------------------------------------*/
60 class faFieldDecomposer
62 public:
64         //- Patch field decomposer class
65         class patchFieldDecomposer
66         :
67             public faPatchFieldMapper
68         {
69             // Private data
71                 label sizeBeforeMapping_;
72                 labelList directAddressing_;
74         public:
76             // Constructors
78                 //- Construct given addressing
79                 patchFieldDecomposer
80                 (
81                     const label sizeBeforeMapping,
82                     const unallocLabelList& addressingSlice,
83                     const label addressingOffset
84                 );
87             // Member functions
89                 label size() const
90                 {
91                     return directAddressing_.size();
92                 }
94                 virtual label sizeBeforeMapping() const
95                 {
96                     return sizeBeforeMapping_;
97                 }
99                 bool direct() const
100                 {
101                     return true;
102                 }
104                 const unallocLabelList& directAddressing() const
105                 {
106                     return directAddressing_;
107                 }
108         };
111         //- Processor patch field decomposer class
112         class processorAreaPatchFieldDecomposer
113         :
114             public faPatchFieldMapper
115         {
116             // Private data
118                 label sizeBeforeMapping_;
119                 labelListList addressing_;
120                 scalarListList weights_;
122         public:
124             //- Construct given addressing
125             processorAreaPatchFieldDecomposer
126             (
127                 const faMesh& mesh,
128                 const unallocLabelList& addressingSlice
129             );
132             // Member functions
134                 label size() const
135                 {
136                     return addressing_.size();
137                 }
139                 virtual label sizeBeforeMapping() const
140                 {
141                     return sizeBeforeMapping_;
142                 }
144                 bool direct() const
145                 {
146                     return false;
147                 }
149                 const labelListList& addressing() const
150                 {
151                     return addressing_;
152                 }
154                 const scalarListList& weights() const
155                 {
156                     return weights_;
157                 }
158         };
161         //- Processor patch field decomposer class
162         class processorEdgePatchFieldDecomposer
163         :
164             public faPatchFieldMapper
165         {
166             label sizeBeforeMapping_;
167             labelListList addressing_;
168             scalarListList weights_;
170         public:
172             //- Construct given addressing
173             processorEdgePatchFieldDecomposer
174             (
175                 label sizeBeforeMapping,
176                 const unallocLabelList& addressingSlice
177             );
180             // Member functions
182                 label size() const
183                 {
184                     return addressing_.size();
185                 }
187                 virtual label sizeBeforeMapping() const
188                 {
189                     return sizeBeforeMapping_;
190                 }
192                 bool direct() const
193                 {
194                     return false;
195                 }
197                 const labelListList& addressing() const
198                 {
199                     return addressing_;
200                 }
202                 const scalarListList& weights() const
203                 {
204                     return weights_;
205                 }
206         };
209 private:
211     // Private data
213         //- Reference to complete mesh
214         const faMesh& completeMesh_;
216         //- Reference to processor mesh
217         const faMesh& procMesh_;
219         //- Reference to edge addressing
220         const labelList& edgeAddressing_;
222         //- Reference to face addressing
223         const labelList& faceAddressing_;
225         //- Reference to boundary addressing
226         const labelList& boundaryAddressing_;
228         //- List of patch field decomposers
229         List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
231         List<processorAreaPatchFieldDecomposer*>
232             processorAreaPatchFieldDecomposerPtrs_;
234         List<processorEdgePatchFieldDecomposer*>
235             processorEdgePatchFieldDecomposerPtrs_;
238     // Private Member Functions
240         //- Disallow default bitwise copy construct
241         faFieldDecomposer(const faFieldDecomposer&);
243         //- Disallow default bitwise assignment
244         void operator=(const faFieldDecomposer&);
247 public:
249     // Constructors
251         //- Construct from components
252         faFieldDecomposer
253         (
254             const faMesh& completeMesh,
255             const faMesh& procMesh,
256             const labelList& edgeAddressing,
257             const labelList& faceAddressing,
258             const labelList& boundaryAddressing
259         );
262     // Destructor
264         ~faFieldDecomposer();
267     // Member Functions
269         //- Decompose area field
270         template<class Type>
271         tmp<GeometricField<Type, faPatchField, areaMesh> >
272         decomposeField
273         (
274             const GeometricField<Type, faPatchField, areaMesh>& field
275         ) const;
277         //- Decompose surface field
278         template<class Type>
279         tmp<GeometricField<Type, faePatchField, edgeMesh> >
280         decomposeField
281         (
282             const GeometricField<Type, faePatchField, edgeMesh>& field
283         ) const;
285         template<class GeoField>
286         void decomposeFields(const PtrList<GeoField>& fields) const;
290 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
292 } // End namespace Foam
294 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
296 #ifdef NoRepository
297 #   include "faFieldDecomposerDecomposeFields.C"
298 #endif
300 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
302 #endif
304 // ************************************************************************* //