Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / meshTools / sets / faceSources / boundaryToFace / boundaryToFace.C
blob52283e7f52a86e2a08db4f653383d0eb8606fe1e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "boundaryToFace.H"
27 #include "polyMesh.H"
29 #include "addToRunTimeSelectionTable.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 namespace Foam
36 defineTypeNameAndDebug(boundaryToFace, 0);
38 addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word);
40 addToRunTimeSelectionTable(topoSetSource, boundaryToFace, istream);
45 Foam::topoSetSource::addToUsageTable Foam::boundaryToFace::usage_
47     boundaryToFace::typeName,
48     "\n    Usage: boundaryToFace\n\n"
49     "    Select all boundary faces\n\n"
53 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
55 void Foam::boundaryToFace::combine(topoSet& set, const bool add) const
57     for
58     (
59         label faceI = mesh().nInternalFaces();
60         faceI < mesh().nFaces();
61         faceI++
62     )
63     {
64         addOrDelete(set, faceI, add);
65     }
69 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
71 // Construct from components
72 Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh)
74     topoSetSource(mesh)
78 // Construct from dictionary
79 Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh, const dictionary&)
81     topoSetSource(mesh)
85 // Construct from Istream
86 Foam::boundaryToFace::boundaryToFace
88     const polyMesh& mesh,
89     Istream& is
92     topoSetSource(mesh)
96 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
98 Foam::boundaryToFace::~boundaryToFace()
102 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
104 void Foam::boundaryToFace::applyToSet
106     const topoSetSource::setAction action,
107     topoSet& set
108 ) const
110     if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
111     {
112         Info<< "    Adding all boundary faces ..." << endl;
114         combine(set, true);
115     }
116     else if (action == topoSetSource::DELETE)
117     {
118         Info<< "    Removing all boundary faces ..." << endl;
120         combine(set, false);
121     }
125 // ************************************************************************* //