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) 2011-2012 OpenFOAM Foundation
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 necessary)
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 "Map.H"
46 #include "labelList.H"
47 #include "edge.H"
48 #include "typeInfo.H"
49 #include "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 
66 class boundaryCutter
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  ~boundaryCutter();
133 
134 
135  // Member Functions
136 
137  // Edit
138 
139  //- Do actual cutting with cut description. Inserts mesh changes
140  // into meshMod.
141  // pointToPos : new position for selected points
142  // edgeToCuts : per edge set of points that need to be introduced
143  // faceToSplit : per face the diagonal split
144  // faceToFeaturePoint : per face the feature point. Triangulation
145  // around this feature point.
146  void setRefinement
147  (
148  const Map<point>& pointToPos,
149  const Map<List<point> >& edgeToCuts,
150  const Map<labelPair>& faceToSplit,
151  const Map<point>& faceToFeaturePoint,
152  polyTopoChange& meshMod
153  );
154 
155  //- Force recalculation of locally stored data on topological change
156  void updateMesh(const mapPolyMesh&);
157 
158 
159  // Access
160 
161  //- Per edge a sorted list (start to end) of added points.
163  const
164  {
165  return edgeAddedPoints_;
166  }
167 
168  //- Per face the mid point added.
169  const Map<label>& faceAddedPoint() const
170  {
171  return faceAddedPoint_;
172  }
173 
174 };
175 
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #endif
184 
185 // ************************************************************************* //
const HashTable< labelList, edge, Hash< edge > > & edgeAddedPoints() const
Per edge a sorted list (start to end) of added points.
void setRefinement(const Map< point > &pointToPos, const Map< List< point > > &edgeToCuts, const Map< labelPair > &faceToSplit, const Map< point > &faceToFeaturePoint, polyTopoChange &meshMod)
Do actual cutting with cut description. Inserts mesh changes.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
An STL-conforming hash table.
Definition: HashTable.H:61
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dynamicFvMesh & mesh
Namespace for OpenFOAM.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
~boundaryCutter()
Destructor.
Does modifications to boundary faces.
const Map< label > & faceAddedPoint() const
Per face the mid point added.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Direct mesh changes based on v1.3 polyTopoChange syntax.
ClassName("boundaryCutter")
Runtime type information.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.