remove.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) 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 "remove.H"
27 #include "polyMesh.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  namespace zoneGenerators
35  {
38  }
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 (
46  const word& name,
47  const polyMesh& mesh,
48  const dictionary& dict
49 )
50 :
52  pointZoneNames_
53  (
54  dict.found("pointZone")
55  ? wordList(1, dict.lookup<word>("pointZone"))
56  : dict.lookupOrDefault("pointZones", wordList())
57  ),
58  cellZoneNames_
59  (
60  dict.found("cellZone")
61  ? wordList(1, dict.lookup<word>("cellZone"))
62  : dict.lookupOrDefault("cellZones", wordList())
63  ),
64  faceZoneNames_
65  (
66  dict.found("faceZone")
67  ? wordList(1, dict.lookup<word>("faceZone"))
68  : dict.lookupOrDefault("faceZones", wordList())
69  )
70 {}
71 
72 
73 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
74 
76 {}
77 
78 
79 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 
82 {
83  forAll(pointZoneNames_, i)
84  {
85  if (mesh_.pointZones().found(pointZoneNames_[i]))
86  {
87  const_cast<pointZoneList&>(mesh_.pointZones()).remove
88  (
89  pointZoneNames_[i]
90  );
91  }
92  }
93 
94  forAll(cellZoneNames_, i)
95  {
96  if (mesh_.cellZones().found(cellZoneNames_[i]))
97  {
98  const_cast<cellZoneList&>(mesh_.cellZones()).remove
99  (
100  cellZoneNames_[i]
101  );
102  }
103  }
104 
105  forAll(faceZoneNames_, i)
106  {
107  if (mesh_.faceZones().found(faceZoneNames_[i]))
108  {
109  const_cast<faceZoneList&>(mesh_.faceZones()).remove
110  (
111  faceZoneNames_[i]
112  );
113  }
114  }
115 
116  return zoneSet();
117 }
118 
119 
120 // ************************************************************************* //
bool found
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
Macros for easy insertion into run-time selection tables.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A class for handling words, derived from string.
Definition: word.H:62
Abstract base class for all zoneGenerators, providing runtime selection.
Definition: zoneGenerator.H:57
A zoneGenerator which looks-up and returns a zoneSet containing point, and/or cell and/or faces zones...
Definition: lookup.H:139
A zoneGenerator which removes pointZones and/or cellZone and/or faceZones from the mesh.
Definition: remove.H:130
virtual ~remove()
Destructor.
Definition: remove.C:75
virtual zoneSet generate() const
Generate and return the zoneSet.
Definition: remove.C:81
remove(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: remove.C:45
Zone container returned by zoneGenerator::generate.
Definition: zoneSet.H:94
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
defineTypeNameAndDebug(cylinderHeadPoints, 0)
addToRunTimeSelectionTable(zoneGenerator, cylinderHeadPoints, dictionary)
Namespace for OpenFOAM.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict