OpenFOAM logo
Open Source CFD Toolkit

hexRef8.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     hexRef8
00027 
00028 Description
00029     Splitting hexes into 8. Will abort if no hexes.
00030 
00031     Parallel: does communication to make sure faces across processor
00032     boundaries refine consistently. Will only force face to be refined,
00033     near-procpatch-cell does not get refined.
00034 
00035 SourceFiles
00036     hexRef8.C
00037 
00038 \*---------------------------------------------------------------------------*/
00039 
00040 #ifndef hexRef8_H
00041 #define hexRef8_H
00042 
00043 #include "labelList.H"
00044 #include "face.H"
00045 #include "className.H"
00046 #include "labelHashSet.H"
00047 #include "DynamicList.H"
00048 #include "primitivePatch.H"
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 // Class forward declarations
00056 class polyMesh;
00057 class polyPatch;
00058 class polyTopoChange;
00059 
00060 /*---------------------------------------------------------------------------*\
00061                            Class hexRef8 Declaration
00062 \*---------------------------------------------------------------------------*/
00063 
00064 class hexRef8
00065 {
00066     // Private data
00067 
00068         //- Reference to underlying mesh.
00069         const polyMesh& mesh_;
00070 
00071         //- Per cell the added cells (+ itself). Empty list if cell not
00072         //  refined.
00073         labelListList addedCells_;
00074 
00075 
00076     // Private Member Functions
00077 
00078         //- Synchronize cut faces across coupled patches
00079         void syncCoupledCutFaces(labelHashSet& cutFaces) const;
00080 
00081         //- Collect all cut boundaryEdges of pp. Returns these in patchFace
00082         //  and starting index in face (edge is f[index] to f[index+1])
00083         void collectCutEdges
00084         (
00085             const labelHashSet& cutEdges,
00086             const polyPatch& pp,
00087             DynamicList<label>& cutFaces,
00088             DynamicList<label>& cutIndex
00089         ) const;
00090 
00091         //- Synchronize cut edges across coupled patches. Returns true if
00092         //  anything changed (locally)
00093         bool syncCoupledCutEdges(labelHashSet& cutEdges) const;
00094 
00095         //- Calculate point-cell addressing. Master point first in list.
00096         void calcSortedCellPoints(labelListList& cellPoints) const;
00097 
00098         //- Get the two faces connected to edgeI on cellI in consistent order
00099         //  with e[0]
00100         void getEdgeFaces
00101         (
00102             const label cellI,
00103             const label edgeI,
00104             label&,
00105             label&
00106         ) const;
00107 
00108         //- Get the two edges using pointI on faceI. Such that e0 uses pointI
00109         //  and nextPointI
00110         void getFaceEdges
00111         (
00112             const label faceI,
00113             const label pointI,
00114             const label nextPointI,
00115             label& e0,
00116             label& e1
00117         ) const;
00118 
00119         //- Get patch and zone info
00120         void getFaceInfo
00121         (
00122             const label faceI,
00123             label& patchID,
00124             label& zoneID,
00125             label& zoneFlip
00126         ) const;
00127 
00128         //- Adds a face on top of existing faceI. Reverses if nessecary.
00129         void addFace
00130         (
00131             polyTopoChange& meshMod,
00132             const label faceI,
00133             const face& newFace,
00134             const label own,
00135             const label nei
00136         ) const;
00137 
00138         //- Adds internal face from split of edge. No checks on reversal.
00139         void addInternalFace
00140         (
00141             polyTopoChange& meshMod,
00142             const label masterEdgeI,
00143             const face& newFace,
00144             const label own,
00145             const label nei
00146         ) const;
00147 
00148         //- Modifies existing faceI for either new owner/neighbour or new face
00149         //  points. Reverses if nessecary.
00150         void modFace
00151         (
00152             polyTopoChange& meshMod,
00153             const label faceI,
00154             const face& newFace,
00155             const label own,
00156             const label nei
00157         ) const;
00158 
00159         //- Look up new cell at cellI, pointI
00160         label newCell
00161         (
00162             const labelListList& cellPoints,
00163             const label cellI,
00164             const label pointI
00165         ) const;
00166 
00167         //- Get new owner and neighbour (in unspecified order) of pointI
00168         //  on faceI.
00169         void getFaceNeighbours
00170         (
00171             const labelListList& cellPoints,
00172             const label faceI,
00173             const label pointI,
00174 
00175             label& own,
00176             label& nei
00177         ) const;
00178 
00179 
00180         //- Disallow default bitwise copy construct
00181         hexRef8(const hexRef8&);
00182 
00183         //- Disallow default bitwise assignment
00184         void operator=(const hexRef8&);
00185 
00186 
00187 public:
00188 
00189     //- Runtime type information
00190     ClassName("hexRef8");
00191 
00192 
00193     // Constructors
00194 
00195         //- Construct from mesh.
00196         hexRef8(const polyMesh& mesh);
00197 
00198 
00199     // Member Functions
00200 
00201         // Edit
00202 
00203             //- Insert refinement
00204             void setRefinement(const labelList& cells, polyTopoChange& meshMod);
00205 
00206 
00207         // Access
00208 
00209             //- From original to added cells. (includes original cell!)
00210             const labelListList& addedCells() const
00211             {
00212                 return addedCells_;
00213             }
00214 
00215 };
00216 
00217 
00218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00219 
00220 } // End namespace Foam
00221 
00222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00223 
00224 #endif
00225 
00226 // ************************************************************************* //
For further information go to www.openfoam.org