1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 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
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
29 General set of labels of mesh quantity (points, cells, faces).
31 Contains various 'notImplemented' functions, but I do not want to make
32 this class abstract since it is quite handy to work on topoSets.
37 \*---------------------------------------------------------------------------*/
43 #include "regIOobject.H"
44 #include "labelList.H"
47 #include "pointField.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 /*---------------------------------------------------------------------------*\
60 Class topoSet Declaration
61 \*---------------------------------------------------------------------------*/
71 // Protected Member Functions
73 //- Update map from map. Used to update cell/face labels
75 void updateLabels(const labelList& map);
77 //- Check validity of contents.
78 void check(const label maxLabel);
80 //- Write part of contents nicely formatted. Prints labels only.
85 topoSet::const_iterator& iter,
89 //- Write part of contents nicely formatted. Prints label
90 // and corresponding coordinate.
94 const pointField& coords,
96 topoSet::const_iterator& iter,
100 //- Write labels and coordinates columnwise to os. Truncate to maxLen.
104 const pointField& coords,
109 //- Disallow default bitwise copy construct
110 topoSet(const topoSet&);
114 //- Runtime type information
120 //- Name of file set will use.
121 static fileName localPath(const polyMesh& mesh, const word& name);
124 // Declare run-time constructor selection table
126 // For the direct constructor
127 declareRunTimeSelectionTable
133 const polyMesh& mesh,
141 // For the constructor from size
142 declareRunTimeSelectionTable
148 const polyMesh& mesh,
153 (mesh, name, size, w)
156 // For the constructor as copy
157 declareRunTimeSelectionTable
163 const polyMesh& mesh,
175 //- Construct from IOobject as explicitly passed type.
176 // Can't use typeName info here since subclasses not yet instantiated
177 topoSet(const IOobject&, const word& wantedType);
179 //- Construct from polyMesh and name
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
192 const polyMesh& mesh,
195 writeOption w=NO_WRITE
198 //- Construct empty from additional labelHashSet
201 const polyMesh& mesh,
204 writeOption w=NO_WRITE
207 //- Construct empty from IOobject and size
208 topoSet(const IOobject&, const label size);
210 //- Construct from IOobject and labelHashSet
211 topoSet(const IOobject&, const labelHashSet&);
216 autoPtr<topoSet> clone() const
218 notImplemented("autoPtr<topoSet> clone() const");
219 return autoPtr<topoSet>(NULL);
225 //- Return a pointer to a toposet read from file
226 static autoPtr<topoSet> New
229 const polyMesh& mesh,
231 readOption r=MUST_READ,
232 writeOption w=NO_WRITE
235 //- Return a pointer to a new toposet of given size
236 static autoPtr<topoSet> New
239 const polyMesh& mesh,
242 writeOption w=NO_WRITE
245 //- Return a pointer to a new toposet as copy of another toposet
246 static autoPtr<topoSet> New
249 const polyMesh& mesh,
252 writeOption w=NO_WRITE
263 //- Invert contents. (insert all members 0..maxLen-1 which were not in
265 virtual void invert(const label maxLen);
267 //- Subset contents. Only elements present in both sets remain.
268 virtual void subset(const topoSet& set);
270 //- Add elements present in set.
271 virtual void addSet(const topoSet& set);
273 //- Delete elements present in set.
274 virtual void deleteSet(const topoSet& set);
276 //- Sync set across coupled patches.
277 virtual void sync(const polyMesh& mesh);
279 //- Write labels columnwise to os. Truncate to maxLen.
280 virtual void writeDebug(Ostream& os, const label maxLen) const;
282 //- Like above but also writes mesh related quantity
283 // (usually coordinate).
284 virtual void writeDebug
287 const primitiveMesh&,
292 virtual bool writeData(Ostream&) const;
294 //- Update any stored data for new labels. Not implemented.
295 virtual void updateMesh(const mapPolyMesh& morphMap);
297 //- Return max allowable index (+1). Not implemented.
298 virtual label maxSize(const polyMesh& mesh) const; // = 0;
304 //- Copy labelHashSet part only
305 void operator=(const topoSet&);
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 } // End namespace Foam
314 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
318 // ************************************************************************* //