triSurfacePartitioner.C
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 #include "triSurfacePartitioner.H"
29 #include "demandDrivenData.H"
30 
31 # ifdef DEBUGPartitioner
32 #include <sstream>
33 # endif
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
43 (
44  const triSurf& surface
45 )
46 :
47  surface_(surface),
48  corners_(),
49  cornerPatches_(),
50  patchPatches_(surface.patches().size()),
51  edgeGroups_(),
52  edgeGroupEdgeGroups_(),
53  patchesEdgeGroups_(),
54  edgeGroupsCorners_()
55 {
56  calculatePatchAddressing();
57 }
58 
60 {}
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
65 {
66  return corners_;
67 }
68 
70 {
71  return cornerPatches_;
72 }
73 
75 {
76  return patchPatches_;
77 }
78 
80 {
81  return edgeGroups_;
82 }
83 
85 {
86  return edgeGroupEdgeGroups_;
87 }
88 
90 (
91  const label patch1,
92  const label patch2,
93  DynList<label>& edgeGroups
94 ) const
95 {
96  edgeGroups.clear();
97 
98  std::pair<label, label> pp
99  (
100  Foam::min(patch1, patch2),
101  Foam::max(patch1, patch2)
102  );
103 
104  std::map<std::pair<label, label>, labelHashSet>::const_iterator it =
105  patchesEdgeGroups_.find(pp);
106 
107  if( it != patchesEdgeGroups_.end() )
108  {
109  const labelHashSet& eGroups = it->second;
110 
111  forAllConstIter(labelHashSet, eGroups, it)
112  edgeGroups.append(it.key());
113  }
114 }
115 
117 (
118  const label edgeGroup1,
119  const label edgeGroup2,
120  DynList<label>& corners
121 ) const
122 {
123  corners.clear();
124 
125  std::pair<label, label> ep
126  (
127  Foam::min(edgeGroup1, edgeGroup2),
128  Foam::max(edgeGroup1, edgeGroup2)
129  );
130 
131  std::map<std::pair<label, label>, labelHashSet>::const_iterator it =
132  edgeGroupsCorners_.find(ep);
133 
134  if( it != edgeGroupsCorners_.end() )
135  {
136  const labelHashSet& corn = it->second;
137 
138  forAllConstIter(labelHashSet, corn, it)
139  corners.append(it.key());
140  }
141 }
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace Foam
146 
147 // ************************************************************************* //
Foam::triSurfacePartitioner::edgeGroupEdgeGroups
const List< labelHashSet > & edgeGroupEdgeGroups() const
Edge group - edge groups addressing.
Definition: triSurfacePartitioner.C:84
Foam::triSurfacePartitioner::cornersSharedByEdgeGroups
void cornersSharedByEdgeGroups(const label edgePartition1, const label edgePartition2, DynList< label > &corners) const
return corners shared shared by the given edge groups
Definition: triSurfacePartitioner.C:117
Foam::triSurfacePartitioner::edgeGroups_
labelList edgeGroups_
edge partitions
Definition: triSurfacePartitioner.H:67
Foam::triSurfacePartitioner::corners_
labelList corners_
corner nodes
Definition: triSurfacePartitioner.H:60
triSurfacePartitioner.H
Foam::triSurfacePartitioner::patchPatches_
List< labelHashSet > patchPatches_
information which partitions share an edge with a given partition
Definition: triSurfacePartitioner.H:64
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::triSurfacePartitioner::edgeGroupsSharedByPatches
void edgeGroupsSharedByPatches(const label partition1, const label partition2, DynList< label > &edgePartitions) const
Return groups of feature edges shared by the given patches.
Definition: triSurfacePartitioner.C:90
Foam::triSurfacePartitioner::triSurfacePartitioner
triSurfacePartitioner(const triSurfacePartitioner &)
Disallow default bitwise copy construct.
Foam::HashSet< label, Hash< label > >
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
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::triSurfacePartitioner::cornerPatches_
List< DynList< label > > cornerPatches_
Definition: triSurfacePartitioner.H:61
Foam::triSurfacePartitioner::patchPatches
const List< labelHashSet > & patchPatches() const
return patch-patches addressing
Definition: triSurfacePartitioner.C:74
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::DynList< label >
Foam::HashTable::find
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
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::surface
Definition: surface.H:55
Foam::triSurfacePartitioner::corners
const labelList & corners() const
return corner nodes
Definition: triSurfacePartitioner.C:64
Foam::triSurfacePartitioner::edgeGroupEdgeGroups_
List< labelHashSet > edgeGroupEdgeGroups_
Definition: triSurfacePartitioner.H:71
Foam::triSurfacePartitioner::edgeGroups
const labelList & edgeGroups() const
Definition: triSurfacePartitioner.C:79
Foam::triSurf
Definition: triSurf.H:59
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::DynList::clear
void clear()
Clear the list, i.e. set next free to zero.
Definition: DynListI.H:279
Foam::triSurfacePartitioner::cornerPatches
const List< DynList< label > > & cornerPatches() const
return corner patches
Definition: triSurfacePartitioner.C:69
Foam::triSurfacePartitioner::~triSurfacePartitioner
~triSurfacePartitioner()
Definition: triSurfacePartitioner.C:59
Foam::DynList::append
void append(const T &e)
Append an element at the end of the list.
Definition: DynListI.H:304