removeCells.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 OpenFOAM Foundation
9  Copyright (C) 2018-2022 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::removeCells
29 
30 Description
31  Given list of cells to remove, insert all the topology changes.
32 
33  Works in two passes:
34  - get faces that will become boundary faces
35  - given these faces and the patches they have to go into make the
36  changes.
37 
38 SourceFiles
39  removeCells.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef Foam_removeCells_H
44 #define Foam_removeCells_H
45 
46 #include "labelList.H"
47 #include "typeInfo.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward Declarations
55 class bitSet;
56 class polyMesh;
57 class polyTopoChange;
58 class mapPolyMesh;
59 
60 /*---------------------------------------------------------------------------*\
61  Class removeCells Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class removeCells
65 {
66  // Private Data
67 
68  //- Reference to mesh
69  const polyMesh& mesh_;
70 
71  //- Whether or not to synchronize parallel case.
72  const bool syncPar_;
73 
74 
75 public:
76 
77  //- Runtime type information
78  ClassName("removeCells");
79 
80 
81  // Constructors
82 
83  //- Construct from mesh. Parallel synchronized by default
84  explicit removeCells(const polyMesh& mesh, const bool syncPar = true);
85 
86 
87  //- Destructor
88  ~removeCells() = default;
89 
90 
91  // Member Functions
92 
93  //- Get labels of faces exposed after cells removal.
94  // These are
95  // - internal faces that become boundary faces
96  // - coupled faces that become uncoupled (since one of the sides
97  // gets deleted)
98  labelList getExposedFaces(const bitSet& removedCell) const;
99 
100  //- Get labels of faces exposed after cells removal.
101  // These are
102  // - internal faces that become boundary faces
103  // - coupled faces that become uncoupled (since one of the sides
104  // gets deleted)
105  labelList getExposedFaces(const labelUList& cellsToRemove) const;
106 
107  //- Play commands into polyTopoChange to remove cells.
108  // patchIDs is for every element in facesToExpose (see above) the
109  // patch it has to go into. This cannot be a coupled patch!
110  void setRefinement
111  (
112  const bitSet& removedCell,
113  const labelUList& facesToExpose,
114  const labelUList& patchIDs,
116  ) const;
117 
118  //- Play commands into polyTopoChange to remove cells.
119  // patchIDs is for every element in facesToExpose (see above) the
120  // patch it has to go into. This cannot be a coupled patch!
121  void setRefinement
122  (
123  const labelUList& cellsToRemove,
124  const labelUList& facesToExpose,
125  const labelUList& patchIDs,
127  ) const;
128 
129  //- Force recalculation of locally stored data on topological change
130  void updateMesh(const mapPolyMesh&)
131  {}
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
const labelList patchIDs(pbm.indices(polyPatchNames, true))
labelList getExposedFaces(const bitSet &removedCell) const
Get labels of faces exposed after cells removal.
Definition: removeCells.C:77
Given list of cells to remove, insert all the topology changes.
Definition: removeCells.H:59
~removeCells()=default
Destructor.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:157
dynamicFvMesh & mesh
ClassName("removeCells")
Runtime type information.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Definition: removeCells.H:149
void setRefinement(const bitSet &removedCell, const labelUList &facesToExpose, const labelUList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
Definition: removeCells.C:181
removeCells(const polyMesh &mesh, const bool syncPar=true)
Construct from mesh. Parallel synchronized by default.
Definition: removeCells.C:67
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:59
Direct mesh changes based on v1.3 polyTopoChange syntax.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.