OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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