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-2025 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 "meshObjects.H"
30 #include "pointMesh.H"
31 
32 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 
35 {
36  if (debug)
37  {
38  InfoInFunction << "Removing boundary patches." << endl;
39  }
40 
41  // Remove the point zones
42  boundary_.clear();
43  boundary_.setSize(0);
44 
45  clearOut();
46 }
47 
48 
49 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
50 
52 {
54 
55  Pout<< "polyMesh allocated :" << endl;
56 
57  if (tetBasePtIsPtr_.valid())
58  {
59  Pout<< " Tet base points" << endl;
60  }
61 }
62 
63 
65 {
66  if (debug)
67  {
68  InfoInFunction << "Clearing geometric data" << endl;
69  }
70 
71  // Clear all geometric mesh objects
72  meshObjects::clear<pointMesh, DeletableMeshObject>(*this);
73  meshObjects::clear<polyMesh, DeletableMeshObject>(*this);
74 
76 
77  boundary_.clearGeom();
78 
79  // Reset valid directions (could change with rotation)
80  geometricD_ = Zero;
81  solutionD_ = Zero;
82 }
83 
84 
85 void Foam::polyMesh::clearAddressing(const bool isMeshUpdate)
86 {
87  if (debug)
88  {
90  << "Clearing topology isMeshUpdate:" << isMeshUpdate << endl;
91  }
92 
93  if (isMeshUpdate)
94  {
95  // Part of a mesh update. Keep meshObjects that have an topoChange
96  // callback
98  <
99  pointMesh,
102  >
103  (
104  *this
105  );
107  <
108  polyMesh,
111  >
112  (
113  *this
114  );
115  }
116  else
117  {
118  meshObjects::clear<pointMesh, DeletableMeshObject>(*this);
119  meshObjects::clear<polyMesh, DeletableMeshObject>(*this);
120  }
121 
123 
124  // parallelData depends on the processorPatch ordering so force
125  // recalculation
126  globalMeshDataPtr_.clear();
127 
128  // Reset valid directions
129  geometricD_ = Zero;
130  solutionD_ = Zero;
131 
132  // Update zones
133  pointZones_.clearAddressing();
134  faceZones_.clearAddressing();
135  cellZones_.clearAddressing();
136 
137  // Remove the stored tet base points
138  tetBasePtIsPtr_.clear();
139 }
140 
141 
143 {
144  resetMotion();
145 
146  points_.setSize(0);
147  faces_.setSize(0);
148  owner_.setSize(0);
149  neighbour_.setSize(0);
150 
151  clearedPrimitives_ = true;
152 }
153 
154 
156 {
157  clearGeom();
158  clearAddressing();
159 }
160 
161 
163 {
164  if (debug)
165  {
166  InfoInFunction << "Clearing tet base points" << endl;
167  }
168 
169  tetBasePtIsPtr_.clear();
170 }
171 
172 
173 // ************************************************************************* //
MeshObject types:
Definition: MeshObjects.H:67
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
Definition: PtrList.C:198
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:131
static void clearUpto(objectRegistry &)
Clear all meshObjects derived from FromType up to (but not including)
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:53
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
void clearGeom()
Clear geometry.
Definition: polyMeshClear.C:64
void clearPrimitives()
Clear primitive data (points, faces and cells)
void clearTetBasePtIs()
Clear tet base points.
void printAllocated() const
Print a list of all the currently allocated mesh data.
Definition: polyMeshClear.C:51
void removeBoundary()
Remove boundary patches.
Definition: polyMeshClear.C:34
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
void clearGeom()
Clear geometry.
void clearAddressing()
Clear topological data.
void printAllocated() const
Print a list of all the currently allocated mesh data.
#define InfoInFunction
Report an information message using Foam::Info.
static const zero Zero
Definition: zero.H:97
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:258
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53