1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 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 "zoneToPoint.H"
30 #include "addToRunTimeSelectionTable.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(zoneToPoint, 0);
39 addToRunTimeSelectionTable(topoSetSource, zoneToPoint, word);
41 addToRunTimeSelectionTable(topoSetSource, zoneToPoint, istream);
46 Foam::topoSetSource::addToUsageTable Foam::zoneToPoint::usage_
48 zoneToPoint::typeName,
49 "\n Usage: zoneToPoint zone\n\n"
50 " Select all points in the pointZone."
51 " Note:accepts wildcards for zone.\n\n"
55 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
57 void Foam::zoneToPoint::combine(topoSet& set, const bool add) const
59 bool hasMatched = false;
61 forAll(mesh_.pointZones(), i)
63 const pointZone& zone = mesh_.pointZones()[i];
65 if (zoneName_.match(zone.name()))
67 const labelList& pointLabels = mesh_.pointZones()[i];
69 Info<< " Found matching zone " << zone.name()
70 << " with " << pointLabels.size() << " points." << endl;
74 forAll(pointLabels, i)
76 // Only do active points
77 if (pointLabels[i] < mesh_.nPoints())
79 addOrDelete(set, pointLabels[i], add);
87 WarningIn("zoneToPoint::combine(topoSet&, const bool)")
88 << "Cannot find any pointZone named " << zoneName_ << endl
89 << "Valid names are " << mesh_.pointZones().names() << endl;
94 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
96 // Construct from components
97 Foam::zoneToPoint::zoneToPoint
108 // Construct from dictionary
109 Foam::zoneToPoint::zoneToPoint
111 const polyMesh& mesh,
112 const dictionary& dict
116 zoneName_(dict.lookup("name"))
120 // Construct from Istream
121 Foam::zoneToPoint::zoneToPoint
123 const polyMesh& mesh,
128 zoneName_(checkIs(is))
132 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
134 Foam::zoneToPoint::~zoneToPoint()
138 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
140 void Foam::zoneToPoint::applyToSet
142 const topoSetSource::setAction action,
146 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
148 Info<< " Adding all points of pointZone " << zoneName_ << " ..."
153 else if (action == topoSetSource::DELETE)
155 Info<< " Removing all points of pointZone " << zoneName_ << " ..."
163 // ************************************************************************* //