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-2022 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 
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 empty with initial size for labelHashSet
83  (
84  const polyMesh& mesh,
85  const word& name,
86  const label size,
88  );
89 
90  //- Copy construct from existing set
92  (
93  const polyMesh& mesh,
94  const word& name,
95  const topoSet& set,
97  );
98 
99 
100  //- Destructor
101  virtual ~pointZoneSet() = default;
102 
103 
104  // Member functions
105 
106  const labelList& addressing() const
107  {
108  return addressing_;
109  }
110 
112  {
113  return addressing_;
114  }
115 
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 topoSet& set);
125 
126  //- Add elements present in set.
127  virtual void addSet(const topoSet& set);
128 
129  //- Subtract elements present in set.
130  virtual void subtractSet(const topoSet& set);
131 
132  //- Sync pointZoneSet across coupled patches.
133  virtual void sync(const polyMesh& mesh);
134 
135  //- Write maxLen items with label and coordinates.
136  virtual void writeDebug
137  (
138  Ostream& os,
139  const primitiveMesh&,
140  const label maxLen
141  ) const;
142 
143  //- Write pointZone using stream options
144  virtual bool writeObject
145  (
146  IOstreamOption streamOpt,
147  const bool writeOnProc
148  ) const;
149 
150  //- Update any stored data for new labels
151  virtual void updateMesh(const mapPolyMesh& morphMap);
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 // ************************************************************************* //
writeOption
Enumeration defining write preferences.
virtual void subset(const topoSet &set)
Subset contents. Only elements present in both sets remain.
Definition: pointZoneSet.C:148
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
TypeName("pointZoneSet")
Runtime type information.
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:41
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
Definition: pointZoneSet.C:284
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:157
label size() const noexcept
The number of elements in table.
Definition: HashTable.H:342
virtual void addSet(const topoSet &set)
Add elements present in set.
Definition: pointZoneSet.C:167
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:216
virtual void subtractSet(const topoSet &set)
Subtract elements present in set.
Definition: pointZoneSet.C:186
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
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:223
const labelList & addressing() const
Definition: pointZoneSet.H:111
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Definition: pointZoneSet.C:260
virtual void invert(const label maxLen)
Invert contents.
Definition: pointZoneSet.C:119
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual void sync(const polyMesh &mesh)
Sync pointZoneSet across coupled patches.
Definition: pointZoneSet.C:206
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:55
readOption
Enumeration defining read preferences.