cellZone.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-2024 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 "cellZone.H"
27 #include "cellZoneList.H"
28 #include "polyMesh.H"
29 #include "polyTopoChangeMap.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
38 
41 }
42 
43 const char * const Foam::cellZone::labelsName = "cellLabels";
44 
45 
46 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
47 
49 {
50  return zones_.mesh().cellCentres();
51 }
52 
53 
54 bool Foam::cellZone::checkDefinition(const bool report) const
55 {
57  (
58  meshCentres().size(),
59  report
60  );
61 }
62 
63 
65 {
67 }
68 
69 
71 {
72  os << nl << name() << nl << token::BEGIN_BLOCK << nl
73  << " type " << type() << token::END_STATEMENT << nl;
74 
75  writeEntry(os, this->labelsName, *this);
76 
77  os << token::END_BLOCK << endl;
78 }
79 
80 
81 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Foam::cellZoneList.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
const MeshType & mesh() const
Return the mesh reference.
Definition: ZoneList.H:109
void topoChange(const labelList &map, const labelList &reverseMap)
Update the addressing using the maps provided.
Definition: Zone.C:79
bool checkDefinition(const label maxSize, const bool report=false) const
Check zone definition with max size given. Return true if in error.
Definition: Zone.C:280
const cellZoneList & zones_
Reference to zone list.
Definition: Zone.H:77
A subset of mesh cells.
Definition: cellZone.H:58
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
Definition: cellZone.C:54
const pointField & meshCentres() const
Return the mesh cell centres.
Definition: cellZone.C:48
static const char *const labelsName
The name associated with the zone-labels dictionary entry.
Definition: cellZone.H:67
virtual void writeDict(Ostream &) const
Write dictionary.
Definition: cellZone.C:70
virtual void topoChange(const polyTopoChangeMap &map)
Update zone using the given map.
Definition: cellZone.C:64
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & cellMap() const
Old cell map.
const labelList & reverseCellMap() const
Reverse cell map.
const vectorField & cellCentres() const
@ BEGIN_BLOCK
Definition: token.H:113
@ END_BLOCK
Definition: token.H:114
@ END_STATEMENT
Definition: token.H:108
Namespace for OpenFOAM.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
defineTypeNameAndDebug(combustionModel, 0)
Zone< cellZone, cellZoneList > cellZoneType
Definition: cellZone.C:36
defineTemplateRunTimeSelectionTable(fvLabelFieldSource, null)
static const char nl
Definition: Ostream.H:266
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488