OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

boundaryToFace.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Description
00026 
00027 \*---------------------------------------------------------------------------*/
00028 
00029 #include "boundaryToFace.H"
00030 #include "polyMesh.H"
00031 
00032 #include "addToRunTimeSelectionTable.H"
00033 
00034 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00035 
00036 namespace Foam
00037 {
00038 
00039 defineTypeNameAndDebug(boundaryToFace, 0);
00040 
00041 addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word);
00042 
00043 addToRunTimeSelectionTable(topoSetSource, boundaryToFace, istream);
00044 
00045 }
00046 
00047 
00048 Foam::topoSetSource::addToUsageTable Foam::boundaryToFace::usage_
00049 (
00050     boundaryToFace::typeName,
00051     "\n    Usage: boundaryToFace\n\n"
00052     "    Select all boundary faces\n\n"
00053 );
00054 
00055 
00056 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00057 
00058 void Foam::boundaryToFace::combine(topoSet& set, const bool add) const
00059 {
00060     for
00061     (
00062         label faceI = mesh().nInternalFaces();
00063         faceI < mesh().nFaces();
00064         faceI++
00065     )
00066     {
00067         addOrDelete(set, faceI, add);
00068     }
00069 }
00070 
00071 
00072 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00073 
00074 // Construct from components
00075 Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh)
00076 :
00077     topoSetSource(mesh)
00078 {}
00079 
00080 
00081 // Construct from dictionary
00082 Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh, const dictionary&)
00083 :
00084     topoSetSource(mesh)
00085 {}
00086 
00087 
00088 // Construct from Istream
00089 Foam::boundaryToFace::boundaryToFace
00090 (
00091     const polyMesh& mesh,
00092     Istream& is
00093 )
00094 :
00095     topoSetSource(mesh)
00096 {}
00097 
00098 
00099 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00100 
00101 Foam::boundaryToFace::~boundaryToFace()
00102 {}
00103 
00104 
00105 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00106 
00107 void Foam::boundaryToFace::applyToSet
00108 (
00109     const topoSetSource::setAction action,
00110     topoSet& set
00111 ) const
00112 {
00113     if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
00114     {
00115         Info<< "    Adding all boundary faces ..." << endl;
00116 
00117         combine(set, true);
00118     }
00119     else if (action == topoSetSource::DELETE)
00120     {
00121         Info<< "    Removing all boundary faces ..." << endl;
00122 
00123         combine(set, false);
00124     }
00125 }
00126 
00127 
00128 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd