1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-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 "boxToCell.H"
29 #include "addToRunTimeSelectionTable.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(boxToCell, 0);
38 addToRunTimeSelectionTable(topoSetSource, boxToCell, word);
40 addToRunTimeSelectionTable(topoSetSource, boxToCell, istream);
45 Foam::topoSetSource::addToUsageTable Foam::boxToCell::usage_
48 "\n Usage: boxToCell (minx miny minz) (maxx maxy maxz)\n\n"
49 " Select all cells with cellCentre within bounding box\n\n"
53 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
55 void Foam::boxToCell::combine(topoSet& set, const bool add) const
57 const pointField& ctrs = mesh_.cellCentres();
61 if (bb_.contains(ctrs[cellI]))
63 addOrDelete(set, cellI, add);
69 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
71 // Construct from components
72 Foam::boxToCell::boxToCell
75 const treeBoundBox& bb
83 // Construct from dictionary
84 Foam::boxToCell::boxToCell
87 const dictionary& dict
91 bb_(dict.lookup("box"))
95 // Construct from Istream
96 Foam::boxToCell::boxToCell
106 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
108 Foam::boxToCell::~boxToCell()
112 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 void Foam::boxToCell::applyToSet
116 const topoSetSource::setAction action,
120 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
122 Info<< " Adding cells with center within box " << bb_ << endl;
126 else if (action == topoSetSource::DELETE)
128 Info<< " Removing cells with center within box " << bb_ << endl;
135 // ************************************************************************* //