initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / sets / topoSets / cellSet.C
blob4cff9f2908164ccbf8da66ccb31c4013ab22fc66
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);
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 cellSet::cellSet(const IOobject& obj)
50     topoSet(obj, typeName)
54 cellSet::cellSet
56     const polyMesh& mesh,
57     const word& name,
58     readOption r,
59     writeOption w
62     topoSet(mesh, typeName, name, r, w)
64     // Make sure set within valid range
65     check(mesh.nCells());
69 cellSet::cellSet
71     const polyMesh& mesh,
72     const word& name,
73     const label size,
74     writeOption w
77     topoSet(mesh, name, size, w)
81 cellSet::cellSet
83     const polyMesh& mesh,
84     const word& name,
85     const labelHashSet& set,
86     writeOption w
89     topoSet(mesh, name, set, w)
93 // Database constructors (for when no mesh available)
94 cellSet::cellSet
96     const Time& runTime,
97     const word& name,
98     readOption r,
99     writeOption w
102     topoSet
103     (
104         IOobject
105         (
106             name,
107             runTime.findInstance(polyMesh::meshSubDir, "faces"),
108             polyMesh::meshSubDir/"sets",
109             runTime,
110             r,
111             w
112         ),
113         typeName
114     )
118 cellSet::cellSet
120     const Time& runTime,
121     const word& name,
122     const label size,
123     writeOption w
126     topoSet
127     (
128         IOobject
129         (
130             name,
131             runTime.findInstance(polyMesh::meshSubDir, "faces"),
132             polyMesh::meshSubDir/"sets",
133             runTime,
134             NO_READ,
135             w
136         ),
137         size
138     )
142 cellSet::cellSet
144     const Time& runTime,
145     const word& name,
146     const labelHashSet& set,
147     writeOption w
150     topoSet
151     (
152         IOobject
153         (
154             name,
155             runTime.findInstance(polyMesh::meshSubDir, "faces"),
156             polyMesh::meshSubDir/"sets",
157             runTime,
158             NO_READ,
159             w
160         ),
161         set
162     )
166 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
168 cellSet::~cellSet()
172 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
174 label cellSet::maxSize(const polyMesh& mesh) const
176     return mesh.nCells();
180 void cellSet::updateMesh(const mapPolyMesh& morphMap)
182     updateLabels(morphMap.reverseCellMap());
186 void Foam::cellSet::writeDebug
188     Ostream& os,
189     const primitiveMesh& mesh,
190     const label maxLen
191 ) const
193     topoSet::writeDebug(os, mesh.cellCentres(), maxLen);
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 } // End namespace Foam
201 // ************************************************************************* //