BUG: PointEdgeWave : n cyclics bool instead of label
[OpenFOAM-1.6.x.git] / src / meshTools / sets / topoSets / topoSet.H
bloba1d1e76ca9b971b865164174bd9ff642c0d22dc9
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 Class
26     Foam::topoSet
28 Description
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.
34 SourceFiles
35     topoSet.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef topoSet_H
40 #define topoSet_H
42 #include "HashSet.H"
43 #include "regIOobject.H"
44 #include "labelList.H"
45 #include "typeInfo.H"
46 #include "autoPtr.H"
47 #include "pointField.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 namespace Foam
55 class mapPolyMesh;
56 class polyMesh;
57 class primitiveMesh;
59 /*---------------------------------------------------------------------------*\
60                            Class topoSet Declaration
61 \*---------------------------------------------------------------------------*/
63 class topoSet
65     public regIOobject,
66     public labelHashSet
69 protected:
71     // Protected Member Functions
73         //- Update map from map. Used to update cell/face labels
74         //  after morphing
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.
81         void writeDebug
82         (
83             Ostream& os,
84             const label maxElem,
85             topoSet::const_iterator& iter,
86             label& elemI
87         ) const;
89         //- Write part of contents nicely formatted. Prints label
90         //  and corresponding coordinate.
91         void writeDebug
92         (
93             Ostream& os,
94             const pointField& coords,
95             const label maxElem,
96             topoSet::const_iterator& iter,
97             label& elemI
98         ) const;
100         //- Write labels and coordinates columnwise to os. Truncate to maxLen.
101         void writeDebug
102         (
103             Ostream& os,
104             const pointField& coords,
105             const label maxLen
106         ) const;
109         //- Disallow default bitwise copy construct
110         topoSet(const topoSet&);
112 public:
114     //- Runtime type information
115     TypeName("topoSet");
118     // Static
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
128         (
129             autoPtr,
130             topoSet,
131             word,
132             (
133                 const polyMesh& mesh,
134                 const word& name,
135                 readOption r,
136                 writeOption w
137             ),
138             (mesh, name, r, w)
139         );
141         // For the constructor from size
142         declareRunTimeSelectionTable
143         (
144             autoPtr,
145             topoSet,
146             size,
147             (
148                 const polyMesh& mesh,
149                 const word& name,
150                 const label size,
151                 writeOption w
152             ),
153             (mesh, name, size, w)
154         );
156         // For the constructor as copy
157         declareRunTimeSelectionTable
158         (
159             autoPtr,
160             topoSet,
161             set,
162             (
163                 const polyMesh& mesh,
164                 const word& name,
165                 const topoSet& set,
166                 writeOption w
167             ),
168             (mesh, name, set, w)
169         );
172     // Constructors
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
180         topoSet
181         (
182             const polyMesh& mesh,
183             const word& wantedType,
184             const word& name,
185             readOption r=MUST_READ,
186             writeOption w=NO_WRITE
187         );
189         //- Construct empty from additional size of labelHashSet
190         topoSet
191         (
192             const polyMesh& mesh,
193             const word& name,
194             const label,
195             writeOption w=NO_WRITE
196         );
198         //- Construct empty from additional labelHashSet
199         topoSet
200         (
201             const polyMesh& mesh,
202             const word& name,
203             const labelHashSet&,
204             writeOption w=NO_WRITE
205         );
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&);
215         //- Clone
216         autoPtr<topoSet> clone() const
217         {
218             notImplemented("autoPtr<topoSet> clone() const");
219             return autoPtr<topoSet>(NULL);
220         }
223     // Selectors
225         //- Return a pointer to a toposet read from file
226         static autoPtr<topoSet> New
227         (
228             const word& setType,
229             const polyMesh& mesh,
230             const word& name,
231             readOption r=MUST_READ,
232             writeOption w=NO_WRITE
233         );
235         //- Return a pointer to a new toposet of given size
236         static autoPtr<topoSet> New
237         (
238             const word& setType,
239             const polyMesh& mesh,
240             const word& name,
241             const label size,
242             writeOption w=NO_WRITE
243         );
245         //- Return a pointer to a new toposet as copy of another toposet
246         static autoPtr<topoSet> New
247         (
248             const word& setType,
249             const polyMesh& mesh,
250             const word& name,
251             const topoSet& set,
252             writeOption w=NO_WRITE
253         );
256     // Destructor
258         virtual ~topoSet();
261     // Member functions
263         //- Invert contents. (insert all members 0..maxLen-1 which were not in
264         //  set)
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
285         (
286             Ostream& os,
287             const primitiveMesh&,
288             const label maxLen
289         ) const;    // = 0;
291         //- Write contents.
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;
302     // Member operators
304         //- Copy labelHashSet part only
305         void operator=(const topoSet&);
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 } // End namespace Foam
314 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316 #endif
318 // ************************************************************************* //