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

boundaryCutter.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::boundaryCutter
00026 
00027 Description
00028     Does modifications to boundary faces.
00029 
00030     Does
00031     - move boundary points
00032     - split boundary edges (multiple per edge if nessecary)
00033     - face-centre decomposes boundary faces
00034     - diagonal split of boundary faces
00035 
00036 
00037 SourceFiles
00038     boundaryCutter.C
00039 
00040 \*---------------------------------------------------------------------------*/
00041 
00042 #ifndef boundaryCutter_H
00043 #define boundaryCutter_H
00044 
00045 #include <OpenFOAM/Map.H>
00046 #include <OpenFOAM/labelList.H>
00047 #include <OpenFOAM/edge.H>
00048 #include <OpenFOAM/typeInfo.H>
00049 #include <OpenFOAM/labelPair.H>
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace Foam
00054 {
00055 
00056 // Forward declaration of classes
00057 class polyTopoChange;
00058 class mapPolyMesh;
00059 class polyMesh;
00060 class face;
00061 
00062 /*---------------------------------------------------------------------------*\
00063                            Class boundaryCutter Declaration
00064 \*---------------------------------------------------------------------------*/
00065 
00066 class boundaryCutter
00067 {
00068     // Private data
00069 
00070         //- Reference to mesh
00071         const polyMesh& mesh_;
00072 
00073         //- Per edge sorted (start to end) list of points added.
00074         HashTable<labelList, edge, Hash<edge> > edgeAddedPoints_;
00075 
00076         //- Per face the mid point added.
00077         Map<label> faceAddedPoint_;
00078 
00079 
00080     // Private Member Functions
00081 
00082         //- Get patch and zone info for face
00083         void getFaceInfo
00084         (
00085             const label faceI,
00086             label& patchID,
00087             label& zoneID,
00088             label& zoneFlip
00089         ) const;
00090 
00091         //- Add cuts of edges to face
00092         face addEdgeCutsToFace(const label faceI, const Map<labelList>&) const;
00093 
00094         //- Splits faces with multiple cut edges. Return true if anything split.
00095         bool splitFace
00096         (
00097             const label faceI,
00098             const Map<point>& pointToPos,
00099             const Map<labelList>& edgeToAddedPoints,
00100             polyTopoChange& meshMod
00101         ) const;
00102 
00103         //- Add/modify faceI for new vertices.
00104         void addFace
00105         (
00106             const label faceI,
00107             const face& newFace,
00108 
00109             bool& modifiedFace,     // have we already 'used' faceI?
00110             polyTopoChange& meshMod
00111         ) const;
00112 
00113 
00114         //- Disallow default bitwise copy construct
00115         boundaryCutter(const boundaryCutter&);
00116 
00117         //- Disallow default bitwise assignment
00118         void operator=(const boundaryCutter&);
00119 
00120 public:
00121 
00122     //- Runtime type information
00123     ClassName("boundaryCutter");
00124 
00125     // Constructors
00126 
00127         //- Construct from mesh
00128         boundaryCutter(const polyMesh& mesh);
00129 
00130 
00131     // Destructor
00132 
00133         ~boundaryCutter();
00134 
00135 
00136     // Member Functions
00137 
00138         // Edit
00139 
00140             //- Do actual cutting with cut description. Inserts mesh changes
00141             //  into meshMod.
00142             //  pointToPos : new position for selected points
00143             //  edgeToCuts : per edge set of points that need to be introduced
00144             //  faceToSplit : per face the diagonal split
00145             //  faceToFeaturePoint : per face the feature point. Triangulation
00146             //                       around this feature point.
00147             void setRefinement
00148             (
00149                 const Map<point>& pointToPos,
00150                 const Map<List<point> >& edgeToCuts,
00151                 const Map<labelPair>& faceToSplit,
00152                 const Map<point>& faceToFeaturePoint,
00153                 polyTopoChange& meshMod
00154             );
00155 
00156             //- Force recalculation of locally stored data on topological change
00157             void updateMesh(const mapPolyMesh&);
00158 
00159 
00160         // Access
00161 
00162             //- Per edge a sorted list (start to end) of added points.
00163             const HashTable<labelList, edge, Hash<edge> >& edgeAddedPoints()
00164              const
00165             {
00166                 return edgeAddedPoints_;
00167             }
00168 
00169             //- Per face the mid point added.
00170             const Map<label>& faceAddedPoint() const
00171             {
00172                 return faceAddedPoint_;
00173             }
00174 
00175 };
00176 
00177 
00178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00179 
00180 } // End namespace Foam
00181 
00182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00183 
00184 #endif
00185 
00186 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines