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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::boundaryCutter
29 
30 Description
31  Does modifications to boundary faces.
32 
33  Does
34  - move boundary points
35  - split boundary edges (multiple per edge if necessary)
36  - face-centre decomposes boundary faces
37  - diagonal split of boundary faces
38 
39 
40 SourceFiles
41  boundaryCutter.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef boundaryCutter_H
46 #define boundaryCutter_H
47 
48 #include "Map.H"
49 #include "labelList.H"
50 #include "edgeHashes.H"
51 #include "typeInfo.H"
52 #include "labelPair.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 // Forward Declarations
60 class polyTopoChange;
61 class mapPolyMesh;
62 class polyMesh;
63 class face;
64 
65 /*---------------------------------------------------------------------------*\
66  Class boundaryCutter Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class boundaryCutter
70 {
71  // Private data
72 
73  //- Reference to mesh
74  const polyMesh& mesh_;
75 
76  //- Per edge sorted (start to end) list of points added.
77  EdgeMap<labelList> edgeAddedPoints_;
78 
79  //- Per face the mid point added.
80  Map<label> faceAddedPoint_;
81 
82 
83  // Private Member Functions
84 
85  //- Get patch and zone info for face
86  void getFaceInfo
87  (
88  const label facei,
89  label& patchID,
90  label& zoneID,
91  label& zoneFlip
92  ) const;
93 
94  //- Add cuts of edges to face
95  face addEdgeCutsToFace(const label facei, const Map<labelList>&) const;
96 
97  //- Splits faces with multiple cut edges. Return true if anything split.
98  bool splitFace
99  (
100  const label facei,
101  const Map<point>& pointToPos,
102  const Map<labelList>& edgeToAddedPoints,
103  polyTopoChange& meshMod
104  ) const;
105 
106  //- Add/modify facei for new vertices.
107  void addFace
108  (
109  const label facei,
110  const face& newFace,
111 
112  bool& modifiedFace, // have we already 'used' facei?
113  polyTopoChange& meshMod
114  ) const;
115 
116 
117  //- No copy construct
118  boundaryCutter(const boundaryCutter&) = delete;
119 
120  //- No copy assignment
121  void operator=(const boundaryCutter&) = delete;
122 
123 public:
124 
125  //- Runtime type information
126  ClassName("boundaryCutter");
127 
128  // Constructors
129 
130  //- Construct from mesh
131  explicit boundaryCutter(const polyMesh& mesh);
132 
133 
134  //- Destructor
135  ~boundaryCutter() = default;
136 
137 
138  // Member Functions
139 
140  // Edit
141 
142  //- Do actual cutting with cut description. Inserts mesh changes
143  // into meshMod.
144  // pointToPos : new position for selected points
145  // edgeToCuts : per edge set of points that need to be introduced
146  // faceToSplit : per face the diagonal split
147  // faceToFeaturePoint : per face the feature point. Triangulation
148  // around this feature point.
149  void setRefinement
150  (
151  const Map<point>& pointToPos,
152  const Map<List<point>>& edgeToCuts,
153  const Map<labelPair>& faceToSplit,
154  const Map<point>& faceToFeaturePoint,
155  polyTopoChange& meshMod
156  );
157 
158  //- Force recalculation of locally stored data on topological change
159  void updateMesh(const mapPolyMesh&);
160 
161 
162  // Access
163 
164  //- Per edge a sorted list (start to end) of added points.
165  const EdgeMap<labelList>& edgeAddedPoints() const
166  {
167  return edgeAddedPoints_;
168  }
169 
170  //- Per face the mid point added.
171  const Map<label>& faceAddedPoint() const
172  {
173  return faceAddedPoint_;
174  }
175 
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
Foam::boundaryCutter
Does modifications to boundary faces.
Definition: boundaryCutter.H:68
typeInfo.H
Foam::boundaryCutter::setRefinement
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.
Definition: boundaryCutter.C:399
Foam::boundaryCutter::ClassName
ClassName("boundaryCutter")
Runtime type information.
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:99
Foam::Map< label >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::boundaryCutter::faceAddedPoint
const Map< label > & faceAddedPoint() const
Per face the mid point added.
Definition: boundaryCutter.H:170
Map.H
labelList.H
patchID
label patchID
Definition: boundaryProcessorFaPatchPoints.H:5
Foam::boundaryCutter::edgeAddedPoints
const EdgeMap< labelList > & edgeAddedPoints() const
Per edge a sorted list (start to end) of added points.
Definition: boundaryCutter.H:164
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
zoneID
const labelIOList & zoneID
Definition: interpolatedFaces.H:22
Foam::boundaryCutter::updateMesh
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Definition: boundaryCutter.C:825
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::boundaryCutter::~boundaryCutter
~boundaryCutter()=default
Destructor.
Foam::EdgeMap
Map from edge (expressed as its endpoints) to value. For easier forward declaration it is currently i...
Definition: EdgeMap.H:51
edgeHashes.H
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
labelPair.H