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

cellSet.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 \*---------------------------------------------------------------------------*/
00026 
00027 #include "cellSet.H"
00028 #include "mapPolyMesh.H"
00029 #include "polyMesh.H"
00030 #include "Time.H"
00031 #include "addToRunTimeSelectionTable.H"
00032 
00033 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00034 
00035 namespace Foam
00036 {
00037 
00038 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00039 
00040 defineTypeNameAndDebug(cellSet, 0);
00041 
00042 addToRunTimeSelectionTable(topoSet, cellSet, word);
00043 addToRunTimeSelectionTable(topoSet, cellSet, size);
00044 
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 cellSet::cellSet(const IOobject& obj)
00049 :
00050     topoSet(obj, typeName)
00051 {}
00052 
00053 
00054 cellSet::cellSet
00055 (
00056     const polyMesh& mesh,
00057     const word& name,
00058     readOption r,
00059     writeOption w
00060 )
00061 :
00062     topoSet(mesh, typeName, name, r, w)
00063 {
00064     // Make sure set within valid range
00065     check(mesh.nCells());
00066 }
00067 
00068 
00069 cellSet::cellSet
00070 (
00071     const polyMesh& mesh,
00072     const word& name,
00073     const label size,
00074     writeOption w
00075 )
00076 :
00077     topoSet(mesh, name, size, w)
00078 {}
00079 
00080 
00081 cellSet::cellSet
00082 (
00083     const polyMesh& mesh,
00084     const word& name,
00085     const labelHashSet& set,
00086     writeOption w
00087 )
00088 :
00089     topoSet(mesh, name, set, w)
00090 {}
00091 
00092 
00093 // Database constructors (for when no mesh available)
00094 cellSet::cellSet
00095 (
00096     const Time& runTime,
00097     const word& name,
00098     readOption r,
00099     writeOption w
00100 )
00101 :
00102     topoSet
00103     (
00104         IOobject
00105         (
00106             name,
00107             runTime.findInstance(polyMesh::meshSubDir, "faces"),
00108             polyMesh::meshSubDir/"sets",
00109             runTime,
00110             r,
00111             w
00112         ),
00113         typeName
00114     )
00115 {}
00116 
00117 
00118 cellSet::cellSet
00119 (
00120     const Time& runTime,
00121     const word& name,
00122     const label size,
00123     writeOption w
00124 )
00125 :
00126     topoSet
00127     (
00128         IOobject
00129         (
00130             name,
00131             runTime.findInstance(polyMesh::meshSubDir, "faces"),
00132             polyMesh::meshSubDir/"sets",
00133             runTime,
00134             NO_READ,
00135             w
00136         ),
00137         size
00138     )
00139 {}
00140 
00141 
00142 cellSet::cellSet
00143 (
00144     const Time& runTime,
00145     const word& name,
00146     const labelHashSet& set,
00147     writeOption w
00148 )
00149 :
00150     topoSet
00151     (
00152         IOobject
00153         (
00154             name,
00155             runTime.findInstance(polyMesh::meshSubDir, "faces"),
00156             polyMesh::meshSubDir/"sets",
00157             runTime,
00158             NO_READ,
00159             w
00160         ),
00161         set
00162     )
00163 {}
00164 
00165 
00166 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00167 
00168 cellSet::~cellSet()
00169 {}
00170 
00171 
00172 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00173 
00174 label cellSet::maxSize(const polyMesh& mesh) const
00175 {
00176     return mesh.nCells();
00177 }
00178 
00179 
00180 void cellSet::updateMesh(const mapPolyMesh& morphMap)
00181 {
00182     updateLabels(morphMap.reverseCellMap());
00183 }
00184 
00185 
00186 void Foam::cellSet::writeDebug
00187 (
00188     Ostream& os,
00189     const primitiveMesh& mesh,
00190     const label maxLen
00191 ) const
00192 {
00193     topoSet::writeDebug(os, mesh.cellCentres(), maxLen);
00194 }
00195 
00196 
00197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00198 
00199 } // End namespace Foam
00200 
00201 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd