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