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

localPointRegion.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::localPointRegion
00027 
00028 Description
00029     Takes mesh with 'baffles' (= boundary faces sharing points).
00030     Determines for selected points on boundary faces the 'point region' it is
00031     connected to. Each region can be visited by a cell-face-cell walk.
00032     Used in duplicating points after splitting baffles.
00033 
00034     Regions are not consecutive per processor. They will be -1..nRegions_.
00035 
00036     Note: coupled boundaries (cyclics, parallel) not fully tested.
00037 
00038 SourceFiles
00039     localPointRegion.C
00040 
00041 \*---------------------------------------------------------------------------*/
00042 
00043 #ifndef localPointRegion_H
00044 #define localPointRegion_H
00045 
00046 #include "typeInfo.H"
00047 #include "Map.H"
00048 #include "labelList.H"
00049 #include "HashSet.H"
00050 #include "faceList.H"
00051 #include "boolList.H"
00052 
00053 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00054 
00055 namespace Foam
00056 {
00057 
00058 // Forward declaration of classes
00059 class primitiveMesh;
00060 class polyMesh;
00061 class face;
00062 class mapPolyMesh;
00063 
00064 /*---------------------------------------------------------------------------*\
00065                            Class localPointRegion Declaration
00066 \*---------------------------------------------------------------------------*/
00067 
00068 class localPointRegion
00069 {
00070     // Private data
00071 
00073         //label nRegions_;
00074 
00075         //- Per point that is to duplicated to the local index
00076         Map<label> meshPointMap_;
00077 
00078         //- Per local point the regions it is in
00079         labelListList pointRegions_;
00080 
00081         //- Per face that uses a duplicated point the local index
00082         Map<label> meshFaceMap_;
00083 
00084         //- Per face the region of its points
00085         faceList faceRegions_;
00086 
00087 
00088     // Private Member Functions
00089 
00090         //- Given minimum cell the points on a face are connected to
00091         //  determine the points to be duplicated.
00092         void countPointRegions
00093         (
00094             const polyMesh& mesh,
00095             const boolList& candidatePoint,
00096             const Map<label>& candidateFace,
00097             faceList& minRegion
00098         );
00099 
00100         //- Do all: calculate points that need to be duplicated.
00101         void calcPointRegions
00102         (
00103             const polyMesh& mesh,
00104             boolList& candidatePoint
00105         );
00106 
00107 
00108         //- Check if two faces are equal. If forward = false checks f1 in
00109         //  reverse order.
00110         static bool isDuplicate
00111         (
00112             const face& f0,
00113             const face& f1,
00114             const bool forward
00115         );
00116 
00117 public:
00118 
00119     //- Runtime type information
00120     ClassName("localPointRegion");
00121 
00122 
00123     // Constructors
00124 
00125         //- Construct from mesh. Assumes all non-coupled boundary points
00126         //  are candidates for duplication
00127         localPointRegion(const polyMesh& mesh);
00128 
00129         //- Construct from mesh and candidate points for duplication
00130         localPointRegion
00131         (
00132             const polyMesh& mesh,
00133             const labelList& candidatePoints
00134         );
00135 
00136 
00137     // Member Functions
00138 
00139         // Static Member Functions
00140 
00141             //- Helper routine to find baffles (two boundary faces using the
00142             //  same points but in reverse order)
00143             //  Gets list of (boundary!) faces to check. Returns labelList
00144             //  of same size as the input list
00145             //  with -1 or index of other face in the input list.
00146             //  Does not handle duplicate faces on both sides of processor patch
00147             static labelList findDuplicateFaces
00148             (
00149                 const primitiveMesh&,
00150                 const labelList&
00151             );
00152 
00153 
00154         // Access
00155 
00157             //label nRegions() const
00158             //{
00159             //    return nRegions_;
00160             //}
00161 
00162             //- Per point that is to be duplicated the local index
00163             const Map<label>& meshPointMap() const
00164             {
00165                 return meshPointMap_;
00166             }
00167 
00168             //- Per local point the regions it is in
00169             const labelListList& pointRegions() const
00170             {
00171                 return pointRegions_;
00172             }
00173 
00174             //- Per face that uses a duplicated point the local index
00175             const Map<label>& meshFaceMap() const
00176             {
00177                 return meshFaceMap_;
00178             }
00179 
00180             //- Per face the region of its points
00181             const faceList& faceRegions() const
00182             {
00183                 return faceRegions_;
00184             }
00185 
00186 
00187         // Edit
00188 
00189             //- Force recalculation of locally stored data on topological change
00190             void updateMesh(const mapPolyMesh&);
00191 };
00192 
00193 
00194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00195 
00196 } // End namespace Foam
00197 
00198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00199 
00200 #endif
00201 
00202 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd