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

cellMapper.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::cellMapper
00026 
00027 Description
00028     This object provides mapping and fill-in information for cell data
00029     between the two meshes after the topological change.  It is
00030     constructed from mapPolyMesh.
00031 
00032 SourceFiles
00033     cellMapper.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef cellMapper_H
00038 #define cellMapper_H
00039 
00040 #include <OpenFOAM/morphFieldMapper.H>
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 // Forward declaration of classes
00048 class polyMesh;
00049 class mapPolyMesh;
00050 
00051 /*---------------------------------------------------------------------------*\
00052                            Class cellMapper Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class cellMapper
00056 :
00057     public morphFieldMapper
00058 {
00059     // Private data
00060 
00061         //- Reference to polyMesh
00062         const polyMesh& mesh_;
00063 
00064         //- Reference to mapPolyMesh
00065         const mapPolyMesh& mpm_;
00066 
00067         //- Are there any inserted (unmapped) cells
00068         bool insertedCells_;
00069 
00070         //- Is the mapping direct
00071         bool direct_;
00072 
00073 
00074     // Demand-driven private data
00075 
00076         //- Direct addressing (only one for of addressing is used)
00077         mutable labelList* directAddrPtr_;
00078 
00079         //- Interpolated addressing (only one for of addressing is used)
00080         mutable labelListList* interpolationAddrPtr_;
00081 
00082         //- Interpolation weights
00083         mutable scalarListList* weightsPtr_;
00084 
00085         //- Inserted cells
00086         mutable labelList* insertedCellLabelsPtr_;
00087 
00088 
00089     // Private Member Functions
00090 
00091         //- Disallow default bitwise copy construct
00092         cellMapper(const cellMapper&);
00093 
00094         //- Disallow default bitwise assignment
00095         void operator=(const cellMapper&);
00096 
00097 
00098         //- Calculate addressing for mapping with inserted cells
00099         void calcAddressing() const;
00100 
00101         //- Clear out local storage
00102         void clearOut();
00103 
00104 
00105 public:
00106 
00107     // Static data members
00108 
00109     // Constructors
00110 
00111         //- Construct from mapPolyMesh
00112         cellMapper(const mapPolyMesh& mpm);
00113 
00114 
00115     // Destructor
00116 
00117         virtual ~cellMapper();
00118 
00119 
00120     // Member Functions
00121 
00122         //- Return size
00123         virtual label size() const;
00124 
00125         //- Return size before mapping
00126         virtual label sizeBeforeMapping() const;
00127 
00128         //- Is the mapping direct
00129         virtual bool direct() const
00130         {
00131             return direct_;
00132         }
00133 
00134         //- Return direct addressing
00135         virtual const unallocLabelList& directAddressing() const;
00136 
00137         //- Return interpolated addressing
00138         virtual const labelListList& addressing() const;
00139 
00140         //- Return interpolaion weights
00141         virtual const scalarListList& weights() const;
00142 
00143         //- Are there any inserted cells
00144         bool insertedObjects() const
00145         {
00146             return insertedCells_;
00147         }
00148 
00149         //- Return list of inserted cells
00150         const labelList& insertedObjectLabels() const;
00151 };
00152 
00153 
00154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00155 
00156 } // End namespace Foam
00157 
00158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00159 
00160 #endif
00161 
00162 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines