FreeFOAM The Cross-Platform CFD Toolkit
boundaryCutter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::boundaryCutter
26 
27 Description
28  Does modifications to boundary faces.
29 
30  Does
31  - move boundary points
32  - split boundary edges (multiple per edge if nessecary)
33  - face-centre decomposes boundary faces
34  - diagonal split of boundary faces
35 
36 
37 SourceFiles
38  boundaryCutter.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef boundaryCutter_H
43 #define boundaryCutter_H
44 
45 #include <OpenFOAM/Map.H>
46 #include <OpenFOAM/labelList.H>
47 #include <OpenFOAM/edge.H>
48 #include <OpenFOAM/typeInfo.H>
49 #include <OpenFOAM/labelPair.H>
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward declaration of classes
57 class polyTopoChange;
58 class mapPolyMesh;
59 class polyMesh;
60 class face;
61 
62 /*---------------------------------------------------------------------------*\
63  Class boundaryCutter Declaration
64 \*---------------------------------------------------------------------------*/
65 
67 {
68  // Private data
69 
70  //- Reference to mesh
71  const polyMesh& mesh_;
72 
73  //- Per edge sorted (start to end) list of points added.
74  HashTable<labelList, edge, Hash<edge> > edgeAddedPoints_;
75 
76  //- Per face the mid point added.
77  Map<label> faceAddedPoint_;
78 
79 
80  // Private Member Functions
81 
82  //- Get patch and zone info for face
83  void getFaceInfo
84  (
85  const label faceI,
86  label& patchID,
87  label& zoneID,
88  label& zoneFlip
89  ) const;
90 
91  //- Add cuts of edges to face
92  face addEdgeCutsToFace(const label faceI, const Map<labelList>&) const;
93 
94  //- Splits faces with multiple cut edges. Return true if anything split.
95  bool splitFace
96  (
97  const label faceI,
98  const Map<point>& pointToPos,
99  const Map<labelList>& edgeToAddedPoints,
100  polyTopoChange& meshMod
101  ) const;
102 
103  //- Add/modify faceI for new vertices.
104  void addFace
105  (
106  const label faceI,
107  const face& newFace,
108 
109  bool& modifiedFace, // have we already 'used' faceI?
110  polyTopoChange& meshMod
111  ) const;
112 
113 
114  //- Disallow default bitwise copy construct
116 
117  //- Disallow default bitwise assignment
118  void operator=(const boundaryCutter&);
119 
120 public:
121 
122  //- Runtime type information
123  ClassName("boundaryCutter");
124 
125  // Constructors
126 
127  //- Construct from mesh
128  boundaryCutter(const polyMesh& mesh);
129 
130 
131  // Destructor
132 
133  ~boundaryCutter();
134 
135 
136  // Member Functions
137 
138  // Edit
139 
140  //- Do actual cutting with cut description. Inserts mesh changes
141  // into meshMod.
142  // pointToPos : new position for selected points
143  // edgeToCuts : per edge set of points that need to be introduced
144  // faceToSplit : per face the diagonal split
145  // faceToFeaturePoint : per face the feature point. Triangulation
146  // around this feature point.
147  void setRefinement
148  (
149  const Map<point>& pointToPos,
150  const Map<List<point> >& edgeToCuts,
151  const Map<labelPair>& faceToSplit,
152  const Map<point>& faceToFeaturePoint,
153  polyTopoChange& meshMod
154  );
155 
156  //- Force recalculation of locally stored data on topological change
157  void updateMesh(const mapPolyMesh&);
158 
159 
160  // Access
161 
162  //- Per edge a sorted list (start to end) of added points.
164  const
165  {
166  return edgeAddedPoints_;
167  }
168 
169  //- Per face the mid point added.
170  const Map<label>& faceAddedPoint() const
171  {
172  return faceAddedPoint_;
173  }
174 
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************ vim: set sw=4 sts=4 et: ************************ //