OpenFOAM logo
Open Source CFD Toolkit

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