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