Loading...
Searching...
No Matches
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-2024 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;
88/*---------------------------------------------------------------------------*\
89 Class cellBitSet Declaration
90\*---------------------------------------------------------------------------*/
91
92class cellBitSet
93:
94 public topoBitSet
95{
96public:
97
98 //- Runtime type information
99 TypeNameNoDebug("cellBitSet");
100
101
102 // Constructors
103
104 //- Construct with nCells elements,
105 //- all elements unset or initial value
106 explicit cellBitSet(const polyMesh& mesh, const bool val = false);
107
108 //- Copy construct from bitset, resizing to nCells elements as required
109 cellBitSet(const polyMesh& mesh, const bitSet& bits);
110
111 //- Move construct from bitset, resizing to nCells elements as required
112 cellBitSet(const polyMesh& mesh, bitSet&& bits);
113
114
115 //- Destructor
116 virtual ~cellBitSet() = default;
117
118
119 // Static Functions
120
121 //- Return a cell selection according to the dictionary
122 //- specification of actions.
123 static bitSet select
124 (
125 const polyMesh& mesh,
126 const dictionary& dict,
127 const bool verbosity = false
128 );
129
130
131 // Member Functions
132
133 //- Sync cellBitSet across coupled patches.
134 virtual void sync(const polyMesh& mesh)
135 {}
136
137 //- Return max index+1.
138 virtual label maxSize(const polyMesh& mesh) const;
139
140 //- Update any stored data for new labels.
141 virtual void updateMesh(const mapPolyMesh& morphMap)
142 {}
144 //- Update any stored data for mesh redistribution.
145 virtual void distribute(const mapDistributePolyMesh& map)
146 {}
147
148 //- Write maxLen items with label and coordinates.
149 virtual void writeDebug
150 (
151 Ostream& os,
152 const primitiveMesh& mesh,
153 const label maxLen
154 ) const;
155};
156
157
158// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159
160} // End namespace Foam
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164#endif
165
166// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition bitSet.H:61
cellBitSet(const polyMesh &mesh, const bool val=false)
Construct with nCells elements, all elements unset or initial value.
Definition cellBitSet.C:36
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Definition cellBitSet.H:154
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:71
TypeNameNoDebug("cellBitSet")
Runtime type information.
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
Definition cellBitSet.C:64
static bitSet select(const polyMesh &mesh, const dictionary &dict, const bool verbosity=false)
Return a cell selection according to the dictionary specification of actions.
Definition cellBitSet.C:84
virtual void sync(const polyMesh &mesh)
Sync cellBitSet across coupled patches.
Definition cellBitSet.H:143
virtual void distribute(const mapDistributePolyMesh &map)
Update any stored data for mesh redistribution.
Definition cellBitSet.H:160
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
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.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Cell-face mesh analysis engine.
topoBitSet(const polyMesh &mesh, const word &setName)
Construct (no-read) with empty selection.
Definition topoBitSet.C:106
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dictionary dict
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition typeInfo.H:61