cellBitSet.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) 2018-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::cellBitSet
28
29Description
30 A special purpose topoSet with the cell labels stored as a bitSet.
31 It does not correspond to a cellSet either (no associated IOobject).
32
33 The cellBitSet::select method is embedded in function objects
34 such as Foam::functionObjects::ensightWrite with actions like the
35 following:
36
37 \verbatim
38 selection
39 {
40 box
41 {
42 action use;
43 source box;
44 box (-0.1 -0.01 -0.1) (0.1 0.30 0.1);
45 }
46 dome
47 {
48 action add;
49 shape sphere;
50 origin (-0.1 -0.01 -0.1);
51 radius 0.25;
52 }
53 centre
54 {
55 action subtract;
56 source sphere;
57 origin (-0.1 -0.01 -0.1);
58 radius 0.1;
59 }
60 blob
61 {
62 action add;
63 source surface;
64 surface triSurfaceMesh;
65 name blob.stl;
66 }
67 }
68 \endverbatim
69
70SourceFiles
71 cellBitSet.C
72
73\*---------------------------------------------------------------------------*/
74
75#ifndef Foam_cellBitSet_H
76#define Foam_cellBitSet_H
77
78#include "topoBitSet.H"
79
80// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81
82namespace Foam
83{
84
85// Forward Declarations
86class dictionary;
87
88/*---------------------------------------------------------------------------*\
89 Class cellBitSet Declaration
90\*---------------------------------------------------------------------------*/
92class cellBitSet
93:
94 public topoBitSet
95{
96public:
97
98 //- Runtime type information
99 TypeName("cellBitSet");
100
101
102 // Constructors
103
104 //- Construct with nCells elements, all elements unset
105 explicit cellBitSet(const polyMesh& mesh);
106
107 //- Construct with nCells elements, using initial val
108 cellBitSet(const polyMesh& mesh, const bool val);
109
110 //- Copy construct from bitset, resizing to nCells elements as required
111 cellBitSet(const polyMesh& mesh, const bitSet& bits);
112
113 //- Move construct from bitset, resizing to nCells elements as required
114 cellBitSet(const polyMesh& mesh, bitSet&& bits);
115
116
117 //- Destructor
118 virtual ~cellBitSet() = default;
119
120
121 // Static Functions
122
123 //- Return a cell selection according to the dictionary
124 //- specification of actions.
125 static bitSet select
126 (
127 const polyMesh& mesh,
128 const dictionary& dict,
129 const bool verbosity = false
130 );
131
132
133 // Member Functions
134
135 //- Sync cellBitSet across coupled patches.
136 virtual void sync(const polyMesh& mesh)
137 {}
138
139 //- Return max index+1.
140 virtual label maxSize(const polyMesh& mesh) const;
141
142 //- Update any stored data for new labels.
143 virtual void updateMesh(const mapPolyMesh& morphMap)
144 {}
145
146 //- Update any stored data for mesh redistribution.
147 virtual void distribute(const mapDistributePolyMesh& map)
148 {}
149
150 //- Write maxLen items with label and coordinates.
151 virtual void writeDebug
152 (
153 Ostream& os,
154 const primitiveMesh& mesh,
155 const label maxLen
156 ) const;
157};
158
159
160// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161
162} // End namespace Foam
163
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166#endif
167
168// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:66
A special purpose topoSet with the cell labels stored as a bitSet. It does not correspond to a cellSe...
Definition: cellBitSet.H:94
TypeName("cellBitSet")
Runtime type information.
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Definition: cellBitSet.H:142
virtual ~cellBitSet()=default
Destructor.
virtual void writeDebug(Ostream &os, const primitiveMesh &mesh, const label maxLen) const
Write maxLen items with label and coordinates.
Definition: cellBitSet.C:84
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
Definition: cellBitSet.C:77
static bitSet select(const polyMesh &mesh, const dictionary &dict, const bool verbosity=false)
Definition: cellBitSet.C:97
virtual void sync(const polyMesh &mesh)
Sync cellBitSet across coupled patches.
Definition: cellBitSet.H:135
virtual void distribute(const mapDistributePolyMesh &map)
Update any stored data for mesh redistribution.
Definition: cellBitSet.H:146
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:79
Base for a special purpose topoSet using labels stored as a bitSet.
Definition: topoBitSet.H:54
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73