polyMeshGenCellsI.H
Go to the documentation of this file.
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.
10 
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.
15 
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.
20 
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/>.
23 
24 Description
25 
26 
27 \*---------------------------------------------------------------------------*/
28 
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 #include "polyMeshGenCells.H"
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 inline const cellListPMG& polyMeshGenCells::cells() const
40 {
41  return cells_;
42 }
43 
45 (
46  const label selID,
47  const label cellI
48 )
49 {
50  std::map<label, meshSubset>::iterator it = cellSubsets_.find(selID);
51  if( it == cellSubsets_.end() )
52  return;
53 
54  it->second.addElement(cellI);
55 }
56 
58 (
59  const label selID,
60  const label cellI
61 )
62 {
63  std::map<label, meshSubset>::iterator it = cellSubsets_.find(selID);
64  if( it == cellSubsets_.end() )
65  return;
66 
67  it->second.removeElement(cellI);
68 }
69 
71 (
72  const label cellI,
73  DynList<label>& cellSubsets
74 ) const
75 {
76  cellSubsets.clear();
77 
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  }
89 }
90 
92 {
93  indices.clear();
94 
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);
103 }
104 
105 template<class ListType>
107 (
108  const label selID,
109  ListType& cellLabels
110 ) const
111 {
112  cellLabels.clear();
113 
114  std::map<label, meshSubset>::const_iterator it =
115  cellSubsets_.find(selID);
116  if( it == cellSubsets_.end() )
117  return;
118 
119  it->second.containedElements(cellLabels);
120 }
121 
122 template<class ListType>
124 (
125  const ListType& newCellLabels
126 )
127 {
128  for
129  (
130  std::map<label, meshSubset>::iterator it=cellSubsets_.begin();
131  it!=cellSubsets_.end();
132  ++it
133  )
134  it->second.updateSubset(newCellLabels);
135 }
136 
138 (
139  const VRWGraph& newCellsForCell
140 )
141 {
142  for
143  (
144  std::map<label, meshSubset>::iterator it=cellSubsets_.begin();
145  it!=cellSubsets_.end();
146  ++it
147  )
148  it->second.updateSubset(newCellsForCell);
149 }
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 } // End namespace Foam
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::polyMeshGenCells::cellInSubsets
void cellInSubsets(const label, DynList< label > &) const
Definition: polyMeshGenCellsI.H:71
Foam::cellListPMG
Definition: cellListPMG.H:49
Foam::polyMeshGenCells::cellSubsets_
std::map< label, meshSubset > cellSubsets_
cell subsets
Definition: polyMeshGenCells.H:59
Foam::polyMeshGenCells::addCellToSubset
void addCellToSubset(const label, const label)
Definition: polyMeshGenCellsI.H:45
Foam::polyMeshGenCells::updateCellSubsets
void updateCellSubsets(const ListType &)
Definition: polyMeshGenCellsI.H:124
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::polyMeshGenCells::cells
const cellListPMG & cells() const
access to cells
Definition: polyMeshGenCellsI.H:39
polyMeshGenCells.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::DynList< label >
Foam::polyMeshGenCells::cells_
cellListPMG cells_
list of cells
Definition: polyMeshGenCells.H:56
Foam::polyMeshGenCells::cellsInSubset
void cellsInSubset(const label, ListType &) const
Definition: polyMeshGenCellsI.H:107
Foam::VRWGraph
Definition: VRWGraph.H:101
Foam::polyMeshGenCells::removeCellFromSubset
void removeCellFromSubset(const label, const label)
Definition: polyMeshGenCellsI.H:58
Foam::polyMeshGenCells::cellSubsetIndices
void cellSubsetIndices(DynList< label > &) const
Definition: polyMeshGenCellsI.H:91
Foam::DynList::clear
void clear()
Clear the list, i.e. set next free to zero.
Definition: DynListI.H:279
Foam::DynList::append
void append(const T &e)
Append an element at the end of the list.
Definition: DynListI.H:304