Loading...
Searching...
No Matches
faceBitSet.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-------------------------------------------------------------------------------
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
26\*---------------------------------------------------------------------------*/
27
28#include "faceBitSet.H"
29#include "polyMesh.H"
30#include "mapPolyMesh.H"
31#include "syncTools.H"
33
34// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35
36namespace Foam
41
42// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44Foam::faceBitSet::faceBitSet(const polyMesh& mesh, const bool val)
45:
46 topoBitSet(mesh, "faceBitSet", mesh.nFaces(), val)
47{}
48
49
51(
52 const polyMesh& mesh,
53 const bitSet& bits
54)
55:
56 topoBitSet(mesh, "faceBitSet", mesh.nFaces(), bits)
57{}
58
59
61(
62 const polyMesh& mesh,
63 bitSet&& bits
64)
66 topoBitSet(mesh, "faceBitSet", mesh.nFaces(), std::move(bits))
67{}
68
69
70// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75}
76
78Foam::label Foam::faceBitSet::maxSize(const polyMesh& mesh) const
79{
80 return mesh.nFaces();
81}
82
84void Foam::faceBitSet::updateMesh(const mapPolyMesh& morphMap)
85{
86 updateLabels(morphMap.reverseFaceMap());
87}
88
89
91{
92 bitSet& labels = selected_;
93
94 boolList contents(labels.values());
95
96 map.distributeFaceData(contents);
97
98 // The new length is contents.size();
99 labels.assign(contents);
100}
101
102
104(
105 Ostream& os,
106 const primitiveMesh& mesh,
107 const label maxLen
108) const
109{
110 topoSet::writeDebug(os, mesh.faceCentres(), maxLen);
111}
112
113
114// ************************************************************************* //
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
void assign(const UList< bool > &bools)
Copy assign all entries from a list of bools.
Definition bitSet.C:271
List< bool > values() const
Return the bitset values as a boolList.
Definition bitSet.C:515
A special purpose topoSet with the face labels stored as a bitSet. It does not correspond to a faceSe...
Definition faceBitSet.H:50
virtual void distribute(const mapDistributePolyMesh &map)
Update any stored data for mesh redistribution.
Definition faceBitSet.C:83
virtual void writeDebug(Ostream &os, const primitiveMesh &mesh, const label maxLen) const
Write maxLen items with label and coordinates.
Definition faceBitSet.C:97
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
Definition faceBitSet.C:71
virtual void sync(const polyMesh &mesh)
Sync faceBitSet across coupled patches.
Definition faceBitSet.C:65
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
Definition faceBitSet.C:77
faceBitSet(const polyMesh &mesh, const bool val=false)
Construct with nFaces elements, all elements unset or initial value.
Definition faceBitSet.C:37
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
void distributeFaceData(List< T > &values) const
Distribute list of face data.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reverseFaceMap() const noexcept
Reverse face map.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Cell-face mesh analysis engine.
static void syncFaceList(const polyMesh &mesh, UList< T > &faceValues, const CombineOp &cop, const bool parRun=UPstream::parRun())
Synchronize values on all mesh faces.
Definition syncTools.H:465
topoBitSet(const polyMesh &mesh, const word &setName)
Construct (no-read) with empty selection.
Definition topoBitSet.C:106
virtual void updateLabels(const labelUList &map)
Update map from map.
Definition topoBitSet.C:29
label writeDebug(Ostream &os, const label maxElem, labelHashSet::const_iterator &iter) const
Write part of contents nicely formatted.
Definition topoSet.C:260
#define defineTypeName(Type)
Define the typeName.
Definition className.H:113
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
List< bool > boolList
A List of bools.
Definition List.H:60