1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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 \*---------------------------------------------------------------------------*/
26 #include "pointToCell.H"
30 #include "addToRunTimeSelectionTable.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(pointToCell, 0);
39 addToRunTimeSelectionTable(topoSetSource, pointToCell, word);
41 addToRunTimeSelectionTable(topoSetSource, pointToCell, istream);
46 Foam::topoSetSource::addToUsageTable Foam::pointToCell::usage_
48 pointToCell::typeName,
49 "\n Usage: pointToCell <pointSet> any\n\n"
50 " Select all cells with any point in the pointSet\n\n"
54 const char* Foam::NamedEnum<Foam::pointToCell::pointAction, 1>::names[] =
60 const Foam::NamedEnum<Foam::pointToCell::pointAction, 1>
61 Foam::pointToCell::pointActionNames_;
64 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
66 void Foam::pointToCell::combine(topoSet& set, const bool add) const
69 pointSet loadedSet(mesh_, setName_);
72 // Handle any selection
77 pointSet::const_iterator iter = loadedSet.begin();
78 iter != loadedSet.end();
82 label pointI = iter.key();
84 const labelList& pCells = mesh_.pointCells()[pointI];
86 forAll(pCells, pCellI)
88 addOrDelete(set, pCells[pCellI], add);
95 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
97 // Construct from components
98 Foam::pointToCell::pointToCell
100 const polyMesh& mesh,
102 const pointAction option
111 // Construct from dictionary
112 Foam::pointToCell::pointToCell
114 const polyMesh& mesh,
115 const dictionary& dict
119 setName_(dict.lookup("set")),
120 option_(pointActionNames_.read(dict.lookup("option")))
124 // Construct from Istream
125 Foam::pointToCell::pointToCell
127 const polyMesh& mesh,
132 setName_(checkIs(is)),
133 option_(pointActionNames_.read(checkIs(is)))
137 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
139 Foam::pointToCell::~pointToCell()
143 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
145 void Foam::pointToCell::applyToSet
147 const topoSetSource::setAction action,
151 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
153 Info<< " Adding cells according to pointSet " << setName_
158 else if (action == topoSetSource::DELETE)
160 Info<< " Removing cells according to pointSet " << setName_
168 // ************************************************************************* //