1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 \*---------------------------------------------------------------------------*/
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
181 const polyMesh& mesh,
182 const word& wantedType,
184 readOption r = MUST_READ,
185 writeOption w = NO_WRITE
188 //- Construct empty from additional size of labelHashSet
191 const polyMesh& mesh,
194 writeOption w = NO_WRITE
197 //- Construct empty from additional labelHashSet
200 const polyMesh& mesh,
203 writeOption w = NO_WRITE
206 //- Construct empty from IOobject and size
207 topoSet(const IOobject&, const label size);
209 //- Construct from IOobject and labelHashSet
210 topoSet(const IOobject&, const labelHashSet&);
215 autoPtr<topoSet> clone() const
217 notImplemented("autoPtr<topoSet> clone() const");
218 return autoPtr<topoSet>(NULL);
224 //- Return a pointer to a toposet read from file
225 static autoPtr<topoSet> New
228 const polyMesh& mesh,
230 readOption r = MUST_READ,
231 writeOption w = NO_WRITE
234 //- Return a pointer to a new toposet of given size
235 static autoPtr<topoSet> New
238 const polyMesh& mesh,
241 writeOption w = NO_WRITE
244 //- Return a pointer to a new toposet as copy of another toposet
245 static autoPtr<topoSet> New
247 const polyMesh& mesh,
250 writeOption w = NO_WRITE
261 //- Invert contents. (insert all members 0..maxLen-1 which were not in
263 virtual void invert(const label maxLen);
265 //- Subset contents. Only elements present in both sets remain.
266 virtual void subset(const topoSet& set);
268 //- Add elements present in set.
269 virtual void addSet(const topoSet& set);
271 //- Delete elements present in set.
272 virtual void deleteSet(const topoSet& set);
274 //- Sync set across coupled patches.
275 virtual void sync(const polyMesh& mesh);
277 //- Write labels columnwise to os. Truncate to maxLen.
278 virtual void writeDebug(Ostream& os, const label maxLen) const;
280 //- Like above but also writes mesh related quantity
281 // (usually coordinate).
282 virtual void writeDebug
285 const primitiveMesh&,
290 virtual bool writeData(Ostream&) const;
292 //- Update any stored data for new labels. Not implemented.
293 virtual void updateMesh(const mapPolyMesh& morphMap);
295 //- Return max allowable index (+1). Not implemented.
296 virtual label maxSize(const polyMesh& mesh) const;
302 //- Copy labelHashSet part only
303 void operator=(const topoSet&);
308 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310 } // End namespace Foam
312 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316 // ************************************************************************* //