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