cellZoneSet.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::cellZoneSet
29 
30 Description
31  Like cellSet but -reads data from cellZone -updates cellZone when writing.
32 
33 SourceFiles
34  cellZone.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef cellZoneSet_H
39 #define cellZoneSet_H
40 
41 #include "cellSet.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class cellZoneSet Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class cellZoneSet
53 :
54  public cellSet
55 {
56  // Private Data
57 
58  const polyMesh& mesh_;
59 
60  labelList addressing_;
61 
62 public:
63 
64  //- Runtime type information
65  TypeName("cellZoneSet");
66 
67 
68  // Constructors
69 
70  //- Construct from objectRegistry and name
72  (
73  const polyMesh& mesh,
74  const word& name,
77  );
78 
79  //- Construct from initial size for labelHashSet
81  (
82  const polyMesh& mesh,
83  const word& name,
84  const label size,
86  );
87 
88  //- Copy construct from existing set
90  (
91  const polyMesh& mesh,
92  const word& name,
93  const topoSet& set,
95  );
96 
97 
98 
99  //- Destructor
100  virtual ~cellZoneSet() = default;
101 
102 
103  // Member functions
104 
105  const labelList& addressing() const
106  {
107  return addressing_;
108  }
109 
111  {
112  return addressing_;
113  }
114 
115  //- Sort addressing and make cellSet part consistent with addressing
116  void updateSet();
117 
118  //- Invert contents.
119  // Insert all members [0,maxLen) which were not in set
120  virtual void invert(const label maxLen);
121 
122  //- Subset contents. Only elements present in both sets remain.
123  virtual void subset(const topoSet& set);
124 
125  //- Add elements present in set.
126  virtual void addSet(const topoSet& set);
127 
128  //- Subtract elements present in set.
129  virtual void subtractSet(const topoSet& set);
130 
131  //- Sync cellSet across coupled patches; update cellZone from cellSet
132  virtual void sync(const polyMesh& mesh);
133 
134  //- Write maxLen items with label and coordinates.
135  virtual void writeDebug
136  (
137  Ostream& os,
138  const primitiveMesh&,
139  const label maxLen
140  ) const;
141 
142  //- Write cellZone using stream options
143  virtual bool writeObject
144  (
145  IOstreamOption streamOpt,
146  const bool valid
147  ) const;
148 
149  //- Update any stored data for new labels
150  virtual void updateMesh(const mapPolyMesh& morphMap);
151 
152  //- Return max index+1.
153  virtual label maxSize(const polyMesh& mesh) const;
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::cellZoneSet::maxSize
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
Definition: cellZoneSet.C:224
Foam::cellZoneSet::subtractSet
virtual void subtractSet(const topoSet &set)
Subtract elements present in set.
Definition: cellZoneSet.C:194
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::cellZoneSet::addressing
labelList & addressing()
Definition: cellZoneSet.H:109
Foam::cellZoneSet::updateSet
void updateSet()
Sort addressing and make cellSet part consistent with addressing.
Definition: cellZoneSet.C:47
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::cellZoneSet::~cellZoneSet
virtual ~cellZoneSet()=default
Destructor.
Foam::cellZoneSet::writeDebug
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
Definition: cellZoneSet.C:297
Foam::cellZoneSet::addSet
virtual void addSet(const topoSet &set)
Add elements present in set.
Definition: cellZoneSet.C:175
Foam::IOobject::writeOption
writeOption
Enumeration defining the write options.
Definition: IOobject.H:192
Foam::cellZoneSet::subset
virtual void subset(const topoSet &set)
Subset contents. Only elements present in both sets remain.
Definition: cellZoneSet.C:156
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::cellZoneSet::invert
virtual void invert(const label maxLen)
Invert contents.
Definition: cellZoneSet.C:126
Foam::cellZoneSet::addressing
const labelList & addressing() const
Definition: cellZoneSet.H:104
Foam::cellZoneSet
Like cellSet but -reads data from cellZone -updates cellZone when writing.
Definition: cellZoneSet.H:51
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
Foam::cellZoneSet::sync
virtual void sync(const polyMesh &mesh)
Sync cellSet across coupled patches; update cellZone from cellSet.
Definition: cellZoneSet.C:214
Foam::cellZoneSet::writeObject
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write cellZone using stream options.
Definition: cellZoneSet.C:231
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cellSet
A collection of cell labels.
Definition: cellSet.H:51
Foam::cellZoneSet::cellZoneSet
cellZoneSet(const polyMesh &mesh, const word &name, readOption r=MUST_READ, writeOption w=NO_WRITE)
Construct from objectRegistry and name.
Definition: cellZoneSet.C:61
Foam::IOobject::name
const word & name() const noexcept
Return name.
Definition: IOobjectI.H:65
Foam::cellZoneSet::TypeName
TypeName("cellZoneSet")
Runtime type information.
Foam::cellZoneSet::updateMesh
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Definition: cellZoneSet.C:273
Foam::List< label >
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
cellSet.H
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::IOobject::MUST_READ
Definition: IOobject.H:185
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78