1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
27 #include "addToRunTimeSelectionTable.H"
28 #include "cellZoneMesh.H"
30 #include "primitiveMesh.H"
32 #include "demandDrivenData.H"
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(cellZone, 0);
39 defineRunTimeSelectionTable(cellZone, dictionary);
40 addToRunTimeSelectionTable(cellZone, cellZone, dictionary);
43 const char * const Foam::cellZone::labelsName = "cellLabels";
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 Foam::cellZone::cellZone
50 const labelUList& addr,
52 const cellZoneMesh& zm
55 zone(name, addr, index),
60 Foam::cellZone::cellZone
63 const Xfer<labelList>& addr,
65 const cellZoneMesh& zm
68 zone(name, addr, index),
73 Foam::cellZone::cellZone
76 const dictionary& dict,
78 const cellZoneMesh& zm
81 zone(name, dict, this->labelsName, index),
86 Foam::cellZone::cellZone
89 const labelUList& addr,
91 const cellZoneMesh& zm
94 zone(cz, addr, index),
98 Foam::cellZone::cellZone
101 const Xfer<labelList>& addr,
103 const cellZoneMesh& zm
106 zone(cz, addr, index),
111 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
113 Foam::cellZone::~cellZone()
117 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119 Foam::label Foam::cellZone::whichCell(const label globalCellID) const
121 return zone::localID(globalCellID);
125 const Foam::cellZoneMesh& Foam::cellZone::zoneMesh() const
131 bool Foam::cellZone::checkDefinition(const bool report) const
133 return zone::checkDefinition(zoneMesh_.mesh().nCells(), report);
137 void Foam::cellZone::writeDict(Ostream& os) const
139 os << nl << name() << nl << token::BEGIN_BLOCK << nl
140 << " type " << type() << token::END_STATEMENT << nl;
142 writeEntry(this->labelsName, os);
144 os << token::END_BLOCK << endl;
148 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
150 void Foam::cellZone::operator=(const cellZone& zn)
153 labelList::operator=(zn);
157 void Foam::cellZone::operator=(const labelUList& addr)
160 labelList::operator=(addr);
164 void Foam::cellZone::operator=(const Xfer<labelList>& addr)
167 labelList::operator=(addr);
171 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
173 Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& zn)
176 os.check("Ostream& operator<<(Ostream&, const cellZone&");
181 // ************************************************************************* //