triSurfFacetsI.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 "triSurfFacets.H"
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 inline label triSurfFacets::size() const
40 {
41  return triangles_.size();
42 }
43 
45 {
46  return triangles_;
47 }
48 
50 {
51  return patches_;
52 }
53 
55 {
56  triangles_.append(tri);
57 }
58 
60 (
61  const label setI,
62  const label triI
63 )
64 {
65  Map<meshSubset>::iterator it = facetSubsets_.find(setI);
66  if( it == facetSubsets_.end() )
67  return;
68 
69  it().addElement(triI);
70 }
71 
73 (
74  const label setI,
75  const label triI
76 )
77 {
78  Map<meshSubset>::iterator it = facetSubsets_.find(setI);
79  if( it == facetSubsets_.end() )
80  return;
81 
82  it().removeElement(triI);
83 }
84 
86 (
87  const label triI,
88  DynList<label>& facetSubsets
89 ) const
90 {
91  facetSubsets.clear();
92 
94  (
96  facetSubsets_,
97  it
98  )
99  {
100  if( it().contains(triI) )
101  facetSubsets.append(it.key());
102  }
103 }
104 
106 {
107  indices.clear();
108 
110  (
113  it
114  )
115  indices.append(it.key());
116 }
117 
118 template<class ListType>
120 (
121  const label setI,
122  ListType& facetsLabels
123 ) const
124 {
125  facetsLabels.clear();
126 
127  Map<meshSubset>::const_iterator it = facetSubsets_.find(setI);
128  if( it == facetSubsets_.end() )
129  return;
130 
131  it().containedElements(facetsLabels);
132 }
133 
134 template<class ListType>
135 inline void triSurfFacets::updateFacetsSubsets(const ListType& newFacetsLabels)
136 {
137  for
138  (
140  it!=facetSubsets_.end();
141  ++it
142  )
143  it().updateSubset(newFacetsLabels);
144 }
145 
146 inline const labelledTri& triSurfFacets::operator[](const label triI) const
147 {
148  return triangles_[triI];
149 }
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 } // End namespace Foam
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::triSurfFacets::triangles_
LongList< labelledTri > triangles_
list of triangles
Definition: triSurfFacets.H:58
Foam::HashTable::iterator
An STL-conforming iterator.
Definition: HashTable.H:415
Foam::triSurfFacets::patches_
geometricSurfacePatchList patches_
list of boundary patches and their properties
Definition: triSurfFacets.H:61
Foam::triSurfFacets::appendTriangle
void appendTriangle(const labelledTri &tria)
append a triangle to the end of the list
Definition: triSurfFacetsI.H:54
Foam::HashTable::const_iterator
An STL-conforming const_iterator.
Definition: HashTable.H:470
Foam::Map
A HashTable to objects of type <T> with a label key.
Definition: PrimitivePatchTemplate.H:68
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
Foam::LongList
Definition: LongList.H:55
Foam::triSurfFacets::addFacetToSubset
void addFacetToSubset(const label, const label)
Definition: triSurfFacetsI.H:60
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::triSurfFacets::removeFacetFromSubset
void removeFacetFromSubset(const label, const label)
Definition: triSurfFacetsI.H:73
Foam::triSurfFacets::patches
const geometricSurfacePatchList & patches() const
access to patches
Definition: triSurfFacetsI.H:49
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::DynList< label >
Foam::triSurfFacets::operator[]
const labelledTri & operator[](const label) const
access to a triangle
Definition: triSurfFacetsI.H:146
Foam::triSurfFacets::facetSubsetIndices
void facetSubsetIndices(DynList< label > &) const
Definition: triSurfFacetsI.H:105
Foam::triSurfFacets::size
label size() const
return the number of triangles
Definition: triSurfFacetsI.H:39
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::triSurfFacets::facetSubsets_
Map< meshSubset > facetSubsets_
map of point subsets
Definition: triSurfFacets.H:64
Foam::labelledTri
Triangle with additional region number.
Definition: labelledTri.H:49
triSurfFacets.H
Foam::triSurfFacets::updateFacetsSubsets
void updateFacetsSubsets(const ListType &)
Definition: triSurfFacetsI.H:135
Foam::triSurfFacets::facets
const LongList< labelledTri > & facets() const
access to facets
Definition: triSurfFacetsI.H:44
Foam::triSurfFacets::facetInSubsets
void facetInSubsets(const label, DynList< label > &) const
Definition: triSurfFacetsI.H:86
Foam::triSurfFacets::facetsInSubset
void facetsInSubset(const label, ListType &) const
Definition: triSurfFacetsI.H:120
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