Added zone handling to sets.
[OpenFOAM-1.6.x.git] / src / meshTools / sets / topoSets / cellSet.C
blobdabf987a12057f1e5f6cbe11bb62c66d55b97995
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 \*---------------------------------------------------------------------------*/
27 #include "cellSet.H"
28 #include "mapPolyMesh.H"
29 #include "polyMesh.H"
30 #include "Time.H"
31 #include "addToRunTimeSelectionTable.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace Foam
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(cellSet, 0);
42 addToRunTimeSelectionTable(topoSet, cellSet, word);
43 addToRunTimeSelectionTable(topoSet, cellSet, size);
44 addToRunTimeSelectionTable(topoSet, cellSet, set);
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 cellSet::cellSet(const IOobject& obj)
51     topoSet(obj, typeName)
55 cellSet::cellSet
57     const polyMesh& mesh,
58     const word& name,
59     readOption r,
60     writeOption w
63     topoSet(mesh, typeName, name, r, w)
65     // Make sure set within valid range
66     check(mesh.nCells());
70 cellSet::cellSet
72     const polyMesh& mesh,
73     const word& name,
74     const label size,
75     writeOption w
78     topoSet(mesh, name, size, w)
82 cellSet::cellSet
84     const polyMesh& mesh,
85     const word& name,
86     const topoSet& set,
87     writeOption w
90     topoSet(mesh, name, set, w)
94 cellSet::cellSet
96     const polyMesh& mesh,
97     const word& name,
98     const labelHashSet& set,
99     writeOption w
102     topoSet(mesh, name, set, w)
106 // Database constructors (for when no mesh available)
107 cellSet::cellSet
109     const Time& runTime,
110     const word& name,
111     readOption r,
112     writeOption w
115     topoSet
116     (
117         IOobject
118         (
119             name,
120             runTime.findInstance(polyMesh::meshSubDir, "faces"),
121             polyMesh::meshSubDir/"sets",
122             runTime,
123             r,
124             w
125         ),
126         typeName
127     )
131 cellSet::cellSet
133     const Time& runTime,
134     const word& name,
135     const label size,
136     writeOption w
139     topoSet
140     (
141         IOobject
142         (
143             name,
144             runTime.findInstance(polyMesh::meshSubDir, "faces"),
145             polyMesh::meshSubDir/"sets",
146             runTime,
147             NO_READ,
148             w
149         ),
150         size
151     )
155 cellSet::cellSet
157     const Time& runTime,
158     const word& name,
159     const labelHashSet& set,
160     writeOption w
163     topoSet
164     (
165         IOobject
166         (
167             name,
168             runTime.findInstance(polyMesh::meshSubDir, "faces"),
169             polyMesh::meshSubDir/"sets",
170             runTime,
171             NO_READ,
172             w
173         ),
174         set
175     )
179 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
181 cellSet::~cellSet()
185 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
187 label cellSet::maxSize(const polyMesh& mesh) const
189     return mesh.nCells();
193 void cellSet::updateMesh(const mapPolyMesh& morphMap)
195     updateLabels(morphMap.reverseCellMap());
199 void Foam::cellSet::writeDebug
201     Ostream& os,
202     const primitiveMesh& mesh,
203     const label maxLen
204 ) const
206     topoSet::writeDebug(os, mesh.cellCentres(), maxLen);
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 } // End namespace Foam
214 // ************************************************************************* //