cellZone.H
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-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 Class
25  Foam::cellZone
26 
27 Description
28  Named list of cell indices representing a sub-set of the mesh
29 
30  Used by mesh-manipulation tools, field initialisation and for sources and
31  functionObjects that apply to sub-sets of the cells.
32 
33 See also
34  cellZoneList
35  Zone
36  zoneGenerator
37 
38 SourceFiles
39  cellZone.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef cellZone_H
44 #define cellZone_H
45 
46 #include "Zone.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 class cellZoneList;
54 
55 /*---------------------------------------------------------------------------*\
56  Class cellZone Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class cellZone
60 :
61  public Zone<cellZone, cellZoneList>
62 {
63 
64 public:
65 
66  // Static Data Members
67 
68  //- The name associated with the zone-labels dictionary entry
69  static const char* const labelsName;
70 
71  //- Runtime type information
72  ClassName("cellZone");
73 
74 
75  // Constructors
76 
77  using Zone::Zone;
78 
79  //- Construct and return a clone
80  autoPtr<cellZone> clone() const
81  {
82  return autoPtr<cellZone>
83  (
84  new cellZone(*this, name(), *this, zones())
85  );
86  }
87 
88  //- Construct and return a clone with a new name
89  autoPtr<cellZone> clone(const word& name) const
90  {
91  return autoPtr<cellZone>
92  (
93  new cellZone(*this, name, *this, zones())
94  );
95  }
96 
97  //- Construct and return a clone, resetting the mesh zones
98  autoPtr<cellZone> clone(const cellZoneList& mz) const
99  {
100  return autoPtr<cellZone>
101  (
102  new cellZone(*this, name(), *this, mz)
103  );
104  }
105 
106  //- Construct and return a clone, resetting the cell list
107  // and mesh zones
109  (
110  const labelUList& addr,
111  const cellZoneList& mz
112  ) const
113  {
114  return autoPtr<cellZone>
115  (
116  new cellZone(*this, name(), addr, mz)
117  );
118  }
119 
120 
121  // Member Functions
122 
123  //- Check zone definition. Return true if in error.
124  bool checkDefinition(const bool report = false) const;
125 
126  //- Check whether zone is synchronised across coupled boundaries. Return
127  // true if in error.
128  bool checkParallelSync(const bool report = false) const
129  {
130  return false;
131  }
132 
133  //- Update zone using the given map
134  void topoChange(const polyTopoChangeMap& map);
135 
136  //- Write dictionary
137  void writeDict(Ostream&) const;
138 
139 
140  // Member Operators
141 
142  using Zone::operator=;
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #endif
153 
154 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Base class for zones.
Definition: Zone.H:68
Zone(const word &name, const labelUList &indices, const ZonesType &zones, const bool moveUpdate=false, const bool topoUpdate=false)
Construct from components.
Definition: Zone.C:112
friend Ostream & operator(Ostream &, const Zone< ZoneType, ZonesType > &)
Ostream Operator.
const word & name() const
Return name.
Definition: Zone.H:171
const cellZoneList & zones() const
Return ZonesType reference.
Definition: Zone.C:213
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Named list of cell indices representing a sub-set of the mesh.
Definition: cellZone.H:61
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
Definition: cellZone.C:43
static const char *const labelsName
The name associated with the zone-labels dictionary entry.
Definition: cellZone.H:68
void writeDict(Ostream &) const
Write dictionary.
Definition: cellZone.C:62
ClassName("cellZone")
Runtime type information.
bool checkParallelSync(const bool report=false) const
Check whether zone is synchronised across coupled boundaries. Return.
Definition: cellZone.H:127
void topoChange(const polyTopoChangeMap &map)
Update zone using the given map.
Definition: cellZone.C:53
autoPtr< cellZone > clone() const
Construct and return a clone.
Definition: cellZone.H:79
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.