OpenFOAM logo
Open Source CFD Toolkit

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