Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / meshes / polyMeshGen / polyMeshGenCellsI.H
blob71cfc879cd8605fdabc4064b4b4873adac68e8e6
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | cfMesh: A library for mesh generation
4    \\    /   O peration     |
5     \\  /    A nd           | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6      \\/     M anipulation  | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9     This file is part of cfMesh.
11     cfMesh 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     cfMesh 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 cfMesh.  If not, see <http://www.gnu.org/licenses/>.
24 Description
27 \*---------------------------------------------------------------------------*/
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 #include "polyMeshGenCells.H"
34 namespace Foam
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 inline const cellListPMG& polyMeshGenCells::cells() const
41     return cells_;
44 inline void polyMeshGenCells::addCellToSubset
46     const label selID,
47     const label cellI
50     std::map<label, meshSubset>::iterator it = cellSubsets_.find(selID);
51     if( it == cellSubsets_.end() )
52         return;
54     it->second.addElement(cellI);
57 inline void polyMeshGenCells::removeCellFromSubset
59     const label selID,
60     const label cellI
63     std::map<label, meshSubset>::iterator it = cellSubsets_.find(selID);
64     if( it == cellSubsets_.end() )
65         return;
67     it->second.removeElement(cellI);
70 inline void polyMeshGenCells::cellInSubsets
72     const label cellI,
73     DynList<label>& cellSubsets
74 ) const
76     cellSubsets.clear();
78     std::map<label, meshSubset>::const_iterator it;
79     for
80     (
81         it=cellSubsets_.begin();
82         it!=cellSubsets_.end();
83         ++it
84     )
85     {
86         if( it->second.contains(cellI) )
87             cellSubsets.append(it->first);
88     }
91 inline void polyMeshGenCells::cellSubsetIndices(DynList<label>& indices) const
93     indices.clear();
95     std::map<label, meshSubset>::const_iterator it;
96     for
97     (
98         it=cellSubsets_.begin();
99         it!=cellSubsets_.end();
100         ++it
101     )
102         indices.append(it->first);
105 template<class ListType>
106 inline void polyMeshGenCells::cellsInSubset
108     const label selID,
109     ListType& cellLabels
110 ) const
112     cellLabels.clear();
114     std::map<label, meshSubset>::const_iterator it =
115         cellSubsets_.find(selID);
116     if( it == cellSubsets_.end() )
117         return;
119     it->second.containedElements(cellLabels);
122 template<class ListType>
123 inline void polyMeshGenCells::updateCellSubsets
125     const ListType& newCellLabels
128     for
129     (
130         std::map<label, meshSubset>::iterator it=cellSubsets_.begin();
131         it!=cellSubsets_.end();
132         ++it
133     )
134         it->second.updateSubset(newCellLabels);
137 inline void polyMeshGenCells::updateCellSubsets
139     const VRWGraph& newCellsForCell
142     for
143     (
144         std::map<label, meshSubset>::iterator it=cellSubsets_.begin();
145         it!=cellSubsets_.end();
146         ++it
147     )
148         it->second.updateSubset(newCellsForCell);
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 } // End namespace Foam
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //