polyMeshClear.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 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 cell tree
73  cellTreePtr_.clear();
74 }
75 
76 
77 void Foam::polyMesh::clearAddressing(const bool isMeshUpdate)
78 {
79  if (debug)
80  {
82  << "Clearing topology isMeshUpdate:" << isMeshUpdate << endl;
83  }
84 
85  if (isMeshUpdate)
86  {
87  // Part of a mesh update. Keep meshObjects that have an topoChange
88  // callback
90  <
91  pointMesh,
94  >
95  (
96  *this
97  );
99  <
100  polyMesh,
101  TopologicalMeshObject,
103  >
104  (
105  *this
106  );
107  }
108  else
109  {
110  meshObject::clear<pointMesh, TopologicalMeshObject>(*this);
111  meshObject::clear<polyMesh, TopologicalMeshObject>(*this);
112  }
113 
115 
116  // parallelData depends on the processorPatch ordering so force
117  // recalculation
118  globalMeshDataPtr_.clear();
119 
120  // Reset valid directions
121  geometricD_ = Zero;
122  solutionD_ = Zero;
123 
124  // Update zones
125  pointZones_.clearAddressing();
126  faceZones_.clearAddressing();
127  cellZones_.clearAddressing();
128 
129  // Remove the stored tet base points
130  tetBasePtIsPtr_.clear();
131 
132  // Remove the cell tree
133  cellTreePtr_.clear();
134 }
135 
136 
138 {
139  resetMotion();
140 
141  points_.setSize(0);
142  faces_.setSize(0);
143  owner_.setSize(0);
144  neighbour_.setSize(0);
145 
146  clearedPrimitives_ = true;
147 }
148 
149 
151 {
152  clearGeom();
153  clearAddressing();
154 }
155 
156 
158 {
159  if (debug)
160  {
161  InfoInFunction << "Clearing tet base points" << endl;
162  }
163 
164  tetBasePtIsPtr_.clear();
165 }
166 
167 
169 {
170  if (debug)
171  {
172  InfoInFunction << "Clearing cell tree" << endl;
173  }
174 
175  cellTreePtr_.clear();
176 }
177 
178 
179 // ************************************************************************* //
void clearAddressing()
Clear topological data.
void resetMotion() const
Reset motion.
Definition: polyMesh.C:1427
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
void clearGeom()
Clear geometry at this level and at patches.
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:540
static const zero Zero
Definition: zero.H:97
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 clearTetBasePtIs()
Clear tet base points.
void setSize(const label)
Reset size of List.
Definition: List.C:281
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
Definition: PtrList.C:174
void clearAddressing()
Clear addressing.
Definition: MeshZones.C:387
void clearCellTree()
Clear cell tree data.
polyMesh(const IOobject &io)
Construct from IOobject.
Definition: polyMesh.C:163
#define InfoInFunction
Report an information message using Foam::Info.