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

cellToCell.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 "cellToCell.H"
00030 #include "polyMesh.H"
00031 #include "cellSet.H"
00032 
00033 #include "addToRunTimeSelectionTable.H"
00034 
00035 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00036 
00037 namespace Foam
00038 {
00039 
00040 defineTypeNameAndDebug(cellToCell, 0);
00041 
00042 addToRunTimeSelectionTable(topoSetSource, cellToCell, word);
00043 
00044 addToRunTimeSelectionTable(topoSetSource, cellToCell, istream);
00045 
00046 }
00047 
00048 
00049 Foam::topoSetSource::addToUsageTable Foam::cellToCell::usage_
00050 (
00051     cellToCell::typeName,
00052     "\n    Usage: cellToCell <cellSet>\n\n"
00053     "    Select all cells in the cellSet\n\n"
00054 );
00055 
00056 
00057 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00058 
00059 // Construct from components
00060 Foam::cellToCell::cellToCell
00061 (
00062     const polyMesh& mesh,
00063     const word& setName
00064 )
00065 :
00066     topoSetSource(mesh),
00067     setName_(setName)
00068 {}
00069 
00070 
00071 // Construct from dictionary
00072 Foam::cellToCell::cellToCell
00073 (
00074     const polyMesh& mesh,
00075     const dictionary& dict          
00076 )
00077 :
00078     topoSetSource(mesh),
00079     setName_(dict.lookup("set"))
00080 {}
00081 
00082 
00083 // Construct from Istream
00084 Foam::cellToCell::cellToCell
00085 (
00086     const polyMesh& mesh,
00087     Istream& is
00088 )
00089 :
00090     topoSetSource(mesh),
00091     setName_(checkIs(is))
00092 {}
00093 
00094 
00095 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00096 
00097 Foam::cellToCell::~cellToCell()
00098 {}
00099 
00100 
00101 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00102 
00103 void Foam::cellToCell::applyToSet
00104 (
00105     const topoSetSource::setAction action,
00106     topoSet& set
00107 ) const
00108 {
00109     if ((action == topoSetSource::ADD) || (action == topoSetSource::NEW))
00110     {
00111         Pout<< "    Adding all elements of cellSet " << setName_ << " ..."
00112             << endl;
00113 
00114         // Load the set
00115         cellSet loadedSet(mesh_, setName_);
00116 
00117         set.addSet(loadedSet);
00118     }
00119     else if (action == topoSetSource::DELETE)
00120     {
00121         Pout<< "    Removing all elements of cellSet " << setName_ << " ..."
00122             << endl;
00123 
00124         // Load the set
00125         cellSet loadedSet(mesh_, setName_);
00126 
00127         set.deleteSet(loadedSet);
00128     }
00129 }
00130 
00131 
00132 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd