1 /*---------------------------------------------------------------------------*\
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 -------------------------------------------------------------------------------
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/>.
28 Accumulate topology change statistics
32 University of Massachusetts Amherst
35 \*---------------------------------------------------------------------------*/
40 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
43 inline label& changeMap::index()
49 inline label changeMap::index() const
55 // Coupled patch index
56 inline label& changeMap::patchIndex()
62 inline label changeMap::patchIndex() const
69 inline label& changeMap::type()
75 inline label changeMap::type() const
81 inline void changeMap::addPoint
84 const labelList& master
87 addedPoints_.append(objectMap(pIndex, master));
91 inline void changeMap::addEdge
94 const labelList& master
97 addedEdges_.append(objectMap(eIndex, master));
101 inline void changeMap::addFace
104 const labelList& master
107 addedFaces_.append(objectMap(fIndex, master));
111 inline void changeMap::addCell
114 const labelList& master
117 addedCells_.append(objectMap(cIndex, master));
121 inline const List<objectMap>&
122 changeMap::addedPointList() const
128 inline const List<objectMap>&
129 changeMap::addedEdgeList() const
135 inline const List<objectMap>&
136 changeMap::addedFaceList() const
142 inline const List<objectMap>&
143 changeMap::addedCellList() const
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
212 // Clear added entities
213 addedPoints_.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);
232 pIndex_ = rhs.pIndex_;
237 addedPoints_.setSize(rhs.addedPoints_.size());
239 forAll(addedPoints_, indexI)
241 addedPoints_[indexI].index() = rhs.addedPoints_[indexI].index();
243 addedPoints_[indexI].masterObjects() =
245 rhs.addedPoints_[indexI].masterObjects()
249 addedEdges_.setSize(rhs.addedEdges_.size());
251 forAll(addedEdges_, indexI)
253 addedEdges_[indexI].index() = rhs.addedEdges_[indexI].index();
255 addedEdges_[indexI].masterObjects() =
257 rhs.addedEdges_[indexI].masterObjects()
261 addedFaces_.setSize(rhs.addedFaces_.size());
263 forAll(addedFaces_, indexI)
265 addedFaces_[indexI].index() = rhs.addedFaces_[indexI].index();
267 addedFaces_[indexI].masterObjects() =
269 rhs.addedFaces_[indexI].masterObjects()
273 addedCells_.setSize(rhs.addedCells_.size());
275 forAll(addedCells_, indexI)
277 addedCells_[indexI].index() = rhs.addedCells_[indexI].index();
279 addedCells_[indexI].masterObjects() =
281 rhs.addedCells_[indexI].masterObjects()
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&)");
316 } // End namespace Foam
318 // ************************************************************************* //