removePoints.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::removePoints
26 
27 Description
28  Removes selected points from mesh and updates faces using these
29  points.
30 
31 SourceFiles
32  removePoints.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef removePoints_H
37 #define removePoints_H
38 
39 #include "typeInfo.H"
40 #include "boolList.H"
41 #include "pointField.H"
42 #include "faceList.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of classes
50 class polyMesh;
51 class polyTopoChange;
52 class mapPolyMesh;
53 class face;
54 
55 /*---------------------------------------------------------------------------*\
56  Class removePoints Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class removePoints
60 {
61 
62  // Private data
63 
64  //- Reference to mesh
65  const polyMesh& mesh_;
66 
67  //- Whether undoable
68  const bool undoable_;
69 
70  //- If undoable: deleted points
72 
73  //- If undoable: per stored face the original mesh face label
75 
76  //- If undoable: per stored face the vertices. Negative indices
77  // refer to deletedPoints_
79 
80 
81  // Private Member Functions
82 
83  //- Change the vertices of the face whilst keeping everything else
84  // (patch, zone) the same.
85  void modifyFace
86  (
87  const label faceI,
88  const face&,
90  ) const;
91 
92 
93  //- Disallow default bitwise copy construct
94  removePoints(const removePoints&);
95 
96  //- Disallow default bitwise assignment
97  void operator=(const removePoints&);
98 
99 public:
100 
101  //- Runtime type information
102  ClassName("removePoints");
103 
104 
105  // Constructors
106 
107  //- Construct from mesh
108  removePoints(const polyMesh& mesh, const bool undoable = false);
109 
110 
111  // Member Functions
112 
113  //- If undoable: affected face labels. Already restored faces
114  // will be -1.
115  const labelList& savedFaceLabels() const
116  {
117  return savedFaceLabels_;
118  }
119 
120 
121  // Helper functions
122 
123  //- Mark in pointCanBeDeleted the points that can be deleted
124  // (parallel synchronised) and returns the global number of these
125  // points. (this number is the global number before synchronisation
126  // so might be off!)
127  // A point can be deleted if
128  // - it is not used by any edge.
129  // or
130  // - is used by only two edges
131  // - these two edges are sufficiently in line (cos > minCos)
132  // - all processors agree that point can be deleted.
134  (
135  const scalar minCos,
136  boolList& pointCanBeDeleted
137  ) const;
138 
139  // Topology changes
140 
141  //- Play commands into polyTopoChange to remove points. Gets
142  // boolList (output of countPointUsage) as input.
143  // Does no check for whether resulting face is legal.
144  // Since pointCanBeDeleted is synced all coupled faces should
145  // decide the same.
146  void setRefinement(const boolList&, polyTopoChange&);
147 
148  //- Force recalculation of locally stored data on topological change
149  void updateMesh(const mapPolyMesh&);
150 
151  //- Given set of faces to restore calculates a consistent set of
152  // saved faces (indices into savedFaces_) and saved vertices
153  // (indices into savedPoints_) to restore. The undoFaces have to
154  // be synced.
155  void getUnrefimentSet
156  (
157  const labelList& undoFaces,
158  labelList& localFaces,
159  labelList& localPoints
160  ) const;
161 
162  //- Restore selected faces and vertices.
163  void setUnrefinement
164  (
165  const labelList& localFaces,
166  const labelList& localPoints,
168  );
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Foam::removePoints::removePoints
removePoints(const removePoints &)
Disallow default bitwise copy construct.
boolList.H
typeInfo.H
Foam::removePoints
Removes selected points from mesh and updates faces using these points.
Definition: removePoints.H:58
Foam::removePoints::savedFaces_
faceList savedFaces_
If undoable: per stored face the vertices. Negative indices.
Definition: removePoints.H:77
Foam::removePoints::mesh_
const polyMesh & mesh_
Reference to mesh.
Definition: removePoints.H:64
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:97
Foam::removePoints::getUnrefimentSet
void getUnrefimentSet(const labelList &undoFaces, labelList &localFaces, labelList &localPoints) const
Given set of faces to restore calculates a consistent set of.
Definition: removePoints.C:579
Foam::removePoints::ClassName
ClassName("removePoints")
Runtime type information.
faceList.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::removePoints::savedFaceLabels_
labelList savedFaceLabels_
If undoable: per stored face the original mesh face label.
Definition: removePoints.H:73
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:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::removePoints::modifyFace
void modifyFace(const label faceI, const face &, polyTopoChange &) const
Change the vertices of the face whilst keeping everything else.
Definition: removePoints.C:100
Foam::removePoints::savedFaceLabels
const labelList & savedFaceLabels() const
If undoable: affected face labels. Already restored faces.
Definition: removePoints.H:114
Foam::removePoints::operator=
void operator=(const removePoints &)
Disallow default bitwise assignment.
Foam::removePoints::setUnrefinement
void setUnrefinement(const labelList &localFaces, const labelList &localPoints, polyTopoChange &)
Restore selected faces and vertices.
Definition: removePoints.C:791
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
pointField.H
Foam::removePoints::undoable_
const bool undoable_
Whether undoable.
Definition: removePoints.H:67
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:59
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Foam::removePoints::savedPoints_
pointField savedPoints_
If undoable: deleted points.
Definition: removePoints.H:70
Foam::removePoints::updateMesh
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Definition: removePoints.C:477
Foam::removePoints::setRefinement
void setRefinement(const boolList &, polyTopoChange &)
Play commands into polyTopoChange to remove points. Gets.
Definition: removePoints.C:317
Foam::removePoints::countPointUsage
label countPointUsage(const scalar minCos, boolList &pointCanBeDeleted) const
Mark in pointCanBeDeleted the points that can be deleted.
Definition: removePoints.C:166