OpenFOAM logo
Open Source CFD Toolkit

pointMapper.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     pointMapper
00027 
00028 Description
00029     This object provides mapping and fill-in information for point data
00030     between the two meshes after the topological change.  It is
00031     constructed from mapPolyMesh.
00032 
00033 SourceFiles
00034     pointMapper.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef pointMapper_H
00039 #define pointMapper_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 pointMapper Declaration
00054 \*---------------------------------------------------------------------------*/
00055 
00056 class pointMapper
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) points
00069         bool insertedPoints_;
00070 
00071 
00072     // Demand-driven private data
00073 
00074         //- Direct addressing (only one for of addressing is used)
00075         mutable labelList* directAddrPtr_;
00076 
00077         //- Inserted points
00078         mutable labelList* insertedPointLabelsPtr_;
00079 
00080 
00081     // Private Member Functions
00082 
00083         //- Disallow default bitwise copy construct
00084         pointMapper(const pointMapper&);
00085 
00086         //- Disallow default bitwise assignment
00087         void operator=(const pointMapper&);
00088 
00089 
00090         //- Calculate addressing for mapping with inserted points
00091         void calcAddressing() const;
00092 
00093         //- Clear out local storage
00094         void clearOut();
00095 
00096 
00097 public:
00098 
00099     // Static data members
00100 
00101     // Constructors
00102 
00103         //- Construct from mapPolyMesh
00104         pointMapper(const mapPolyMesh& mpm);
00105 
00106 
00107     // Destructor
00108 
00109         virtual ~pointMapper();
00110 
00111 
00112     // Member Functions
00113 
00114         //- Return size
00115         virtual label size() const;
00116 
00117         //- Return size of field before mapping
00118         virtual label sizeBeforeMapping() const;
00119 
00120         //- Is the mapping direct  (points can only be added from points)
00121         virtual bool direct() const
00122         {
00123             return true;
00124         }
00125 
00126         //- Return direct addressing.
00127         //  For inserted points, the master point is set to zero to
00128         //  avoid checking during the mapping.  The values should be
00129         //  over-ridden later using insertedPointLabels.
00130         //  
00131         virtual const unallocLabelList& directAddressing() const;
00132 
00133         //- Are there any inserted objects
00134         virtual bool insertedObjects() const
00135         {
00136             return insertedPoints_;
00137         }
00138 
00139         //- Return list of inserted objects
00140         virtual const labelList& insertedObjectLabels() const;
00141 };
00142 
00143 
00144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00145 
00146 } // End namespace Foam
00147 
00148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00149 
00150 #endif
00151 
00152 // ************************************************************************* //
For further information go to www.openfoam.org