1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "setToCell.H"
30 #include "addToRunTimeSelectionTable.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(setToCell, 0);
39 addToRunTimeSelectionTable(topoSetSource, setToCell, word);
41 addToRunTimeSelectionTable(topoSetSource, setToCell, istream);
46 Foam::topoSetSource::addToUsageTable Foam::setToCell::usage_
49 "\n Usage: setToCell set\n\n"
50 " Select all cells in the cellSet\n\n"
54 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
56 void Foam::setToCell::combine(topoSet& set, const bool add) const
64 const labelList cellLabels = cs.toc();
66 if (cellLabels.size() > 0)
68 forAll (cellLabels, i)
70 // Only do active cells
71 if (cellLabels[i] < mesh_.nCells())
73 addOrDelete(set, cellLabels[i], add);
79 WarningIn("setToCell::combine(topoSet&, const bool)")
80 << "Cell set named " << setName_ << " is empty" << endl;
85 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
87 // Construct from components
88 Foam::setToCell::setToCell
99 // Construct from dictionary
100 Foam::setToCell::setToCell
102 const polyMesh& mesh,
103 const dictionary& dict
107 setName_(dict.lookup("name"))
111 // Construct from Istream
112 Foam::setToCell::setToCell
114 const polyMesh& mesh,
119 setName_(checkIs(is))
123 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
125 Foam::setToCell::~setToCell()
129 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
131 void Foam::setToCell::applyToSet
133 const topoSetSource::setAction action,
137 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
139 Info<< " Adding all cells of cellSet " << setName_ << " ..."
144 else if (action == topoSetSource::DELETE)
146 Info<< " Removing all cells of cellSet " << setName_ << " ..."
154 // ************************************************************************* //