cellZoneSet.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::cellZoneSet
26 
27 Description
28  Like cellSet but -reads data from cellZone -updates cellZone when writing.
29 
30 SourceFiles
31  cellZone.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef cellZoneSet_H
36 #define cellZoneSet_H
37 
38 #include "cellSet.H"
39 #include "boolList.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class cellZoneSet Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class cellZoneSet
51 :
52  public cellSet
53 {
54  // Private Data
55 
56  const polyMesh& mesh_;
57 
58  labelList addressing_;
59 
60 
61 public:
62 
63  //- Runtime type information
64  TypeName("cellZoneSet");
65 
66 
67  // Constructors
68 
69  //- Construct from objectRegistry and name
71  (
72  const polyMesh& mesh,
73  const word& name,
76  );
77 
78  //- Construct from additional size of labelHashSet
80  (
81  const polyMesh& mesh,
82  const word& name,
83  const label,
85  );
86 
87  //- Construct from existing set
89  (
90  const polyMesh& mesh,
91  const word& name,
92  const topoSet&,
94  );
95 
96 
97 
98  //- Destructor
99  virtual ~cellZoneSet();
100 
101 
102  // Member Functions
103 
104  const labelList& addressing() const
105  {
106  return addressing_;
107  }
108 
110  {
111  return addressing_;
112  }
113 
114  //- Sort addressing and make cellSet part consistent with addressing
115  void updateSet();
116 
117  //- Invert contents. (insert all members 0..maxLen-1 which were not in
118  // set)
119  virtual void invert(const label maxLen);
120 
121  //- Subset contents. Only elements present in both sets remain.
122  virtual void subset(const topoSet& set);
123 
124  //- Add elements present in set.
125  virtual void addSet(const topoSet& set);
126 
127  //- Delete elements present in set.
128  virtual void deleteSet(const topoSet& set);
129 
130  //- Sync cellSet across coupled patches; update cellZone from cellSet
131  virtual void sync(const polyMesh& mesh);
132 
133  //- Write maxLen items with label and coordinates.
134  virtual void writeDebug
135  (
136  Ostream& os,
137  const primitiveMesh&,
138  const label maxLen
139  ) const;
140 
141  //- Write cellZone
142  virtual bool writeObject
143  (
147  const bool write = true
148  ) const;
149 
150  //- Update any stored data for new labels
151  virtual void topoChange(const polyTopoChangeMap& map);
152 
153  //- Return max index+1.
154  virtual label maxSize(const polyMesh& mesh) const;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
bool set(const label &key)
Same as insert (cannot overwrite nil content)
Definition: HashSet.H:123
readOption
Enumeration defining the read options.
Definition: IOobject.H:117
const word & name() const
Return name.
Definition: IOobject.H:310
writeOption
Enumeration defining the write options.
Definition: IOobject.H:126
Version number type.
Definition: IOstream.H:97
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:87
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:194
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A collection of cell labels.
Definition: cellSet.H:51
Like cellSet but -reads data from cellZone -updates cellZone when writing.
Definition: cellZoneSet.H:52
TypeName("cellZoneSet")
Runtime type information.
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
Definition: cellZoneSet.C:241
virtual void invert(const label maxLen)
Invert contents. (insert all members 0..maxLen-1 which were not in.
Definition: cellZoneSet.C:137
virtual bool writeObject(IOstream::streamFormat, IOstream::versionNumber, IOstream::compressionType, const bool write=true) const
Write cellZone.
Definition: cellZoneSet.C:248
virtual void deleteSet(const topoSet &set)
Delete elements present in set.
Definition: cellZoneSet.C:209
cellZoneSet(const polyMesh &mesh, const word &name, readOption r=MUST_READ, writeOption w=NO_WRITE)
Construct from objectRegistry and name.
Definition: cellZoneSet.C:66
virtual void sync(const polyMesh &mesh)
Sync cellSet across coupled patches; update cellZone from cellSet.
Definition: cellZoneSet.C:231
virtual void addSet(const topoSet &set)
Add elements present in set.
Definition: cellZoneSet.C:188
const labelList & addressing() const
Definition: cellZoneSet.H:103
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
Definition: cellZoneSet.C:315
virtual void subset(const topoSet &set)
Subset contents. Only elements present in both sets remain.
Definition: cellZoneSet.C:167
virtual void topoChange(const polyTopoChangeMap &map)
Update any stored data for new labels.
Definition: cellZoneSet.C:290
virtual ~cellZoneSet()
Destructor.
Definition: cellZoneSet.C:131
void updateSet()
Sort addressing and make cellSet part consistent with addressing.
Definition: cellZoneSet.C:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:75
virtual bool write(const bool write=true) const
Write using setting from DB.
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:65
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59