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-2024 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  A subset of mesh cells.
29 
30  Currently set up as an indirect list but will be extended to use a
31  primitive mesh. For quick check whether a cell belongs to the zone use
32  the lookup mechanism in cellZoneList, where all the zoned cells are
33  registered with their zone number.
34 
35 SourceFiles
36  cellZone.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef cellZone_H
41 #define cellZone_H
42 
43 #include "Zone.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 class cellZoneList;
51 
52 /*---------------------------------------------------------------------------*\
53  Class cellZone Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class cellZone
57 :
58  public Zone<cellZone, cellZoneList>
59 {
60 
61 public:
62 
63  typedef cellZoneList ZonesType;
64 
65  // Static Data Members
66 
67  //- The name associated with the zone-labels dictionary entry
68  static const char* const labelsName;
69 
70  //- Runtime type information
71  TypeName("cellZone");
72 
73 
74  // Constructors
75 
76  using Zone::Zone;
77 
78  //- Construct and return a clone, resetting the mesh zones
79  virtual autoPtr<cellZone> clone(const cellZoneList& mz) const
80  {
81  return autoPtr<cellZone>
82  (
83  new cellZone(*this, *this, mz)
84  );
85  }
86 
87  //- Construct and return a clone, resetting the cell list
88  // and mesh zones
89  virtual autoPtr<cellZone> clone
90  (
91  const labelUList& addr,
92  const cellZoneList& mz
93  ) const
94  {
95  return autoPtr<cellZone>
96  (
97  new cellZone(*this, addr, mz)
98  );
99  }
100 
101 
102  // Member Functions
103 
104  //- Return the mesh cell centres
105  const pointField& meshCentres() const;
106 
107  //- Check zone definition. Return true if in error.
108  bool checkDefinition(const bool report = false) const;
109 
110  //- Check whether zone is synchronised across coupled boundaries. Return
111  // true if in error.
112  bool checkParallelSync(const bool report = false) const
113  {
114  return false;
115  }
116 
117  //- Update zone using the given map
118  virtual void topoChange(const polyTopoChangeMap& map);
119 
120  //- Write dictionary
121  virtual void writeDict(Ostream&) const;
122 
123 
124  // Member Operators
125 
126  using Zone::operator=;
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
autoPtr< List< label > > clone() const
Clone.
Definition: ListI.H:109
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:67
Zone(const word &name, const labelUList &indices, const ZonesType &zones)
Construct from components.
Definition: Zone.C:112
friend Ostream & operator(Ostream &, const Zone< ZoneType, ZonesType > &)
Ostream Operator.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A subset of mesh cells.
Definition: cellZone.H:58
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
Definition: cellZone.C:54
const pointField & meshCentres() const
Return the mesh cell centres.
Definition: cellZone.C:48
cellZoneList ZonesType
Definition: cellZone.H:62
static const char *const labelsName
The name associated with the zone-labels dictionary entry.
Definition: cellZone.H:67
virtual void writeDict(Ostream &) const
Write dictionary.
Definition: cellZone.C:70
bool checkParallelSync(const bool report=false) const
Check whether zone is synchronised across coupled boundaries. Return.
Definition: cellZone.H:111
TypeName("cellZone")
Runtime type information.
virtual void topoChange(const polyTopoChangeMap &map)
Update zone using the given map.
Definition: cellZone.C:64
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Namespace for OpenFOAM.