PrimitivePatchClear.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "PrimitivePatch.H"
29 #include "demandDrivenData.H"
30 
31 
32 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
33 
34 template
35 <
36  class Face,
37  template<class> class FaceList,
38  class PointField,
39  class PointType
40 >
41 void
44 {
45  if (debug)
46  {
47  InfoInFunction << "Clearing geometric data" << endl;
48  }
49 
50  deleteDemandDrivenData(localPointsPtr_);
51  deleteDemandDrivenData(faceCentresPtr_);
52  deleteDemandDrivenData(faceAreasPtr_);
53  deleteDemandDrivenData(magFaceAreasPtr_);
54  deleteDemandDrivenData(faceNormalsPtr_);
55  deleteDemandDrivenData(pointNormalsPtr_);
56 }
57 
58 
59 template
60 <
61  class Face,
62  template<class> class FaceList,
63  class PointField,
64  class PointType
65 >
66 void
69 {
70  if (debug)
71  {
72  InfoInFunction << "Clearing patch addressing" << endl;
73  }
74 
75  // group created and destroyed together
76  if (edgesPtr_ && faceFacesPtr_ && edgeFacesPtr_ && faceEdgesPtr_)
77  {
78  delete edgesPtr_;
79  edgesPtr_ = nullptr;
80 
81  delete faceFacesPtr_;
82  faceFacesPtr_ = nullptr;
83 
84  delete edgeFacesPtr_;
85  edgeFacesPtr_ = nullptr;
86 
87  delete faceEdgesPtr_;
88  faceEdgesPtr_ = nullptr;
89  }
90 
91  deleteDemandDrivenData(boundaryPointsPtr_);
92  deleteDemandDrivenData(pointEdgesPtr_);
93  deleteDemandDrivenData(pointFacesPtr_);
94  deleteDemandDrivenData(edgeLoopsPtr_);
95  deleteDemandDrivenData(localPointOrderPtr_);
96 }
97 
98 
99 template
100 <
101  class Face,
102  template<class> class FaceList,
103  class PointField,
104  class PointType
105 >
106 void
109 {
110  if (debug)
111  {
112  InfoInFunction << "Clearing patch-mesh addressing" << endl;
113  }
114 
115  deleteDemandDrivenData(meshPointsPtr_);
116  deleteDemandDrivenData(meshPointMapPtr_);
117  deleteDemandDrivenData(localFacesPtr_);
118 }
119 
120 
121 template
122 <
123  class Face,
124  template<class> class FaceList,
125  class PointField,
126  class PointType
127 >
128 void
131 {
132  clearGeom();
133  clearTopology();
134  clearPatchMeshAddr();
135 }
136 
137 
138 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
InfoInFunction
#define InfoInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:316
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:337
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:42
PrimitivePatch.H
Foam::PrimitivePatch::clearGeom
void clearGeom()
Definition: PrimitivePatchClear.C:43
Foam::PrimitivePatch::clearTopology
void clearTopology()
Definition: PrimitivePatchClear.C:68
Foam::PrimitivePatch::clearOut
void clearOut()
Definition: PrimitivePatchClear.C:130
Foam::PrimitivePatch::clearPatchMeshAddr
void clearPatchMeshAddr()
Definition: PrimitivePatchClear.C:108