pointBitSet.C
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 -------------------------------------------------------------------------------
10 License
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 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "pointBitSet.H"
29 #include "polyMesh.H"
30 #include "mapPolyMesh.H"
31 #include "syncTools.H"
32 #include "mapDistributePolyMesh.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 :
46  topoBitSet(mesh, "pointBitSet", mesh.nPoints(), val)
47 {}
48 
49 
51 (
52  const polyMesh& mesh,
53  const bitSet& bits
54 )
55 :
56  topoBitSet(mesh, "pointBitSet", mesh.nPoints(), bits)
57 {}
58 
59 
61 (
62  const polyMesh& mesh,
63  bitSet&& bits
64 )
65 :
66  topoBitSet(mesh, "pointBitSet", mesh.nPoints(), std::move(bits))
67 {}
68 
69 
70 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71 
73 {
74  // The nullValue = '0u'
76 }
77 
78 
79 Foam::label Foam::pointBitSet::maxSize(const polyMesh& mesh) const
80 {
81  return mesh.nPoints();
82 }
83 
84 
85 void Foam::pointBitSet::updateMesh(const mapPolyMesh& morphMap)
86 {
87  updateLabels(morphMap.reversePointMap());
88 }
89 
90 
92 {
93  bitSet& labels = selected_;
94 
95  boolList contents(labels.values());
96 
97  map.distributePointData(contents);
98 
99  // The new length is contents.size();
100  labels.assign(contents);
101 }
102 
103 
105 (
106  Ostream& os,
107  const primitiveMesh& mesh,
108  const label maxLen
109 ) const
110 {
111  topoSet::writeDebug(os, mesh.points(), maxLen);
112 }
113 
114 
115 // ************************************************************************* //
label nPoints() const noexcept
Number of mesh points.
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:75
List< bool > values() const
Return the bitset values as a boolList.
Definition: bitSet.C:506
Base for a special purpose topoSet using labels stored as a bitSet.
Definition: topoBitSet.H:47
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Definition: pointBitSet.C:78
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
A special purpose topoSet with the point labels stored as a bitSet. It does not correspond to a point...
Definition: pointBitSet.H:47
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1078
defineTypeName(manifoldCellsMeshObject)
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
Definition: pointBitSet.C:72
virtual void sync(const polyMesh &mesh)
Sync pointBitSet across coupled patches.
Definition: pointBitSet.C:65
dynamicFvMesh & mesh
label nPoints
pointBitSet(const polyMesh &mesh, const bool val)
Construct with nPoints elements, all elements unset or initial value.
Definition: pointBitSet.C:37
virtual void writeDebug(Ostream &os, const primitiveMesh &mesh, const label maxLen) const
Write maxLen items with label and coordinates.
Definition: pointBitSet.C:98
const labelList & reversePointMap() const noexcept
Reverse point map.
Definition: mapPolyMesh.H:582
static void syncPointList(const polyMesh &mesh, List< T > &pointValues, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
label writeDebug(Ostream &os, const label maxElem, labelHashSet::const_iterator &iter) const
Write part of contents nicely formatted.
Definition: topoSet.C:260
OBJstream os(runTime.globalPath()/outputName)
void distributePointData(List< T > &values) const
Distribute list of point data.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:59
void assign(const UList< bool > &bools)
Copy assign all entries from a list of bools.
Definition: bitSet.C:267
virtual void distribute(const mapDistributePolyMesh &map)
Update any stored data for mesh redistribution.
Definition: pointBitSet.C:84
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
Namespace for OpenFOAM.