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 "boxToFace.H"
29 #include "addToRunTimeSelectionTable.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(boxToFace, 0);
38 addToRunTimeSelectionTable(topoSetSource, boxToFace, word);
40 addToRunTimeSelectionTable(topoSetSource, boxToFace, istream);
45 Foam::topoSetSource::addToUsageTable Foam::boxToFace::usage_
48 "\n Usage: boxToFace ((minx miny minz) (maxx maxy maxz))\n\n"
49 " Select all face with faceCentre within bounding box\n\n"
53 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
55 void Foam::boxToFace::combine(topoSet& set, const bool add) const
57 const pointField& ctrs = mesh_.faceCentres();
61 if (bb_.contains(ctrs[faceI]))
63 addOrDelete(set, faceI, add);
69 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
71 // Construct from components
72 Foam::boxToFace::boxToFace
75 const treeBoundBox& bb
83 // Construct from dictionary
84 Foam::boxToFace::boxToFace
87 const dictionary& dict
91 bb_(dict.lookup("box"))
95 // Construct from Istream
96 Foam::boxToFace::boxToFace
107 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
109 Foam::boxToFace::~boxToFace()
113 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
115 void Foam::boxToFace::applyToSet
117 const topoSetSource::setAction action,
121 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
123 Info<< " Adding faces with centre within box " << bb_ << endl;
127 else if (action == topoSetSource::DELETE)
129 Info<< " Removing faces with centre within box " << bb_ << endl;
136 // ************************************************************************* //