Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / utilities / parallelProcessing / decomposePar / pointFieldDecomposer.H
blob9e6067126f6f96c4e2faa662c61ec8c28cdac76e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::pointFieldDecomposer
27 Description
28     Point field decomposer.
30 SourceFiles
31     pointFieldDecomposer.C
32     pointFieldDecomposerDecomposeFields.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef pointFieldDecomposer_H
37 #define pointFieldDecomposer_H
39 #include "pointMesh.H"
40 #include "PointPatchFieldMapperPatchRef.H"
41 #include "pointFields.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                Class pointFieldDecomposer Declaration
50 \*---------------------------------------------------------------------------*/
52 class pointFieldDecomposer
55 public:
57         //- Point patch field decomposer class
58         class patchFieldDecomposer
59         :
60             public PointPatchFieldMapperPatchRef<pointPatch>
61         {
62             // Private data
64                 //- Size before mapping
65                 label sizeBeforeMapping_;
67                 //- Reference to direct addressing
68                 labelList directAddressing_;
71         public:
73             // Constructors
75                 //- Construct given addressing
76                 patchFieldDecomposer
77                 (
78                     const pointPatch& completeMeshPatch,
79                     const pointPatch& procMeshPatch,
80                     const labelList& directAddr
81                 );
84             // Member functions
86                 label size() const
87                 {
88                     return directAddressing_.size();
89                 }
91                 virtual label sizeBeforeMapping() const
92                 {
93                     return sizeBeforeMapping_;
94                 }
96                 bool direct() const
97                 {
98                     return true;
99                 }
101                 const unallocLabelList& directAddressing() const
102                 {
103                     return directAddressing_;
104                 }
105         };
108 private:
110     // Private data
112         //- Reference to complete mesh
113         const pointMesh& completeMesh_;
115         //- Reference to processor mesh
116         const pointMesh& procMesh_;
118         //- Reference to point addressing
119         const labelList& pointAddressing_;
121         //- Reference to boundary addressing
122         const labelList& boundaryAddressing_;
124         //- List of patch field decomposers
125         List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
128     // Private Member Functions
130         //- Disallow default bitwise copy construct
131         pointFieldDecomposer(const pointFieldDecomposer&);
133         //- Disallow default bitwise assignment
134         void operator=(const pointFieldDecomposer&);
137 public:
139     // Constructors
141         //- Construct from components
142         pointFieldDecomposer
143         (
144             const pointMesh& completeMesh,
145             const pointMesh& procMesh,
146             const labelList& pointAddressing,
147             const labelList& boundaryAddressing
148         );
151     // Destructor
153         ~pointFieldDecomposer();
156     // Member Functions
158         //- Decompose point field
159         template<class Type>
160         tmp<GeometricField<Type, pointPatchField, pointMesh> >
161         decomposeField
162         (
163             const GeometricField<Type, pointPatchField, pointMesh>&
164         ) const;
166         template<class GeoField>
167         void decomposeFields(const PtrList<GeoField>& fields) const;
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 } // End namespace Foam
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 #ifdef NoRepository
178 #   include "pointFieldDecomposerDecomposeFields.C"
179 #endif
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 #endif
185 // ************************************************************************* //