faceZoneSet.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::faceZoneSet
29 
30 Description
31  Like faceSet but -reads data from faceZone -updates faceZone when writing.
32 
33 SourceFiles
34  faceZone.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef faceZoneSet_H
39 #define faceZoneSet_H
40 
41 #include "faceSet.H"
42 #include "boolList.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class faceZoneSet Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class faceZoneSet
54 :
55  public faceSet
56 {
57  // Private Data
58 
59  const polyMesh& mesh_;
60 
61  labelList addressing_;
62 
63  boolList flipMap_;
64 
65 
66 public:
67 
68  //- Runtime type information
69  TypeName("faceZoneSet");
70 
71 
72  // Constructors
73 
74  //- Construct from objectRegistry and name
76  (
77  const polyMesh& mesh,
78  const word& name,
81  );
82 
83  //- Construct with initial size for labelHashSet
85  (
86  const polyMesh& mesh,
87  const word& name,
88  const label size,
90  );
91 
92  //- Copy construct from existing set
94  (
95  const polyMesh& mesh,
96  const word& name,
97  const topoSet& set,
99  );
100 
101 
102  //- Destructor
103  virtual ~faceZoneSet() = default;
104 
105 
106  // Member functions
107 
108  const labelList& addressing() const
109  {
110  return addressing_;
111  }
112 
114  {
115  return addressing_;
116  }
117 
118 
119  const boolList& flipMap() const
120  {
121  return flipMap_;
122  }
123 
124  boolList& flipMap()
125  {
126  return flipMap_;
127  }
128 
129 
130  //- Sort addressing and make faceSet part consistent with addressing
131  void updateSet();
132 
133  //- Invert contents.
134  // Insert all members [0,maxLen) which were not in set.
135  virtual void invert(const label maxLen);
136 
137  //- Subset contents. Only elements present in both sets remain.
138  virtual void subset(const topoSet& set);
139 
140  //- Add elements present in set.
141  virtual void addSet(const topoSet& set);
142 
143  //- Subtract elements present in set.
144  virtual void subtractSet(const topoSet& set);
145 
146  //- Sync faceZoneSet across coupled patches.
147  virtual void sync(const polyMesh& mesh);
148 
149  //- Write maxLen items with label and coordinates.
150  virtual void writeDebug
151  (
152  Ostream& os,
153  const primitiveMesh&,
154  const label maxLen
155  ) const;
156 
157  //- Write faceZone using stream options
158  virtual bool writeObject
159  (
160  IOstreamOption streamOpt,
161  const bool valid
162  ) const;
163 
164  //- Update any stored data for new labels
165  virtual void updateMesh(const mapPolyMesh& morphMap);
166 
167  //- Return max index+1.
168  virtual label maxSize(const polyMesh& mesh) const;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::HashTable< zero::null, label, Hash< label > >::size
label size() const noexcept
The number of elements in table.
Definition: HashTableI.H:52
Foam::faceZoneSet::addressing
const labelList & addressing() const
Definition: faceZoneSet.H:107
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobjectI.H:70
boolList.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::faceZoneSet::updateSet
void updateSet()
Sort addressing and make faceSet part consistent with addressing.
Definition: faceZoneSet.C:51
Foam::faceZoneSet::maxSize
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
Definition: faceZoneSet.C:440
Foam::faceZoneSet::updateMesh
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Definition: faceZoneSet.C:490
Foam::faceSet
A list of face labels.
Definition: faceSet.H:51
Foam::faceZoneSet::flipMap
const boolList & flipMap() const
Definition: faceZoneSet.H:118
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::faceZoneSet::addressing
labelList & addressing()
Definition: faceZoneSet.H:112
Foam::IOobject::writeOption
writeOption
Enumeration defining the write options.
Definition: IOobject.H:127
Foam::faceZoneSet::invert
virtual void invert(const label maxLen)
Invert contents.
Definition: faceZoneSet.C:135
Foam::topoSet::set
virtual bool set(const label id)
Set an index.
Definition: topoSet.C:520
faceSet.H
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::faceZoneSet
Like faceSet but -reads data from faceZone -updates faceZone when writing.
Definition: faceZoneSet.H:52
Foam::faceZoneSet::writeDebug
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
Definition: faceZoneSet.C:519
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
Foam::faceZoneSet::faceZoneSet
faceZoneSet(const polyMesh &mesh, const word &name, readOption r=MUST_READ, writeOption w=NO_WRITE)
Construct from objectRegistry and name.
Definition: faceZoneSet.C:66
Foam::faceZoneSet::subtractSet
virtual void subtractSet(const topoSet &set)
Subtract elements present in set.
Definition: faceZoneSet.C:265
Foam::faceZoneSet::sync
virtual void sync(const polyMesh &mesh)
Sync faceZoneSet across coupled patches.
Definition: faceZoneSet.C:317
Foam::faceZoneSet::TypeName
TypeName("faceZoneSet")
Runtime type information.
Foam::faceZoneSet::writeObject
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write faceZone using stream options.
Definition: faceZoneSet.C:447
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::faceZoneSet::~faceZoneSet
virtual ~faceZoneSet()=default
Destructor.
Foam::faceZoneSet::addSet
virtual void addSet(const topoSet &set)
Add elements present in set.
Definition: faceZoneSet.C:214
Foam::faceZoneSet::subset
virtual void subset(const topoSet &set)
Subset contents. Only elements present in both sets remain.
Definition: faceZoneSet.C:166
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:118
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::faceZoneSet::flipMap
boolList & flipMap()
Definition: faceZoneSet.H:123
Foam::IOobject::MUST_READ
Definition: IOobject.H:120
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78