Merge branch 'upstream/OpenFOAM' into master
[freefoam.git] / src / dynamicMesh / meshCut / meshModifiers / boundaryCutter / boundaryCutter.H
blob99f04d8eacd14b8fa0ad31d3369935c3059d62c6
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::boundaryCutter
28 Description
29     Does modifications to boundary faces.
31     Does
32     - move boundary points
33     - split boundary edges (multiple per edge if nessecary)
34     - face-centre decomposes boundary faces
35     - diagonal split of boundary faces
38 SourceFiles
39     boundaryCutter.C
41 \*---------------------------------------------------------------------------*/
43 #ifndef boundaryCutter_H
44 #define boundaryCutter_H
46 #include <OpenFOAM/Map.H>
47 #include <OpenFOAM/labelList.H>
48 #include <OpenFOAM/edge.H>
49 #include <OpenFOAM/typeInfo.H>
50 #include <OpenFOAM/labelPair.H>
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 namespace Foam
57 // Forward declaration of classes
58 class polyTopoChange;
59 class mapPolyMesh;
60 class polyMesh;
61 class face;
63 /*---------------------------------------------------------------------------*\
64                            Class boundaryCutter Declaration
65 \*---------------------------------------------------------------------------*/
67 class boundaryCutter
69     // Private data
71         //- Reference to mesh
72         const polyMesh& mesh_;
74         //- Per edge sorted (start to end) list of points added.
75         HashTable<labelList, edge, Hash<edge> > edgeAddedPoints_;
77         //- Per face the mid point added.
78         Map<label> faceAddedPoint_;
81     // Private Member Functions
83         //- Get patch and zone info for face
84         void getFaceInfo
85         (
86             const label faceI,
87             label& patchID,
88             label& zoneID,
89             label& zoneFlip
90         ) const;
92         //- Add cuts of edges to face
93         face addEdgeCutsToFace(const label faceI, const Map<labelList>&) const;
95         //- Splits faces with multiple cut edges. Return true if anything split.
96         bool splitFace
97         (
98             const label faceI,
99             const Map<point>& pointToPos,
100             const Map<labelList>& edgeToAddedPoints,
101             polyTopoChange& meshMod
102         ) const;
104         //- Add/modify faceI for new vertices.
105         void addFace
106         (
107             const label faceI,
108             const face& newFace,
110             bool& modifiedFace,     // have we already 'used' faceI?
111             polyTopoChange& meshMod
112         ) const;
115         //- Disallow default bitwise copy construct
116         boundaryCutter(const boundaryCutter&);
118         //- Disallow default bitwise assignment
119         void operator=(const boundaryCutter&);
121 public:
123     //- Runtime type information
124     ClassName("boundaryCutter");
126     // Constructors
128         //- Construct from mesh
129         boundaryCutter(const polyMesh& mesh);
132     // Destructor
134         ~boundaryCutter();
137     // Member Functions
139         // Edit
141             //- Do actual cutting with cut description. Inserts mesh changes
142             //  into meshMod.
143             //  pointToPos : new position for selected points
144             //  edgeToCuts : per edge set of points that need to be introduced
145             //  faceToSplit : per face the diagonal split
146             //  faceToFeaturePoint : per face the feature point. Triangulation
147             //                       around this feature point.
148             void setRefinement
149             (
150                 const Map<point>& pointToPos,
151                 const Map<List<point> >& edgeToCuts,
152                 const Map<labelPair>& faceToSplit,
153                 const Map<point>& faceToFeaturePoint,
154                 polyTopoChange& meshMod
155             );
157             //- Force recalculation of locally stored data on topological change
158             void updateMesh(const mapPolyMesh&);
161         // Access
163             //- Per edge a sorted list (start to end) of added points.
164             const HashTable<labelList, edge, Hash<edge> >& edgeAddedPoints()
165              const
166             {
167                 return edgeAddedPoints_;
168             }
170             //- Per face the mid point added.
171             const Map<label>& faceAddedPoint() const
172             {
173                 return faceAddedPoint_;
174             }
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 } // End namespace Foam
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 #endif
187 // ************************ vim: set sw=4 sts=4 et: ************************ //