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 "patchToFace.H"
30 #include "addToRunTimeSelectionTable.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(patchToFace, 0);
39 addToRunTimeSelectionTable(topoSetSource, patchToFace, word);
41 addToRunTimeSelectionTable(topoSetSource, patchToFace, istream);
46 Foam::topoSetSource::addToUsageTable Foam::patchToFace::usage_
48 patchToFace::typeName,
49 "\n Usage: patchToFace patch\n\n"
50 " Select all faces in the patch. Note:accepts wildcards for patch.\n\n"
54 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
56 void Foam::patchToFace::combine(topoSet& set, const bool add) const
58 bool hasMatched = false;
60 forAll(mesh_.boundaryMesh(), patchI)
62 const polyPatch& pp = mesh_.boundaryMesh()[patchI];
64 if (patchName_.match(pp.name()))
66 Info<< " Found matching patch " << pp.name()
67 << " with " << pp.size() << " faces." << endl;
74 label faceI = pp.start();
75 faceI < pp.start() + pp.size();
79 addOrDelete(set, faceI, add);
86 WarningIn("patchToFace::combine(topoSet&, const bool)")
87 << "Cannot find any patch named " << patchName_ << endl
88 << "Valid names are " << mesh_.boundaryMesh().names() << endl;
93 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
95 // Construct from components
96 Foam::patchToFace::patchToFace
103 patchName_(patchName)
107 // Construct from dictionary
108 Foam::patchToFace::patchToFace
110 const polyMesh& mesh,
111 const dictionary& dict
115 patchName_(dict.lookup("name"))
119 // Construct from Istream
120 Foam::patchToFace::patchToFace
122 const polyMesh& mesh,
127 patchName_(checkIs(is))
131 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
133 Foam::patchToFace::~patchToFace()
137 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
139 void Foam::patchToFace::applyToSet
141 const topoSetSource::setAction action,
145 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
147 Info<< " Adding all faces of patch " << patchName_ << " ..." << endl;
151 else if (action == topoSetSource::DELETE)
153 Info<< " Removing all faces of patch " << patchName_ << " ..."
161 // ************************************************************************* //