1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "setToPoint.H"
31 #include "addToRunTimeSelectionTable.H"
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(setToPoint, 0);
40 addToRunTimeSelectionTable(topoSetSource, setToPoint, word);
42 addToRunTimeSelectionTable(topoSetSource, setToPoint, istream);
47 Foam::topoSetSource::addToUsageTable Foam::setToPoint::usage_
50 "\n Usage: setToPoint set\n\n"
51 " Select all points in the pointSet\n\n"
55 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
57 void Foam::setToPoint::combine(topoSet& set, const bool add) const
65 const labelList pointLabels = cs.toc();
67 if (pointLabels.size() > 0)
69 forAll (pointLabels, i)
71 // Only do active points
72 if (pointLabels[i] < mesh_.nPoints())
74 addOrDelete(set, pointLabels[i], add);
80 WarningIn("setToPoint::combine(topoSet&, const bool)")
81 << "Point set named " << setName_ << " is empty" << endl;
86 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
88 // Construct from components
89 Foam::setToPoint::setToPoint
100 // Construct from dictionary
101 Foam::setToPoint::setToPoint
103 const polyMesh& mesh,
104 const dictionary& dict
108 setName_(dict.lookup("name"))
112 // Construct from Istream
113 Foam::setToPoint::setToPoint
115 const polyMesh& mesh,
120 setName_(checkIs(is))
124 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
126 Foam::setToPoint::~setToPoint()
130 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
132 void Foam::setToPoint::applyToSet
134 const topoSetSource::setAction action,
138 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
140 Info<< " Adding all points of pointSet " << setName_ << " ..."
145 else if (action == topoSetSource::DELETE)
147 Info<< " Removing all points of pointSet " << setName_ << " ..."
155 // ************************************************************************* //