zoneSet.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 "zoneSet.H"
27 #include "pointZoneList.H"
28 #include "cellZoneList.H"
29 #include "faceZoneList.H"
30 
31 // * * * * * * * * * * * * * * * * Static Data * * * * * * * * * * * * * * * //
32 
35 {
36  "point",
37  "cell",
38  "face"
39 };
40 
43 {
44  "point",
45  "cell",
46  "face",
47  "all"
48 };
49 
50 
51 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
52 
54 {
55  zoneSet zs;
56 
57  if (!pZone_.empty())
58  {
59  pointZone* pZone_Ptr = pZone_.ptr();
60  zs.pZone_ = pZone_Ptr->zones().append(pZone_Ptr);
61  }
62  else if (pZone_.valid())
63  {
64  zs.pZone_ = pZone_();
65  }
66 
67  if (!cZone_.empty())
68  {
69  cellZone* cZone_Ptr = cZone_.ptr();
70  zs.cZone_ = cZone_Ptr->zones().append(cZone_Ptr);
71  }
72  else if (cZone_.valid())
73  {
74  zs.cZone_ = cZone_();
75  }
76 
77  if (!fZone_.empty())
78  {
79  faceZone* fZone_Ptr = fZone_.ptr();
80  zs.fZone_ = fZone_Ptr->zones().append(fZone_Ptr);
81  }
82  else if (fZone_.valid())
83  {
84  zs.fZone_ = fZone_();
85  }
86 
87  return zs;
88 }
89 
90 
91 // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
92 
94 {
95  if (!zs.pZone_.empty())
96  {
97  pZone_ = zs.pZone_;
98  }
99 
100  if (!zs.cZone_.empty())
101  {
102  cZone_ = zs.cZone_;
103  }
104 
105  if (!zs.fZone_.empty())
106  {
107  fZone_ = zs.fZone_;
108  }
109 }
110 
111 
112 // ************************************************************************* //
Foam::cellZoneList.
Initialise the NamedEnum HashTable from the static list of names.
Definition: NamedEnum.H:55
const ZoneType & append(ZoneType *) const
Append or update a zone.
Definition: ZoneList.C:214
const ZonesType & zones() const
Return ZonesType reference.
Definition: Zone.C:213
Named list of cell indices representing a sub-set of the mesh.
Definition: cellZone.H:61
Named list of face indices representing a sub-set of the mesh faces.
Definition: faceZone.H:66
Named list of point indices representing a sub-set of the mesh faces.
Definition: pointZone.H:60
Zone container returned by zoneGenerator::generate.
Definition: zoneSet.H:94
void operator=(const zoneSet &)
Assignment transferring the temporary zones.
Definition: zoneSet.C:93
zoneSet store() const
Store the temporary zones and return the stored zoneSet.
Definition: zoneSet.C:53
Foam::faceZoneList.
const NamedEnum< zoneTypesAll, 4 > zoneTypesAllNames
Named enumeration defining the zone type names.
Definition: zoneSet.C:43
const NamedEnum< zoneTypes, 3 > zoneTypesNames
Named enumeration defining the zone type names.
Definition: zoneSet.C:35
Foam::pointZoneList.