boundaryCutter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 public:
115 
116  //- Runtime type information
117  ClassName("boundaryCutter");
118 
119  // Constructors
120 
121  //- Construct from mesh
122  boundaryCutter(const polyMesh& mesh);
123 
124  //- Disallow default bitwise copy construction
125  boundaryCutter(const boundaryCutter&) = delete;
126 
127 
128  //- Destructor
129  ~boundaryCutter();
130 
131 
132  // Member Functions
133 
134  // Edit
135 
136  //- Do actual cutting with cut description. Inserts mesh changes
137  // into meshMod.
138  // pointToPos : new position for selected points
139  // edgeToCuts : per edge set of points that need to be introduced
140  // faceToSplit : per face the diagonal split
141  // faceToFeaturePoint : per face the feature point. Triangulation
142  // around this feature point.
143  void setRefinement
144  (
145  const Map<point>& pointToPos,
146  const Map<List<point>>& edgeToCuts,
147  const Map<labelPair>& faceToSplit,
148  const Map<point>& faceToFeaturePoint,
149  polyTopoChange& meshMod
150  );
151 
152  //- Force recalculation of locally stored data on topological change
153  void updateMesh(const mapPolyMesh&);
154 
155 
156  // Access
157 
158  //- Per edge a sorted list (start to end) of added points.
160  const
161  {
162  return edgeAddedPoints_;
163  }
164 
165  //- Per face the mid point added.
166  const Map<label>& faceAddedPoint() const
167  {
168  return faceAddedPoint_;
169  }
170 
171 
172  // Member Operators
173 
174  //- Disallow default bitwise assignment
175  void operator=(const boundaryCutter&) = delete;
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
const HashTable< labelList, edge, Hash< edge > > & edgeAddedPoints() const
Per edge a sorted list (start to end) of added points.
const Map< label > & faceAddedPoint() const
Per face the mid point added.
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
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
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
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
boundaryCutter(const polyMesh &mesh)
Construct from mesh.
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.
dynamicFvMesh & mesh
ClassName("boundaryCutter")
Runtime type information.
An STL-conforming hash table.
Definition: HashTable.H:61
~boundaryCutter()
Destructor.
Direct mesh changes based on v1.3 polyTopoChange syntax.
void operator=(const boundaryCutter &)=delete
Disallow default bitwise assignment.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Does modifications to boundary faces.
Namespace for OpenFOAM.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.