PrimitivePatchClear.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | foam-extend: Open Source CFD
4  \\ / O peration | Version: 3.2
5  \\ / A nd | Web: http://www.foam-extend.org
6  \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9  This file is part of foam-extend.
10 
11  foam-extend is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation, either version 3 of the License, or (at your
14  option) any later version.
15 
16  foam-extend is distributed in the hope that it will be useful, but
17  WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "PrimitivePatchTemplate.H"
27 #include "demandDrivenData.H"
28 
29 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
30 
31 template
32 <
33  class Face,
34  template<class> class FaceList,
35  class PointField,
36  class PointType
37 >
38 void
41 {
42  if (debug)
43  {
44  Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
45  << "clearGeom() : clearing geometric data"
46  << endl;
47  }
48 
49  deleteDemandDrivenData(localPointsPtr_);
50  deleteDemandDrivenData(faceCentresPtr_);
51  deleteDemandDrivenData(faceNormalsPtr_);
52  deleteDemandDrivenData(pointNormalsPtr_);
53 }
54 
55 
56 template
57 <
58  class Face,
59  template<class> class FaceList,
60  class PointField,
61  class PointType
62 >
63 void
66 {
67  if (debug)
68  {
69  Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
70  << "clearTopology() : clearing patch addressing"
71  << endl;
72  }
73 
74  // group created and destroyed together
75  if (edgesPtr_ && faceFacesPtr_ && edgeFacesPtr_ && faceEdgesPtr_)
76  {
77  delete edgesPtr_;
78  edgesPtr_ = NULL;
79 
80  delete faceFacesPtr_;
81  faceFacesPtr_ = NULL;
82 
83  delete edgeFacesPtr_;
84  edgeFacesPtr_ = NULL;
85 
86  delete faceEdgesPtr_;
87  faceEdgesPtr_ = NULL;
88  }
89 
90  deleteDemandDrivenData(boundaryPointsPtr_);
91  deleteDemandDrivenData(pointEdgesPtr_);
92  deleteDemandDrivenData(pointFacesPtr_);
93  deleteDemandDrivenData(edgeLoopsPtr_);
94  deleteDemandDrivenData(localPointOrderPtr_);
95 }
96 
97 
98 template
99 <
100  class Face,
101  template<class> class FaceList,
102  class PointField,
103  class PointType
104 >
105 void
108 {
109  if (debug)
110  {
111  Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
112  << "clearPatchMeshAddr() : "
113  << "clearing patch-mesh addressing"
114  << endl;
115  }
116 
117  deleteDemandDrivenData(meshPointsPtr_);
118  deleteDemandDrivenData(meshPointMapPtr_);
119  deleteDemandDrivenData(localFacesPtr_);
120 }
121 
122 
123 template
124 <
125  class Face,
126  template<class> class FaceList,
127  class PointField,
128  class PointType
129 >
130 void
133 {
134  clearGeom();
135  clearTopology();
136  clearPatchMeshAddr();
137 }
138 
139 
140 // ************************************************************************* //
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
PrimitivePatchTemplate.H
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:40
Foam::Info
messageStream Info
Foam::PrimitivePatch::clearGeom
void clearGeom()
Definition: PrimitivePatchClear.C:40
Foam::PrimitivePatch::clearTopology
void clearTopology()
Definition: PrimitivePatchClear.C:65
Foam::PrimitivePatch::clearOut
void clearOut()
Definition: PrimitivePatchClear.C:132
Foam::PrimitivePatch::clearPatchMeshAddr
void clearPatchMeshAddr()
Definition: PrimitivePatchClear.C:107