OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

fvFieldDecomposer.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::fvFieldDecomposer
00027 
00028 Description
00029     Finite Volume volume and surface field decomposer.
00030 
00031 SourceFiles
00032     fvFieldDecomposer.C
00033     fvFieldDecomposerDecomposeFields.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef fvFieldDecomposer_H
00038 #define fvFieldDecomposer_H
00039 
00040 #include "fvMesh.H"
00041 #include "fvPatchFieldMapper.H"
00042 #include "surfaceFields.H"
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 class IOobjectList;
00050 
00051 /*---------------------------------------------------------------------------*\
00052                     Class fvFieldDecomposer Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class fvFieldDecomposer
00056 {
00057 public:
00058 
00059         //- Patch field decomposer class
00060         class patchFieldDecomposer
00061         :
00062             public fvPatchFieldMapper
00063         {
00064             // Private data
00065 
00066                 labelList directAddressing_;
00067 
00068         public:
00069 
00070             // Constructors
00071 
00072                 //- Construct given addressing
00073                 patchFieldDecomposer
00074                 (
00075                     const unallocLabelList& addressingSlice,
00076                     const label addressingOffset
00077                 );
00078 
00079 
00080             // Member functions
00081 
00082                 label size() const
00083                 {
00084                     return directAddressing_.size();
00085                 }
00086 
00087                 bool direct() const
00088                 {
00089                     return true;
00090                 }
00091 
00092                 const unallocLabelList& directAddressing() const
00093                 {
00094                     return directAddressing_;
00095                 }
00096         };
00097 
00098 
00099         //- Processor patch field decomposer class. Maps either owner or
00100         //  neighbour data (no interpolate anymore - processorFvPatchField
00101         //  holds neighbour data)
00102         class processorVolPatchFieldDecomposer
00103         :
00104             public fvPatchFieldMapper
00105         {
00106             // Private data
00107 
00108                 labelList directAddressing_;
00109 
00110         public:
00111 
00112             //- Construct given addressing
00113             processorVolPatchFieldDecomposer
00114             (
00115                 const fvMesh& mesh,
00116                 const unallocLabelList& addressingSlice
00117             );
00118 
00119 
00120             // Member functions
00121 
00122                 label size() const
00123                 {
00124                     return directAddressing_.size();
00125                 }
00126 
00127                 bool direct() const
00128                 {
00129                     return true;
00130                 }
00131 
00132                 const unallocLabelList& directAddressing() const
00133                 {
00134                     return directAddressing_;
00135                 }
00136         };
00137 
00138 
00139         //- Processor patch field decomposer class. Surface field is assumed
00140         //  to have direction (so manipulates sign when mapping)
00141         class processorSurfacePatchFieldDecomposer
00142         :
00143             public fvPatchFieldMapper
00144         {
00145             labelListList addressing_;
00146             scalarListList weights_;
00147 
00148         public:
00149 
00150             //- Construct given addressing
00151             processorSurfacePatchFieldDecomposer
00152             (
00153                 const unallocLabelList& addressingSlice
00154             );
00155 
00156 
00157             // Member functions
00158 
00159                 label size() const
00160                 {
00161                     return addressing_.size();
00162                 }
00163 
00164                 bool direct() const
00165                 {
00166                     return false;
00167                 }
00168 
00169                 const labelListList& addressing() const
00170                 {
00171                     return addressing_;
00172                 }
00173 
00174                 const scalarListList& weights() const
00175                 {
00176                     return weights_;
00177                 }
00178         };
00179 
00180 
00181 private:
00182 
00183     // Private data
00184 
00185         //- Reference to complete mesh
00186         const fvMesh& completeMesh_;
00187 
00188         //- Reference to processor mesh
00189         const fvMesh& procMesh_;
00190 
00191         //- Reference to face addressing
00192         const labelList& faceAddressing_;
00193 
00194         //- Reference to cell addressing
00195         const labelList& cellAddressing_;
00196 
00197         //- Reference to boundary addressing
00198         const labelList& boundaryAddressing_;
00199 
00200         //- List of patch field decomposers
00201         List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
00202 
00203         List<processorVolPatchFieldDecomposer*> 
00204             processorVolPatchFieldDecomposerPtrs_;
00205 
00206         List<processorSurfacePatchFieldDecomposer*> 
00207             processorSurfacePatchFieldDecomposerPtrs_;
00208 
00209 
00210     // Private Member Functions
00211 
00212         //- Disallow default bitwise copy construct
00213         fvFieldDecomposer(const fvFieldDecomposer&);
00214 
00215         //- Disallow default bitwise assignment
00216         void operator=(const fvFieldDecomposer&);
00217 
00218 
00219 public:
00220 
00221     // Constructors
00222 
00223         //- Construct from components
00224         fvFieldDecomposer
00225         (
00226             const fvMesh& completeMesh,
00227             const fvMesh& procMesh,
00228             const labelList& faceAddressing,
00229             const labelList& cellAddressing,
00230             const labelList& boundaryAddressing
00231         );
00232 
00233 
00234     // Destructor
00235 
00236         ~fvFieldDecomposer();
00237 
00238 
00239     // Member Functions
00240 
00241         //- Decompose volume field
00242         template<class Type>
00243         tmp<GeometricField<Type, fvPatchField, volMesh> >
00244         decomposeField
00245         (
00246             const GeometricField<Type, fvPatchField, volMesh>& field
00247         ) const;
00248 
00249         //- Decompose surface field
00250         template<class Type>
00251         tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00252         decomposeField
00253         (
00254             const GeometricField<Type, fvsPatchField, surfaceMesh>& field
00255         ) const;
00256 
00257         template<class GeoField>
00258         void decomposeFields(const PtrList<GeoField>& fields) const;
00259 };
00260 
00261 
00262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00263 
00264 } // End namespace Foam
00265 
00266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00267 
00268 #ifdef NoRepository
00269 #   include "fvFieldDecomposerDecomposeFields.C"
00270 #endif
00271 
00272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00273 
00274 #endif
00275 
00276 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd