pointZoneSet.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2018-2024 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::pointZoneSet
29 
30 Description
31  Like pointSet but -reads data from pointZone -updates pointZone when
32  writing.
33 
34 SourceFiles
35  pointZoneSet.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Foam_pointZoneSet_H
40 #define Foam_pointZoneSet_H
41 
42 #include "pointSet.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class pointZoneSet Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class pointZoneSet
54 :
55  public pointSet
56 {
57  // Private Data
58 
59  const polyMesh& mesh_;
60 
61  labelList addressing_;
62 
63 public:
64 
65  //- Runtime type information
66  TypeNameNoDebug("pointZoneSet");
67 
68 
69  // Constructors
70 
71  //- Construct from objectRegistry and name
73  (
74  const polyMesh& mesh,
75  const word& name,
78  );
79 
80  //- Construct empty (no-read) with initial labelHashSet capacity.
82  (
83  const polyMesh& mesh,
84  const word& name,
85  const label initialCapacity,
87  );
88 
89  //- Copy construct (no-read) from existing set
91  (
92  const polyMesh& mesh,
93  const word& name,
94  const topoSet& set,
96  );
97 
98 
99  //- Destructor
100  virtual ~pointZoneSet() = default;
101 
102 
103  // Member Functions
104 
105  const labelList& addressing() const noexcept
106  {
107  return addressing_;
108  }
109 
111  {
112  return addressing_;
113  }
114 
116  //- Sort addressing and make pointSet part consistent with addressing
117  void updateSet();
118 
119  //- Invert contents.
120  // Insert all members [0,maxLen) which were not in set
121  virtual void invert(const label maxLen);
122 
123  //- Subset contents. Only elements present in both sets remain.
124  virtual void subset(const labelUList& elems);
125 
126  //- Subset contents. Only elements present in both sets remain.
127  virtual void subset(const topoSet& set);
128 
129  //- Add given elements to the set
130  virtual void addSet(const labelUList& elems);
131 
132  //- Add given elements to the set
133  virtual void addSet(const topoSet& set);
134 
135  //- Subtract given elements from the set
136  virtual void subtractSet(const labelUList& elems);
137 
138  //- Subtract given elements from the set
139  virtual void subtractSet(const topoSet& set);
140 
141 
142  //- Sync pointZoneSet across coupled patches.
143  virtual void sync(const polyMesh& mesh);
144 
145  //- Write maxLen items with label and coordinates.
146  virtual void writeDebug
147  (
148  Ostream& os,
149  const primitiveMesh&,
150  const label maxLen
151  ) const;
152 
153  //- Write pointZone using stream options
154  virtual bool writeObject
155  (
156  IOstreamOption streamOpt,
157  const bool writeOnProc
158  ) const;
159 
160  //- Update any stored data for new labels
161  virtual void updateMesh(const mapPolyMesh& morphMap);
162 
163  //- Return max index+1.
164  virtual label maxSize(const polyMesh& mesh) const;
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
writeOption
Enumeration defining write preferences.
A set of point labels.
Definition: pointSet.H:47
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:195
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:75
A simple container for options an IOstream can normally have.
Ignore writing from objectRegistry::writeObject()
void updateSet()
Sort addressing and make pointSet part consistent with addressing.
Definition: pointZoneSet.C:42
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
Definition: pointZoneSet.C:334
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
TypeNameNoDebug("pointZoneSet")
Runtime type information.
virtual void addSet(const labelUList &elems)
Add given elements to the set.
Definition: pointZoneSet.C:191
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual ~pointZoneSet()=default
Destructor.
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
Definition: pointZoneSet.C:273
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
OBJstream os(runTime.globalPath()/outputName)
const labelList & addressing() const noexcept
Definition: pointZoneSet.H:110
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:59
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write pointZone using stream options.
Definition: pointZoneSet.C:280
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Definition: pointZoneSet.C:315
virtual void subtractSet(const labelUList &elems)
Subtract given elements from the set.
Definition: pointZoneSet.C:225
virtual void invert(const label maxLen)
Invert contents.
Definition: pointZoneSet.C:128
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
virtual void subset(const labelUList &elems)
Subset contents. Only elements present in both sets remain.
Definition: pointZoneSet.C:157
virtual void sync(const polyMesh &mesh)
Sync pointZoneSet across coupled patches.
Definition: pointZoneSet.C:263
Namespace for OpenFOAM.
Like pointSet but -reads data from pointZone -updates pointZone when writing.
Definition: pointZoneSet.H:48
pointZoneSet(const polyMesh &mesh, const word &name, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, IOobjectOption::writeOption wOpt=IOobjectOption::NO_WRITE)
Construct from objectRegistry and name.
Definition: pointZoneSet.C:68
readOption
Enumeration defining read preferences.