PrimitivePatchClear.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-2019 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 "PrimitivePatch.H"
27 #include "demandDrivenData.H"
28 
29 
30 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31 
32 template<class FaceList, class PointField>
34 {
35  if (debug)
36  {
37  InfoInFunction << "Clearing geometric data" << endl;
38  }
39 
40  deleteDemandDrivenData(localPointsPtr_);
41  deleteDemandDrivenData(faceCentresPtr_);
42  deleteDemandDrivenData(faceNormalsPtr_);
43  deleteDemandDrivenData(pointNormalsPtr_);
44 }
45 
46 
47 template<class FaceList, class PointField>
49 {
50  if (debug)
51  {
52  InfoInFunction << "Clearing patch addressing" << endl;
53  }
54 
55  // group created and destroyed together
56  if (edgesPtr_ && faceFacesPtr_ && edgeFacesPtr_ && faceEdgesPtr_)
57  {
58  delete edgesPtr_;
59  edgesPtr_ = nullptr;
60 
61  delete faceFacesPtr_;
62  faceFacesPtr_ = nullptr;
63 
64  delete edgeFacesPtr_;
65  edgeFacesPtr_ = nullptr;
66 
67  delete faceEdgesPtr_;
68  faceEdgesPtr_ = nullptr;
69  }
70 
71  deleteDemandDrivenData(boundaryPointsPtr_);
72  deleteDemandDrivenData(pointEdgesPtr_);
73  deleteDemandDrivenData(pointFacesPtr_);
74  deleteDemandDrivenData(edgeLoopsPtr_);
75  deleteDemandDrivenData(localPointOrderPtr_);
76 }
77 
78 
79 template<class FaceList, class PointField>
81 {
82  if (debug)
83  {
84  InfoInFunction << "Clearing patch-mesh addressing" << endl;
85  }
86 
87  deleteDemandDrivenData(meshPointsPtr_);
88  deleteDemandDrivenData(meshPointMapPtr_);
89  deleteDemandDrivenData(localFacesPtr_);
90 }
91 
92 
93 template<class FaceList, class PointField>
95 {
96  clearGeom();
97  clearTopology();
98  clearPatchMeshAddr();
99 }
100 
101 
102 // ************************************************************************* //
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
Template functions to aid in the implementation of demand driven data.
void deleteDemandDrivenData(DataPtr &dataPtr)
#define InfoInFunction
Report an information message using Foam::Info.