BUGFIX: Illegal use of uninitialised value (backport)
[foam-extend-3.2.git] / applications / utilities / parallelProcessing / decomposePar / pointFieldDecomposer.H
blob5eee5c812f15e34c5f4d57d353f6ee8c50c7c7ee
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     Foam::pointFieldDecomposer
28 Description
29     Point field decomposer.
31 SourceFiles
32     pointFieldDecomposer.C
33     pointFieldDecomposerDecomposeFields.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef pointFieldDecomposer_H
38 #define pointFieldDecomposer_H
40 #include "pointMesh.H"
41 #include "PointPatchFieldMapperPatchRef.H"
42 #include "pointFields.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 /*---------------------------------------------------------------------------*\
50                Class pointFieldDecomposer Declaration
51 \*---------------------------------------------------------------------------*/
53 class pointFieldDecomposer
56 public:
58         //- Point patch field decomposer class
59         class patchFieldDecomposer
60         :
61             public PointPatchFieldMapperPatchRef<pointPatch>
62         {
63             // Private data
65                 //- Size before mapping
66                 label sizeBeforeMapping_;
68                 //- Reference to direct addressing
69                 labelList directAddressing_;
72         public:
74             // Constructors
76                 //- Construct given addressing
77                 patchFieldDecomposer
78                 (
79                     const pointPatch& completeMeshPatch,
80                     const pointPatch& procMeshPatch,
81                     const labelList& directAddr
82                 );
85             // Member functions
87                 label size() const
88                 {
89                     return directAddressing_.size();
90                 }
92                 virtual label sizeBeforeMapping() const
93                 {
94                     return sizeBeforeMapping_;
95                 }
97                 bool direct() const
98                 {
99                     return true;
100                 }
102                 const unallocLabelList& directAddressing() const
103                 {
104                     return directAddressing_;
105                 }
106         };
109 private:
111     // Private data
113         //- Reference to complete mesh
114         const pointMesh& completeMesh_;
116         //- Reference to processor mesh
117         const pointMesh& procMesh_;
119         //- Reference to point addressing
120         const labelList& pointAddressing_;
122         //- Reference to boundary addressing
123         const labelList& boundaryAddressing_;
125         //- List of patch field decomposers
126         List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
129     // Private Member Functions
131         //- Disallow default bitwise copy construct
132         pointFieldDecomposer(const pointFieldDecomposer&);
134         //- Disallow default bitwise assignment
135         void operator=(const pointFieldDecomposer&);
138 public:
140     // Constructors
142         //- Construct from components
143         pointFieldDecomposer
144         (
145             const pointMesh& completeMesh,
146             const pointMesh& procMesh,
147             const labelList& pointAddressing,
148             const labelList& boundaryAddressing
149         );
152     // Destructor
154         ~pointFieldDecomposer();
157     // Member Functions
159         //- Decompose point field
160         template<class Type>
161         tmp<GeometricField<Type, pointPatchField, pointMesh> >
162         decomposeField
163         (
164             const GeometricField<Type, pointPatchField, pointMesh>&
165         ) const;
167         template<class GeoField>
168         void decomposeFields(const PtrList<GeoField>& fields) const;
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 } // End namespace Foam
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 #ifdef NoRepository
179 #   include "pointFieldDecomposerDecomposeFields.C"
180 #endif
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 #endif
186 // ************************************************************************* //