FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::fvFieldDecomposer
00026 
00027 Description
00028     Finite Volume volume and surface field decomposer.
00029 
00030 SourceFiles
00031     fvFieldDecomposer.C
00032     fvFieldDecomposerDecomposeFields.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef fvFieldDecomposer_H
00037 #define fvFieldDecomposer_H
00038 
00039 #include <finiteVolume/fvMesh.H>
00040 #include <finiteVolume/fvPatchFieldMapper.H>
00041 #include <finiteVolume/surfaceFields.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 class IOobjectList;
00049 
00050 /*---------------------------------------------------------------------------*\
00051                     Class fvFieldDecomposer Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 class fvFieldDecomposer
00055 {
00056 public:
00057 
00058         //- Patch field decomposer class
00059         class patchFieldDecomposer
00060         :
00061             public fvPatchFieldMapper
00062         {
00063             // Private data
00064 
00065                 labelList directAddressing_;
00066 
00067         public:
00068 
00069             // Constructors
00070 
00071                 //- Construct given addressing
00072                 patchFieldDecomposer
00073                 (
00074                     const unallocLabelList& addressingSlice,
00075                     const label addressingOffset
00076                 );
00077 
00078 
00079             // Member functions
00080 
00081                 label size() const
00082                 {
00083                     return directAddressing_.size();
00084                 }
00085 
00086                 bool direct() const
00087                 {
00088                     return true;
00089                 }
00090 
00091                 const unallocLabelList& directAddressing() const
00092                 {
00093                     return directAddressing_;
00094                 }
00095         };
00096 
00097 
00098         //- Processor patch field decomposer class. Maps either owner or
00099         //  neighbour data (no interpolate anymore - processorFvPatchField
00100         //  holds neighbour data)
00101         class processorVolPatchFieldDecomposer
00102         :
00103             public fvPatchFieldMapper
00104         {
00105             // Private data
00106 
00107                 labelList directAddressing_;
00108 
00109         public:
00110 
00111             //- Construct given addressing
00112             processorVolPatchFieldDecomposer
00113             (
00114                 const fvMesh& mesh,
00115                 const unallocLabelList& addressingSlice
00116             );
00117 
00118 
00119             // Member functions
00120 
00121                 label size() const
00122                 {
00123                     return directAddressing_.size();
00124                 }
00125 
00126                 bool direct() const
00127                 {
00128                     return true;
00129                 }
00130 
00131                 const unallocLabelList& directAddressing() const
00132                 {
00133                     return directAddressing_;
00134                 }
00135         };
00136 
00137 
00138         //- Processor patch field decomposer class. Surface field is assumed
00139         //  to have direction (so manipulates sign when mapping)
00140         class processorSurfacePatchFieldDecomposer
00141         :
00142             public fvPatchFieldMapper
00143         {
00144             labelListList addressing_;
00145             scalarListList weights_;
00146 
00147         public:
00148 
00149             //- Construct given addressing
00150             processorSurfacePatchFieldDecomposer
00151             (
00152                 const unallocLabelList& addressingSlice
00153             );
00154 
00155 
00156             // Member functions
00157 
00158                 label size() const
00159                 {
00160                     return addressing_.size();
00161                 }
00162 
00163                 bool direct() const
00164                 {
00165                     return false;
00166                 }
00167 
00168                 const labelListList& addressing() const
00169                 {
00170                     return addressing_;
00171                 }
00172 
00173                 const scalarListList& weights() const
00174                 {
00175                     return weights_;
00176                 }
00177         };
00178 
00179 
00180 private:
00181 
00182     // Private data
00183 
00184         //- Reference to complete mesh
00185         const fvMesh& completeMesh_;
00186 
00187         //- Reference to processor mesh
00188         const fvMesh& procMesh_;
00189 
00190         //- Reference to face addressing
00191         const labelList& faceAddressing_;
00192 
00193         //- Reference to cell addressing
00194         const labelList& cellAddressing_;
00195 
00196         //- Reference to boundary addressing
00197         const labelList& boundaryAddressing_;
00198 
00199         //- List of patch field decomposers
00200         List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
00201 
00202         List<processorVolPatchFieldDecomposer*> 
00203             processorVolPatchFieldDecomposerPtrs_;
00204 
00205         List<processorSurfacePatchFieldDecomposer*> 
00206             processorSurfacePatchFieldDecomposerPtrs_;
00207 
00208 
00209     // Private Member Functions
00210 
00211         //- Disallow default bitwise copy construct
00212         fvFieldDecomposer(const fvFieldDecomposer&);
00213 
00214         //- Disallow default bitwise assignment
00215         void operator=(const fvFieldDecomposer&);
00216 
00217 
00218 public:
00219 
00220     // Constructors
00221 
00222         //- Construct from components
00223         fvFieldDecomposer
00224         (
00225             const fvMesh& completeMesh,
00226             const fvMesh& procMesh,
00227             const labelList& faceAddressing,
00228             const labelList& cellAddressing,
00229             const labelList& boundaryAddressing
00230         );
00231 
00232 
00233     // Destructor
00234 
00235         ~fvFieldDecomposer();
00236 
00237 
00238     // Member Functions
00239 
00240         //- Decompose volume field
00241         template<class Type>
00242         tmp<GeometricField<Type, fvPatchField, volMesh> >
00243         decomposeField
00244         (
00245             const GeometricField<Type, fvPatchField, volMesh>& field
00246         ) const;
00247 
00248         //- Decompose surface field
00249         template<class Type>
00250         tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00251         decomposeField
00252         (
00253             const GeometricField<Type, fvsPatchField, surfaceMesh>& field
00254         ) const;
00255 
00256         template<class GeoField>
00257         void decomposeFields(const PtrList<GeoField>& fields) const;
00258 };
00259 
00260 
00261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00262 
00263 } // End namespace Foam
00264 
00265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00266 
00267 #ifdef NoRepository
00268 #   include "fvFieldDecomposerDecomposeFields.C"
00269 #endif
00270 
00271 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00272 
00273 #endif
00274 
00275 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines