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

polyDualMesh.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::polyDualMesh
00026 
00027 Description
00028     Creates dual of polyMesh.
00029 
00030     Every polyMesh point becomes a cell on the dual mesh
00031 
00032     Every polyMesh cell and patchFace becomes a point on the dual mesh.
00033 
00034 
00035 SourceFiles
00036     polyDualMesh.C
00037 
00038 \*---------------------------------------------------------------------------*/
00039 
00040 #ifndef polyDualMesh_H
00041 #define polyDualMesh_H
00042 
00043 #include <OpenFOAM/polyMesh.H>
00044 #include <OpenFOAM/labelIOList.H>
00045 #include <OpenFOAM/typeInfo.H>
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 namespace Foam
00050 {
00051 
00052 /*---------------------------------------------------------------------------*\
00053                            Class polyDualMesh Declaration
00054 \*---------------------------------------------------------------------------*/
00055 
00056 class polyDualMesh
00057 :
00058     public polyMesh
00059 {
00060     // Private data
00061 
00062         //- From polyMesh cell to my point
00063         labelIOList cellPoint_;
00064 
00065         //- From polyMesh boundary face (face-mesh.nInternalFaces()) to my point
00066         labelIOList boundaryFacePoint_;
00067 
00068 
00069     // Private Member Functions
00070 
00071         static labelList getFaceOrder
00072         (
00073             const labelList& faceOwner,
00074             const labelList& faceNeighbour,
00075             const cellList& cells,
00076             label& nInternalFaces
00077         );
00078 
00079         static void getPointEdges
00080         (
00081             const primitivePatch& patch,
00082             const label faceI,
00083             const label pointI,
00084             label& e0,
00085             label& e1
00086         );
00087 
00088         static labelList collectPatchSideFace
00089         (
00090             const polyPatch& patch,
00091             const label patchToDualOffset,
00092             const labelList& edgeToDualPoint,
00093             const labelList& pointToDualPoint,
00094             const label pointI,
00095 
00096             label& edgeI
00097         );
00098 
00099         static void collectPatchInternalFace
00100         (
00101             const polyPatch& patch,
00102             const label patchToDualOffset,
00103             const labelList& edgeToDualPoint,
00104 
00105             const label pointI,
00106             const label startEdgeI,
00107 
00108             labelList& dualFace2,
00109             labelList& featEdgeIndices2
00110         );
00111 
00112         static void splitFace
00113         (
00114             const polyPatch& patch,
00115             const labelList& pointToDualPoint,
00116 
00117             const label pointI,
00118             const labelList& dualFace,
00119             const labelList& featEdgeIndices,
00120 
00121             DynamicList<face>& dualFaces,
00122             DynamicList<label>& dualOwner,
00123             DynamicList<label>& dualNeighbour,
00124             DynamicList<label>& dualRegion
00125         );
00126 
00127         static void dualPatch
00128         (
00129             const polyPatch& patch,
00130             const label patchToDualOffset,
00131             const labelList& edgeToDualPoint,
00132             const labelList& pointToDualPoint,
00133 
00134             const pointField& dualPoints,
00135 
00136             DynamicList<face>& dualFaces,
00137             DynamicList<label>& dualOwner,
00138             DynamicList<label>& dualNeighbour,
00139             DynamicList<label>& dualRegion
00140         );
00141 
00142         void calcDual
00143         (
00144             const polyMesh& mesh,
00145             const labelList& featureEdges,
00146             const labelList& featurePoints
00147         );
00148 
00149 
00150         //- Disallow default bitwise copy construct
00151         polyDualMesh(const polyDualMesh&);
00152 
00153         //- Disallow default bitwise assignment
00154         void operator=(const polyDualMesh&);
00155 
00156 
00157 public:
00158 
00159     //- Runtime type information
00160     ClassName("polyDualMesh");
00161 
00162 
00163     // Constructors
00164 
00165         //- Construct from IOobject
00166         polyDualMesh(const IOobject&);
00167 
00168         //- Construct from polyMesh and list of edges and points to represent.
00169         //  Feature edge and point labels are in local addressing of a patch
00170         //  over all boundary faces.
00171         polyDualMesh
00172         (
00173             const polyMesh&,
00174             const labelList& featureEdges,
00175             const labelList& featurePoints
00176         );
00177 
00178         //- Construct from polyMesh and feature edge angle. Uses calcFeatures
00179         //  below to determine feature edges and points.
00180         polyDualMesh
00181         (
00182             const polyMesh&,
00183             const scalar featureCos
00184         );
00185 
00186         //- Helper function to create feature edges and points based on
00187         //  feature angle and patches.
00188         static void calcFeatures
00189         (
00190             const polyMesh&,
00191             const scalar featureCos,
00192             labelList& featureEdges,
00193             labelList& featurePoints
00194         );
00195 
00196 
00197     // Destructor
00198 
00199         ~polyDualMesh();
00200 
00201 
00202     // Member Functions
00203 
00204         // Access
00205 
00206             //- From polyMesh cell to dual point
00207             const labelIOList& cellPoint() const
00208             {
00209                 return cellPoint_;
00210             }
00211 
00212             //- From polyMesh patch face to dual point
00213             const labelIOList& boundaryFacePoint() const
00214             {
00215                 return boundaryFacePoint_;
00216             }
00217 };
00218 
00219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00220 
00221 } // End namespace Foam
00222 
00223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00224 
00225 #endif
00226 
00227 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines