polyMeshClear.C
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-2016 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 \*---------------------------------------------------------------------------*/
25 
26 #include "polyMesh.H"
27 #include "primitiveMesh.H"
28 #include "globalMeshData.H"
29 #include "MeshObject.H"
30 #include "indexedOctree.H"
31 #include "treeDataCell.H"
32 #include "pointMesh.H"
33 
34 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35 
37 {
38  if (debug)
39  {
40  InfoInFunction << "Removing boundary patches." << endl;
41  }
42 
43  // Remove the point zones
44  boundary_.clear();
45  boundary_.setSize(0);
46 
47  clearOut();
48 }
49 
50 
51 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
52 
54 {
55  if (debug)
56  {
57  InfoInFunction << "Clearing geometric data" << endl;
58  }
59 
60  // Clear all geometric mesh objects
61  meshObject::clear<pointMesh, GeometricMeshObject>(*this);
62  meshObject::clear<polyMesh, GeometricMeshObject>(*this);
63 
65 
66  boundary_.clearGeom();
67 
68  // Reset valid directions (could change with rotation)
69  geometricD_ = Zero;
70  solutionD_ = Zero;
71 
72  // Remove the stored tet base points
73  tetBasePtIsPtr_.clear();
74  // Remove the cell tree
75  cellTreePtr_.clear();
76 }
77 
78 
80 {
81  if (debug)
82  {
83  InfoInFunction << "Clearing additional geometric data" << endl;
84  }
85 
86  // Remove the stored tet base points
87  tetBasePtIsPtr_.clear();
88  // Remove the cell tree
89  cellTreePtr_.clear();
90 }
91 
92 
93 void Foam::polyMesh::clearAddressing(const bool isMeshUpdate)
94 {
95  if (debug)
96  {
98  << "Clearing topology isMeshUpdate:" << isMeshUpdate << endl;
99  }
100 
101  if (isMeshUpdate)
102  {
103  // Part of a mesh update. Keep meshObjects that have an updateMesh
104  // callback
106  <
107  pointMesh,
110  >
111  (
112  *this
113  );
115  <
116  polyMesh,
117  TopologicalMeshObject,
119  >
120  (
121  *this
122  );
123  }
124  else
125  {
126  meshObject::clear<pointMesh, TopologicalMeshObject>(*this);
127  meshObject::clear<polyMesh, TopologicalMeshObject>(*this);
128  }
129 
131 
132  // parallelData depends on the processorPatch ordering so force
133  // recalculation
134  globalMeshDataPtr_.clear();
135 
136  // Reset valid directions
137  geometricD_ = Zero;
138  solutionD_ = Zero;
139 
140  // Update zones
141  pointZones_.clearAddressing();
142  faceZones_.clearAddressing();
143  cellZones_.clearAddressing();
144 
145  // Remove the stored tet base points
146  tetBasePtIsPtr_.clear();
147 
148  // Remove the cell tree
149  cellTreePtr_.clear();
150 }
151 
152 
154 {
155  resetMotion();
156 
157  points_.setSize(0);
158  faces_.setSize(0);
159  owner_.setSize(0);
160  neighbour_.setSize(0);
161 
162  clearedPrimitives_ = true;
163 }
164 
165 
167 {
168  clearGeom();
169  clearAddressing();
170 }
171 
172 
174 {
175  if (debug)
176  {
177  InfoInFunction << "Clearing cell tree" << endl;
178  }
179 
180  cellTreePtr_.clear();
181 }
182 
183 
184 // ************************************************************************* //
void clearAddressing()
Clear addressing.
Definition: ZoneMesh.C:387
void clearAddressing()
Clear topological data.
void resetMotion() const
Reset motion.
Definition: polyMesh.C:1133
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
void clearGeom()
Clear geometry at this level and at patches.
void clearAdditionalGeom()
Clear geometry not used for CFD (cellTree, tetBasePtIs)
Definition: polyMeshClear.C:79
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:48
void clearGeom()
Clear geometry.
void clearPrimitives()
Clear primitive data (points, faces and cells)
static void clearUpto(objectRegistry &)
Clear all meshObject derived from FromType up to (but not including)
Definition: MeshObject.C:401
static const zero Zero
Definition: zero.H:91
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:131
void clearGeom()
Clear geometry.
Definition: polyMeshClear.C:53
void removeBoundary()
Remove boundary patches.
Definition: polyMeshClear.C:36
void setSize(const label)
Reset size of List.
Definition: List.C:295
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
Definition: PtrList.C:174
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
void clearCellTree()
Clear cell tree data.
#define InfoInFunction
Report an information message using Foam::Info.