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-2020 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  pointZone.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef pointZoneSet_H
40 #define 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 valid
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 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::pointZoneSet::~pointZoneSet
virtual ~pointZoneSet()=default
Destructor.
Foam::pointZoneSet
Like pointSet but -reads data from pointZone -updates pointZone when writing.
Definition: pointZoneSet.H:52
Foam::pointZoneSet::updateMesh
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Definition: pointZoneSet.C:273
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::pointZoneSet::maxSize
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
Definition: pointZoneSet.C:224
Foam::pointZoneSet::invert
virtual void invert(const label maxLen)
Invert contents.
Definition: pointZoneSet.C:127
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::IOobject::writeOption
writeOption
Enumeration defining the write options.
Definition: IOobject.H:192
Foam::pointZoneSet::addressing
labelList & addressing()
Definition: pointZoneSet.H:110
Foam::pointZoneSet::sync
virtual void sync(const polyMesh &mesh)
Sync pointZoneSet across coupled patches.
Definition: pointZoneSet.C:214
Foam::topoSet::set
virtual bool set(const label id)
Set an index.
Definition: topoSet.C:514
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::pointZoneSet::writeDebug
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
Definition: pointZoneSet.C:297
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::pointZoneSet::writeObject
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write pointZone using stream options.
Definition: pointZoneSet.C:231
Foam::pointZoneSet::addSet
virtual void addSet(const topoSet &set)
Add elements present in set.
Definition: pointZoneSet.C:175
Foam::pointZoneSet::subset
virtual void subset(const topoSet &set)
Subset contents. Only elements present in both sets remain.
Definition: pointZoneSet.C:156
Foam::IOobject::name
const word & name() const noexcept
Return name.
Definition: IOobjectI.H:65
Foam::pointSet
A set of point labels.
Definition: pointSet.H:51
Foam::pointZoneSet::TypeName
TypeName("pointZoneSet")
Runtime type information.
Foam::List< label >
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::IOobject::readOption
readOption
Enumeration defining the read options.
Definition: IOobject.H:183
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::pointZoneSet::subtractSet
virtual void subtractSet(const topoSet &set)
Subtract elements present in set.
Definition: pointZoneSet.C:194
Foam::pointZoneSet::pointZoneSet
pointZoneSet(const polyMesh &mesh, const word &name, readOption r=MUST_READ, writeOption w=NO_WRITE)
Construct from objectRegistry and name.
Definition: pointZoneSet.C:62
Foam::pointZoneSet::addressing
const labelList & addressing() const
Definition: pointZoneSet.H:105
Foam::pointZoneSet::updateSet
void updateSet()
Sort addressing and make pointSet part consistent with addressing.
Definition: pointZoneSet.C:48
Foam::IOobject::MUST_READ
Definition: IOobject.H:185
pointSet.H
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78