FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "cellSet.H"
00027 #include <OpenFOAM/mapPolyMesh.H>
00028 #include <OpenFOAM/polyMesh.H>
00029 #include <OpenFOAM/Time.H>
00030 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00031 
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 
00037 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00038 
00039 defineTypeNameAndDebug(cellSet, 0);
00040 
00041 addToRunTimeSelectionTable(topoSet, cellSet, word);
00042 addToRunTimeSelectionTable(topoSet, cellSet, size);
00043 addToRunTimeSelectionTable(topoSet, cellSet, set);
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 topoSet& set,
00086     writeOption w
00087 )
00088 :
00089     topoSet(mesh, name, set, w)
00090 {}
00091 
00092 
00093 cellSet::cellSet
00094 (
00095     const polyMesh& mesh,
00096     const word& name,
00097     const labelHashSet& set,
00098     writeOption w
00099 )
00100 :
00101     topoSet(mesh, name, set, w)
00102 {}
00103 
00104 
00105 // Database constructors (for when no mesh available)
00106 cellSet::cellSet
00107 (
00108     const Time& runTime,
00109     const word& name,
00110     readOption r,
00111     writeOption w
00112 )
00113 :
00114     topoSet
00115     (
00116         IOobject
00117         (
00118             name,
00119             runTime.findInstance(polyMesh::meshSubDir, "faces"),
00120             polyMesh::meshSubDir/"sets",
00121             runTime,
00122             r,
00123             w
00124         ),
00125         typeName
00126     )
00127 {}
00128 
00129 
00130 cellSet::cellSet
00131 (
00132     const Time& runTime,
00133     const word& name,
00134     const label size,
00135     writeOption w
00136 )
00137 :
00138     topoSet
00139     (
00140         IOobject
00141         (
00142             name,
00143             runTime.findInstance(polyMesh::meshSubDir, "faces"),
00144             polyMesh::meshSubDir/"sets",
00145             runTime,
00146             NO_READ,
00147             w
00148         ),
00149         size
00150     )
00151 {}
00152 
00153 
00154 cellSet::cellSet
00155 (
00156     const Time& runTime,
00157     const word& name,
00158     const labelHashSet& set,
00159     writeOption w
00160 )
00161 :
00162     topoSet
00163     (
00164         IOobject
00165         (
00166             name,
00167             runTime.findInstance(polyMesh::meshSubDir, "faces"),
00168             polyMesh::meshSubDir/"sets",
00169             runTime,
00170             NO_READ,
00171             w
00172         ),
00173         set
00174     )
00175 {}
00176 
00177 
00178 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00179 
00180 cellSet::~cellSet()
00181 {}
00182 
00183 
00184 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00185 
00186 label cellSet::maxSize(const polyMesh& mesh) const
00187 {
00188     return mesh.nCells();
00189 }
00190 
00191 
00192 void cellSet::updateMesh(const mapPolyMesh& morphMap)
00193 {
00194     updateLabels(morphMap.reverseCellMap());
00195 }
00196 
00197 
00198 void Foam::cellSet::writeDebug
00199 (
00200     Ostream& os,
00201     const primitiveMesh& mesh,
00202     const label maxLen
00203 ) const
00204 {
00205     topoSet::writeDebug(os, mesh.cellCentres(), maxLen);
00206 }
00207 
00208 
00209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00210 
00211 } // End namespace Foam
00212 
00213 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines