1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
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
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/>.
26 \*---------------------------------------------------------------------------*/
28 #include "triSurfacePartitioner.H"
29 #include "demandDrivenData.H"
31 # ifdef DEBUGPartitioner
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 triSurfacePartitioner::triSurfacePartitioner
44 const triSurf& surface
50 patchPatches_(surface.patches().size()),
52 edgeGroupEdgeGroups_(),
56 calculatePatchAddressing();
59 triSurfacePartitioner::~triSurfacePartitioner()
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 const labelList& triSurfacePartitioner::corners() const
69 const List<DynList<label> >& triSurfacePartitioner::cornerPatches() const
71 return cornerPatches_;
74 const List<labelHashSet>& triSurfacePartitioner::patchPatches() const
79 const labelList& triSurfacePartitioner::edgeGroups() const
84 const List<labelHashSet>& triSurfacePartitioner::edgeGroupEdgeGroups() const
86 return edgeGroupEdgeGroups_;
89 void triSurfacePartitioner::edgeGroupsSharedByPatches
93 DynList<label>& edgeGroups
98 std::pair<label, label> pp
100 Foam::min(patch1, patch2),
101 Foam::max(patch1, patch2)
104 std::map<std::pair<label, label>, labelHashSet>::const_iterator it =
105 patchesEdgeGroups_.find(pp);
107 if( it != patchesEdgeGroups_.end() )
109 const labelHashSet& eGroups = it->second;
111 forAllConstIter(labelHashSet, eGroups, it)
112 edgeGroups.append(it.key());
116 void triSurfacePartitioner::cornersSharedByEdgeGroups
118 const label edgeGroup1,
119 const label edgeGroup2,
120 DynList<label>& corners
125 std::pair<label, label> ep
127 Foam::min(edgeGroup1, edgeGroup2),
128 Foam::max(edgeGroup1, edgeGroup2)
131 std::map<std::pair<label, label>, labelHashSet>::const_iterator it =
132 edgeGroupsCorners_.find(ep);
134 if( it != edgeGroupsCorners_.end() )
136 const labelHashSet& corn = it->second;
138 forAllConstIter(labelHashSet, corn, it)
139 corners.append(it.key());
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 } // End namespace Foam
147 // ************************************************************************* //