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
27 \*---------------------------------------------------------------------------*/
29 #include "cellToPoint.H"
33 #include "addToRunTimeSelectionTable.H"
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(cellToPoint, 0);
42 addToRunTimeSelectionTable(topoSetSource, cellToPoint, word);
44 addToRunTimeSelectionTable(topoSetSource, cellToPoint, istream);
49 Foam::topoSetSource::addToUsageTable Foam::cellToPoint::usage_
51 cellToPoint::typeName,
52 "\n Usage: cellToPoint <cellSet> all\n\n"
53 " Select all points of cells in the cellSet\n\n"
57 const char* Foam::NamedEnum<Foam::cellToPoint::cellAction, 1>::names[] =
62 const Foam::NamedEnum<Foam::cellToPoint::cellAction, 1>
63 Foam::cellToPoint::cellActionNames_;
66 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
68 void Foam::cellToPoint::combine(topoSet& set, const bool add) const
71 cellSet loadedSet(mesh_, setName_);
73 // Add all point from cells in loadedSet
76 cellSet::const_iterator iter = loadedSet.begin();
77 iter != loadedSet.end();
81 label cellI = iter.key();
83 const labelList& cFaces = mesh_.cells()[cellI];
85 forAll(cFaces, cFaceI)
87 const face& f = mesh_.faces()[cFaces[cFaceI]];
91 addOrDelete(set, f[fp], add);
98 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
100 // Construct from components
101 Foam::cellToPoint::cellToPoint
103 const polyMesh& mesh,
105 const cellAction option
114 // Construct from dictionary
115 Foam::cellToPoint::cellToPoint
117 const polyMesh& mesh,
118 const dictionary& dict
122 setName_(dict.lookup("set")),
123 option_(cellActionNames_.read(dict.lookup("option")))
127 // Construct from Istream
128 Foam::cellToPoint::cellToPoint
130 const polyMesh& mesh,
135 setName_(checkIs(is)),
136 option_(cellActionNames_.read(checkIs(is)))
140 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
142 Foam::cellToPoint::~cellToPoint()
146 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
148 void Foam::cellToPoint::applyToSet
150 const topoSetSource::setAction action,
154 if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
156 Pout<< " Adding from " << setName_ << " ..." << endl;
160 else if (action == topoSetSource::DELETE)
162 Pout<< " Removing from " << setName_ << " ..." << endl;
169 // ************************************************************************* //