1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 General set of labels of mesh quantity (points, cells, faces).
30 Contains various 'notImplemented' functions, but I do not want to make
31 this class abstract since it is quite handy to work on topoSets.
36 \*---------------------------------------------------------------------------*/
42 #include "regIOobject.H"
43 #include "labelList.H"
46 #include "pointField.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 /*---------------------------------------------------------------------------*\
59 Class topoSet Declaration
60 \*---------------------------------------------------------------------------*/
70 // Protected Member Functions
72 //- Update map from map. Used to update cell/face labels
74 void updateLabels(const labelList& map);
76 //- Check validity of contents.
77 void check(const label maxLabel);
79 //- Write part of contents nicely formatted. Prints labels only.
84 topoSet::const_iterator& iter,
88 //- Write part of contents nicely formatted. Prints label
89 // and corresponding coordinate.
93 const pointField& coords,
95 topoSet::const_iterator& iter,
99 //- Write labels and coordinates columnwise to os. Truncate to maxLen.
103 const pointField& coords,
108 //- Disallow default bitwise copy construct
109 topoSet(const topoSet&);
113 //- Runtime type information
119 //- Name of file set will use.
120 static fileName localPath(const polyMesh& mesh, const word& name);
123 // Declare run-time constructor selection table
125 // For the direct constructor
126 declareRunTimeSelectionTable
132 const polyMesh& mesh,
140 // For the constructor from size
141 declareRunTimeSelectionTable
147 const polyMesh& mesh,
152 (mesh, name, size, w)
155 // For the constructor as copy
156 declareRunTimeSelectionTable
162 const polyMesh& mesh,
174 //- Construct from IOobject as explicitly passed type.
175 // Can't use typeName info here since subclasses not yet instantiated
176 topoSet(const IOobject&, const word& wantedType);
178 //- Construct from polyMesh and name. Searches for a polyMesh/sets
179 // directory but not beyond mesh.facesInstance.
182 const polyMesh& mesh,
183 const word& wantedType,
185 readOption r=MUST_READ,
186 writeOption w=NO_WRITE
189 //- Construct empty from additional size of labelHashSet.
190 // Searches for a polyMesh/sets
191 // directory but not beyond mesh.facesInstance.
194 const polyMesh& mesh,
197 writeOption w=NO_WRITE
200 //- Construct empty from additional labelHashSet
201 // Searches for a polyMesh/sets
202 // directory but not beyond mesh.facesInstance.
205 const polyMesh& mesh,
208 writeOption w=NO_WRITE
211 //- Construct empty from IOobject and size.
212 topoSet(const IOobject&, const label size);
214 //- Construct from IOobject and labelHashSet.
215 topoSet(const IOobject&, const labelHashSet&);
220 autoPtr<topoSet> clone() const
222 notImplemented("autoPtr<topoSet> clone() const");
223 return autoPtr<topoSet>(NULL);
229 //- Return a pointer to a toposet read from file
230 static autoPtr<topoSet> New
233 const polyMesh& mesh,
235 readOption r=MUST_READ,
236 writeOption w=NO_WRITE
239 //- Return a pointer to a new toposet of given size
240 static autoPtr<topoSet> New
243 const polyMesh& mesh,
246 writeOption w=NO_WRITE
249 //- Return a pointer to a new toposet as copy of another toposet
250 static autoPtr<topoSet> New
253 const polyMesh& mesh,
256 writeOption w=NO_WRITE
266 //- Invert contents. (insert all members 0..maxLen-1 which were not in
268 virtual void invert(const label maxLen);
270 //- Subset contents. Only elements present in both sets remain.
271 virtual void subset(const topoSet& set);
273 //- Add elements present in set.
274 virtual void addSet(const topoSet& set);
276 //- Delete elements present in set.
277 virtual void deleteSet(const topoSet& set);
279 //- Sync set across coupled patches.
280 virtual void sync(const polyMesh& mesh);
282 //- Write labels columnwise to os. Truncate to maxLen.
283 virtual void writeDebug(Ostream& os, const label maxLen) const;
285 //- Like above but also writes mesh related quantity
286 // (usually coordinate).
287 virtual void writeDebug
290 const primitiveMesh&,
295 virtual bool writeData(Ostream&) const;
297 //- Update any stored data for new labels. Not implemented.
298 virtual void updateMesh(const mapPolyMesh& morphMap);
300 //- Return max allowable index (+1). Not implemented.
301 virtual label maxSize(const polyMesh& mesh) const = 0;
307 //- Copy labelHashSet part only
308 void operator=(const topoSet&);
313 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
315 } // End namespace Foam
317 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
321 // ************************************************************************* //