Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / utilities / parallelProcessing / reconstructParMesh / fvFieldReconstructor.H
blob41d1dc0477b8ce4cfed693cfd14ec15442f1668e
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::fvFieldReconstructor
27 Description
28     FV volume and surface field reconstructor.
30 SourceFiles
31     fvFieldReconstructor.C
32     fvFieldReconstructorReconstructFields.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef fvFieldReconstructor_H
37 #define fvFieldReconstructor_H
39 #include "PtrList.H"
40 #include "fvMesh.H"
41 #include "IOobjectList.H"
42 #include "fvPatchFieldMapper.H"
43 #include "labelIOList.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
51 /*---------------------------------------------------------------------------*\
52                  Class fvFieldReconstructor Declaration
53 \*---------------------------------------------------------------------------*/
55 class fvFieldReconstructor
57     // Private data
59         //- Reconstructed mesh reference
60         fvMesh& mesh_;
62         //- List of processor meshes
63         const PtrList<fvMesh>& procMeshes_;
65         //- List of processor face addressing lists
66         const PtrList<labelIOList>& faceProcAddressing_;
68         //- List of processor cell addressing lists
69         const PtrList<labelIOList>& cellProcAddressing_;
71         //- List of processor boundary addressing lists
72         const PtrList<labelIOList>& boundaryProcAddressing_;
75     // Private Member Functions
77         //- Disallow default bitwise copy construct
78         fvFieldReconstructor(const fvFieldReconstructor&);
80         //- Disallow default bitwise assignment
81         void operator=(const fvFieldReconstructor&);
84 public:
86         class fvPatchFieldReconstructor
87         :
88             public fvPatchFieldMapper
89         {
90             label size_;
91             label sizeBeforeMapping_;
93         public:
95             // Constructors
97                 //- Construct given size
98                 fvPatchFieldReconstructor
99                 (
100                     const label size,
101                     const label sizeBeforeMapping
102                 )
103                 :
104                     size_(size),
105                     sizeBeforeMapping_(sizeBeforeMapping)
106                 {}
109             // Member functions
111                 virtual label size() const
112                 {
113                     return size_;
114                 }
116                 virtual label sizeBeforeMapping() const
117                 {
118                     return sizeBeforeMapping_;
119                 }
121                 virtual bool direct() const
122                 {
123                     return true;
124                 }
126                 virtual const unallocLabelList& directAddressing() const
127                 {
128                     return unallocLabelList::null();
129                 }
130         };
133     // Constructors
135         //- Construct from components
136         fvFieldReconstructor
137         (
138             fvMesh& mesh,
139             const PtrList<fvMesh>& procMeshes,
140             const PtrList<labelIOList>& faceProcAddressing,
141             const PtrList<labelIOList>& cellProcAddressing,
142             const PtrList<labelIOList>& boundaryProcAddressing
143         );
146     // Member Functions
148         //- Reconstruct volume field
149         template<class Type>
150         tmp<GeometricField<Type, fvPatchField, volMesh> >
151         reconstructFvVolumeField
152         (
153             const IOobject& fieldIoObject
154         );
156         //- Reconstruct surface field
157         template<class Type>
158         tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
159         reconstructFvSurfaceField
160         (
161             const IOobject& fieldIoObject
162         );
164         //- Reconstruct and write all/selected volume fields
165         template<class Type>
166         void reconstructFvVolumeFields
167         (
168             const IOobjectList& objects,
169             const HashSet<word>& selectedFields
170         );
172         //- Reconstruct and write all/selected volume fields
173         template<class Type>
174         void reconstructFvSurfaceFields
175         (
176             const IOobjectList& objects,
177             const HashSet<word>& selectedFields
178         );
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 } // End namespace Foam
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 #ifdef NoRepository
189 #   include "fvFieldReconstructorReconstructFields.C"
190 #endif
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 #endif
196 // ************************************************************************* //