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

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