OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

fvMeshAdder.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-2007 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00024 
00025 Class
00026     fvMeshAdder
00027 
00028 Description
00029     Adds two fvMeshes without using any polyMesh morphing.
00030     Uses fvMeshAdder.
00031 
00032 SourceFiles
00033     fvMeshAdder.C
00034     fvMeshAdderTemplates.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef fvMeshAdder_H
00039 #define fvMeshAdder_H
00040 
00041 #include "polyMeshAdder.H"
00042 #include "fvPatchFieldsFwd.H"
00043 #include "fvPatchFieldMapper.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 // Class forward declarations
00051 class IOobject;
00052 class faceCoupleInfo;
00053 class IOobjectList;
00054 class fvMesh;
00055 class volMesh;
00056 class surfaceMesh;
00057 class mapAddedPolyMesh;
00058 
00059 /*---------------------------------------------------------------------------*\
00060                            Class fvMeshAdder Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 class fvMeshAdder
00064 :
00065     public polyMeshAdder
00066 {
00067 
00068 private:
00069 
00070 
00071     // Private class
00072 
00073     class directFvPatchFieldMapper
00074     :
00075         public fvPatchFieldMapper
00076     {
00077         // Private data
00078 
00079             const labelList& directAddressing_;
00080 
00081     public:
00082 
00083         // Constructors
00084 
00085             //- Construct from components
00086             directFvPatchFieldMapper(const labelList& directAddressing)
00087             :
00088                 fvPatchFieldMapper(),
00089                 directAddressing_(directAddressing)
00090             {}
00091 
00092 
00093         // Destructor
00094 
00095             virtual ~directFvPatchFieldMapper()
00096             {}
00097 
00098 
00099         // Member Functions
00100 
00101             label size() const
00102             {
00103                 return directAddressing_.size();
00104             }
00105 
00106             bool direct() const
00107             {
00108                 return true;
00109             }
00110 
00111             const unallocLabelList& directAddressing() const
00112             {
00113                 return directAddressing_;
00114             }
00115     };
00116 
00117 
00118     // Private Member Functions
00119 
00120         //- Calculate map from new patch faces to old patch faces. -1 where
00121         //  could not map.
00122         static labelList calcPatchMap
00123         (
00124             const label oldStart,
00125             const label oldSize,
00126             const labelList& oldToNew,
00127             const polyPatch& newPatch,
00128             const label unmappedIndex
00129         );
00130 
00131         //- Map from old to new according to map. Handles map = -1.
00132         template<class Type>
00133         static void map
00134         (
00135             const Field<Type>&,
00136             const labelList& map,
00137             Field<Type>&
00138         );
00139 
00140         //- Update single volField.
00141         template<class Type>
00142         static void MapVolField
00143         (
00144             const mapAddedPolyMesh& meshMap,
00145 
00146             GeometricField<Type, fvPatchField, volMesh>& fld,
00147             const GeometricField<Type, fvPatchField, volMesh>& fldToAdd
00148         );
00149 
00150         //- Update single surfaceField.
00151         template<class Type>
00152         static void MapSurfaceField
00153         (
00154             const mapAddedPolyMesh& meshMap,
00155 
00156             GeometricField<Type, fvsPatchField, surfaceMesh>& fld,
00157             const GeometricField<Type, fvsPatchField, surfaceMesh>& fldToAdd
00158         );
00159 
00160 public:
00161 
00162     // Member Functions
00163 
00164         //- Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
00165         static autoPtr<mapAddedPolyMesh> add
00166         (
00167             fvMesh& mesh0,
00168             const fvMesh& mesh1,
00169             const faceCoupleInfo& coupleInfo,
00170             const bool validBoundary = true
00171         );
00172 
00173         //- Map all volFields of Type
00174         template<class Type>
00175         static void MapVolFields
00176         (
00177             const mapAddedPolyMesh&,
00178             const fvMesh& mesh,
00179             const fvMesh& meshToAdd
00180         );
00181 
00182         //- Map all surfaceFields of Type
00183         template<class Type>
00184         static void MapSurfaceFields
00185         (
00186             const mapAddedPolyMesh&,
00187             const fvMesh& mesh,
00188             const fvMesh& meshToAdd
00189         );
00190 };
00191 
00192 
00193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00194 
00195 } // End namespace Foam
00196 
00197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00198 
00199 #ifdef NoRepository
00200 #   include "fvMeshAdderTemplates.C"
00201 #endif
00202 
00203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00204 
00205 #endif
00206 
00207 // ************************************************************************* //
Copyright © 2000-2007 OpenCFD Ltd