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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::boundaryCutter
28 
29 Description
30  Does modifications to boundary faces.
31 
32  Does
33  - move boundary points
34  - split boundary edges (multiple per edge if necessary)
35  - face-centre decomposes boundary faces
36  - diagonal split of boundary faces
37 
38 
39 SourceFiles
40  boundaryCutter.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef boundaryCutter_H
45 #define boundaryCutter_H
46 
47 #include "Map.H"
48 #include "labelList.H"
49 #include "edgeHashes.H"
50 #include "typeInfo.H"
51 #include "labelPair.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward declaration of classes
59 class polyTopoChange;
60 class mapPolyMesh;
61 class polyMesh;
62 class face;
63 
64 /*---------------------------------------------------------------------------*\
65  Class boundaryCutter Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class boundaryCutter
69 {
70  // Private data
71 
72  //- Reference to mesh
73  const polyMesh& mesh_;
74 
75  //- Per edge sorted (start to end) list of points added.
76  EdgeMap<labelList> edgeAddedPoints_;
77 
78  //- Per face the mid point added.
79  Map<label> faceAddedPoint_;
80 
81 
82  // Private Member Functions
83 
84  //- Get patch and zone info for face
85  void getFaceInfo
86  (
87  const label facei,
88  label& patchID,
89  label& zoneID,
90  label& zoneFlip
91  ) const;
92 
93  //- Add cuts of edges to face
94  face addEdgeCutsToFace(const label facei, const Map<labelList>&) const;
95 
96  //- Splits faces with multiple cut edges. Return true if anything split.
97  bool splitFace
98  (
99  const label facei,
100  const Map<point>& pointToPos,
101  const Map<labelList>& edgeToAddedPoints,
102  polyTopoChange& meshMod
103  ) const;
104 
105  //- Add/modify facei for new vertices.
106  void addFace
107  (
108  const label facei,
109  const face& newFace,
110 
111  bool& modifiedFace, // have we already 'used' facei?
112  polyTopoChange& meshMod
113  ) const;
114 
115 
116  //- No copy construct
117  boundaryCutter(const boundaryCutter&) = delete;
118 
119  //- No copy assignment
120  void operator=(const boundaryCutter&) = delete;
121 
122 public:
123 
124  //- Runtime type information
125  ClassName("boundaryCutter");
126 
127  // Constructors
128 
129  //- Construct from mesh
130  boundaryCutter(const polyMesh& mesh);
131 
132 
133  //- Destructor
134  ~boundaryCutter();
135 
136 
137  // Member Functions
138 
139  // Edit
140 
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  );
156 
157  //- Force recalculation of locally stored data on topological change
158  void updateMesh(const mapPolyMesh&);
159 
160 
161  // Access
162 
163  //- Per edge a sorted list (start to end) of added points.
164  const EdgeMap<labelList>& edgeAddedPoints() 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 // ************************************************************************* //
Foam::boundaryCutter::~boundaryCutter
~boundaryCutter()
Destructor.
Definition: boundaryCutter.C:399
Foam::boundaryCutter
Does modifications to boundary faces.
Definition: boundaryCutter.H:67
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:406
Foam::boundaryCutter::ClassName
ClassName("boundaryCutter")
Runtime type information.
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:100
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:169
Map.H
Foam::label
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:62
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:163
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:832
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
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: HashTable.H:102
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:160
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:74
labelPair.H