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-2013 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  Info<< "void polyMesh::removeBoundary(): "
41  << "Removing boundary patches."
42  << endl;
43  }
44 
45  // Remove the point zones
46  boundary_.clear();
47  boundary_.setSize(0);
48 
49  clearOut();
50 }
51 
52 
53 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54 
56 {
57  if (debug)
58  {
59  Info<< "void polyMesh::clearGeom() : "
60  << "clearing geometric data"
61  << endl;
62  }
63 
64  // Clear all geometric mesh objects
65  meshObject::clear<pointMesh, GeometricMeshObject>(*this);
66  meshObject::clear<polyMesh, GeometricMeshObject>(*this);
67 
69 
70  boundary_.clearGeom();
71 
72  // Reset valid directions (could change with rotation)
73  geometricD_ = Vector<label>::zero;
74  solutionD_ = Vector<label>::zero;
75 
76  // Remove the stored tet base points
77  tetBasePtIsPtr_.clear();
78  // Remove the cell tree
79  cellTreePtr_.clear();
80 }
81 
82 
84 {
85  if (debug)
86  {
87  Info<< "void polyMesh::clearAdditionalGeom() : "
88  << "clearing additional geometric data"
89  << endl;
90  }
91 
92  // Remove the stored tet base points
93  tetBasePtIsPtr_.clear();
94  // Remove the cell tree
95  cellTreePtr_.clear();
96 }
97 
98 
99 void Foam::polyMesh::clearAddressing(const bool isMeshUpdate)
100 {
101  if (debug)
102  {
103  Info<< "void polyMesh::clearAddressing() : "
104  << "clearing topology isMeshUpdate:" << isMeshUpdate
105  << endl;
106  }
107 
108  if (isMeshUpdate)
109  {
110  // Part of a mesh update. Keep meshObjects that have an updateMesh
111  // callback
113  <
114  pointMesh,
117  >
118  (
119  *this
120  );
122  <
123  polyMesh,
126  >
127  (
128  *this
129  );
130  }
131  else
132  {
133  meshObject::clear<pointMesh, TopologicalMeshObject>(*this);
134  meshObject::clear<polyMesh, TopologicalMeshObject>(*this);
135  }
136 
138 
139  // parallelData depends on the processorPatch ordering so force
140  // recalculation
141  globalMeshDataPtr_.clear();
142 
143  // Reset valid directions
144  geometricD_ = Vector<label>::zero;
145  solutionD_ = Vector<label>::zero;
146 
147  // Update zones
148  pointZones_.clearAddressing();
149  faceZones_.clearAddressing();
150  cellZones_.clearAddressing();
151 
152  // Remove the stored tet base points
153  tetBasePtIsPtr_.clear();
154 
155  // Remove the cell tree
156  cellTreePtr_.clear();
157 }
158 
159 
161 {
162  resetMotion();
163 
164  points_.setSize(0);
165  faces_.setSize(0);
166  owner_.setSize(0);
167  neighbour_.setSize(0);
168 
169  clearedPrimitives_ = true;
170 }
171 
172 
174 {
175  clearGeom();
176  clearAddressing();
177 }
178 
179 
181 {
182  if (debug)
183  {
184  Info<< "void polyMesh::clearCellTree() : "
185  << "clearing cell tree"
186  << endl;
187  }
188 
189  cellTreePtr_.clear();
190 }
191 
192 
193 // ************************************************************************* //
Foam::primitiveMesh::clearGeom
void clearGeom()
Clear geometry.
Definition: primitiveMeshClear.C:126
Foam::primitiveMesh::clearAddressing
void clearAddressing()
Clear topological data.
Definition: primitiveMeshClear.C:142
globalMeshData.H
Foam::polyMesh::clearCellTree
void clearCellTree()
Clear cell tree data.
Definition: polyMeshClear.C:180
indexedOctree.H
Foam::polyMesh::clearOut
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
Definition: polyMeshClear.C:173
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
polyMesh.H
Foam::UpdateableMeshObject
Definition: MeshObject.H:258
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::polyMesh::clearAdditionalGeom
void clearAdditionalGeom()
Clear geometry not used for CFD (cellTree, tetBasePtIs)
Definition: polyMeshClear.C:83
Foam::meshObject::clearUpto
static void clearUpto(objectRegistry &)
Clear all meshObject derived from FromType up to (but not including)
Definition: MeshObject.C:401
Foam::Info
messageStream Info
Foam::polyMesh::clearPrimitives
void clearPrimitives()
Clear primitive data (points, faces and cells)
Definition: polyMeshClear.C:160
Foam::polyMesh::boundary_
polyBoundaryMesh boundary_
Boundary mesh.
Definition: polyMesh.H:134
Foam::PtrList::clear
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
Definition: PtrList.C:185
Foam::pointMesh
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:48
treeDataCell.H
Foam::polyMesh::removeBoundary
void removeBoundary()
Remove boundary patches.
Definition: polyMeshClear.C:36
Foam::polyMesh::clearGeom
void clearGeom()
Clear geometry.
Definition: polyMeshClear.C:55
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:57
Foam::PtrList::setSize
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:142
Foam::TopologicalMeshObject
Definition: MeshObject.H:202
MeshObject.H
pointMesh.H