cellSet.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "cellSet.H"
27 #include "polyMesh.H"
28 #include "polyTopoChangeMap.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
36 
40 }
41 
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
46 :
47  topoSet(obj, typeName)
48 {}
49 
50 
52 (
53  const polyMesh& mesh,
54  const word& name,
55  readOption r,
56  writeOption w
57 )
58 :
59  topoSet(mesh, typeName, name, r, w)
60 {
61  // Make sure set within valid range
62  check(mesh.nCells());
63 }
64 
65 
67 (
68  const polyMesh& mesh,
69  const word& name,
70  const label size,
71  writeOption w
72 )
73 :
74  topoSet(mesh, name, size, w)
75 {}
76 
77 
79 (
80  const polyMesh& mesh,
81  const word& name,
82  const topoSet& set,
83  writeOption w
84 )
85 :
86  topoSet(mesh, name, set, w)
87 {}
88 
89 
91 (
92  const polyMesh& mesh,
93  const word& name,
94  const labelHashSet& set,
95  writeOption w
96 )
97 :
98  topoSet(mesh, name, set, w)
99 {}
100 
101 
102 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
103 
105 {}
106 
107 
108 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109 
111 {
112  return mesh.nCells();
113 }
114 
115 
117 {
118  updateLabels(map.reverseCellMap());
119 }
120 
121 
123 (
124  Ostream& os,
125  const primitiveMesh& mesh,
126  const label maxLen
127 ) const
128 {
129  topoSet::writeDebug(os, mesh.cellCentres(), maxLen);
130 }
131 
132 
133 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
readOption
Enumeration defining the read options.
Definition: IOobject.H:117
writeOption
Enumeration defining the write options.
Definition: IOobject.H:126
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A collection of cell labels.
Definition: cellSet.H:51
cellSet(const IOobject &obj)
Construct from IOobject. No checking.
Definition: cellSet.C:45
virtual ~cellSet()
Destructor.
Definition: cellSet.C:104
virtual label maxSize(const polyMesh &mesh) const
Return max index+1.
Definition: cellSet.C:110
virtual void writeDebug(Ostream &os, const primitiveMesh &, const label maxLen) const
Write maxLen items with label and coordinates.
Definition: cellSet.C:123
virtual void topoChange(const polyTopoChangeMap &map)
Update any stored data for new labels.
Definition: cellSet.C:116
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reverseCellMap() const
Reverse cell map.
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:75
const vectorField & cellCentres() const
label nCells() const
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:61
void check(const label maxLabel)
Check validity of contents.
Definition: topoSet.C:180
A class for handling words, derived from string.
Definition: word.H:62
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
defineTypeNameAndDebug(combustionModel, 0)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.