Forward compatibility: flex
[foam-extend-3.2.git] / src / dynamicMesh / dynamicTopoFvMesh / changeMapI.H
blob9b7e6bc505835f53f22ff980b5f86c57882bc14b
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     changeMap
27 Description
28     Accumulate topology change statistics
30 Author
31     Sandeep Menon
32     University of Massachusetts Amherst
33     All rights reserved
35 \*---------------------------------------------------------------------------*/
37 namespace Foam
40 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
42 // Entity index
43 inline label& changeMap::index()
45     return index_;
49 inline label changeMap::index() const
51     return index_;
55 // Coupled patch index
56 inline label& changeMap::patchIndex()
58     return pIndex_;
62 inline label changeMap::patchIndex() const
64     return pIndex_;
68 // Type
69 inline label& changeMap::type()
71     return type_;
75 inline label changeMap::type() const
77     return type_;
81 inline void changeMap::addPoint
83     const label pIndex,
84     const labelList& master
87     addedPoints_.append(objectMap(pIndex, master));
91 inline void changeMap::addEdge
93     const label eIndex,
94     const labelList& master
97     addedEdges_.append(objectMap(eIndex, master));
101 inline void changeMap::addFace
103     const label fIndex,
104     const labelList& master
107     addedFaces_.append(objectMap(fIndex, master));
111 inline void changeMap::addCell
113     const label cIndex,
114     const labelList& master
117     addedCells_.append(objectMap(cIndex, master));
121 inline const List<objectMap>&
122 changeMap::addedPointList() const
124     return addedPoints_;
128 inline const List<objectMap>&
129 changeMap::addedEdgeList() const
131     return addedEdges_;
135 inline const List<objectMap>&
136 changeMap::addedFaceList() const
138     return addedFaces_;
142 inline const List<objectMap>&
143 changeMap::addedCellList() const
145     return addedCells_;
149 inline void changeMap::removePoint(const label pIndex)
151     removedPoints_.append(pIndex);
155 inline void changeMap::removeEdge(const label eIndex)
157     removedEdges_.append(eIndex);
161 inline void changeMap::removeFace(const label fIndex)
163     removedFaces_.append(fIndex);
167 inline void changeMap::removeCell(const label cIndex)
169     removedCells_.append(cIndex);
173 inline const labelList&
174 changeMap::removedPointList() const
176     return removedPoints_;
180 inline const labelList&
181 changeMap::removedEdgeList() const
183     return removedEdges_;
187 inline const labelList&
188 changeMap::removedFaceList() const
190     return removedFaces_;
194 inline const labelList&
195 changeMap::removedCellList() const
197     return removedCells_;
201 // Clear existing lists
202 inline void changeMap::clear()
204     // Clear base dictionary
205     dictionary::clear();
207     index_ = -1;
208     pIndex_ = -1;
210     type_ = -1;
212     // Clear added entities
213     addedPoints_.clear();
214     addedEdges_.clear();
215     addedFaces_.clear();
216     addedCells_.clear();
218     // Clear removed entities
219     removedPoints_.clear();
220     removedEdges_.clear();
221     removedFaces_.clear();
222     removedCells_.clear();
226 inline void changeMap::operator=(const changeMap& rhs)
228     // Copy base dictionary
229     dictionary::operator=(rhs);
231     index_ = rhs.index_;
232     pIndex_ = rhs.pIndex_;
234     type_ = rhs.type_;
236     // Copy maps
237     addedPoints_.setSize(rhs.addedPoints_.size());
239     forAll(addedPoints_, indexI)
240     {
241         addedPoints_[indexI].index() = rhs.addedPoints_[indexI].index();
243         addedPoints_[indexI].masterObjects() =
244         (
245             rhs.addedPoints_[indexI].masterObjects()
246         );
247     }
249     addedEdges_.setSize(rhs.addedEdges_.size());
251     forAll(addedEdges_, indexI)
252     {
253         addedEdges_[indexI].index() = rhs.addedEdges_[indexI].index();
255         addedEdges_[indexI].masterObjects() =
256         (
257             rhs.addedEdges_[indexI].masterObjects()
258         );
259     }
261     addedFaces_.setSize(rhs.addedFaces_.size());
263     forAll(addedFaces_, indexI)
264     {
265         addedFaces_[indexI].index() = rhs.addedFaces_[indexI].index();
267         addedFaces_[indexI].masterObjects() =
268         (
269             rhs.addedFaces_[indexI].masterObjects()
270         );
271     }
273     addedCells_.setSize(rhs.addedCells_.size());
275     forAll(addedCells_, indexI)
276     {
277         addedCells_[indexI].index() = rhs.addedCells_[indexI].index();
279         addedCells_[indexI].masterObjects() =
280         (
281             rhs.addedCells_[indexI].masterObjects()
282         );
283     }
285     removedPoints_ = rhs.removedPoints_;
286     removedEdges_ = rhs.removedEdges_;
287     removedFaces_ = rhs.removedFaces_;
288     removedCells_ = rhs.removedCells_;
292 inline Ostream& operator<<(Ostream& os, const changeMap& cm)
294     // Write base dictionary
295     os << static_cast<const dictionary&>(cm) << endl;
297     os << " index: " << cm.index_ << nl
298        << " patchIndex: " << cm.pIndex_ << nl
299        << " type: " << cm.type_ << nl
300        << " addedPoints: " << cm.addedPoints_ << nl
301        << " addedEdges: " << cm.addedEdges_ << nl
302        << " addedFaces: " << cm.addedFaces_ << nl
303        << " addedCells: " << cm.addedCells_ << nl
304        << " removedPoints: " << cm.removedPoints_ << nl
305        << " removedEdges: " << cm.removedEdges_ << nl
306        << " removedFaces: " << cm.removedFaces_ << nl
307        << " removedCells: " << cm.removedCells_ << endl;
309     // Check state of IOstream
310     os.check("Ostream& operator<<(Ostream&, changeMap&)");
312     return os;
316 } // End namespace Foam
318 // ************************************************************************* //