Loading...
Searching...
No Matches
DistributedDelaunayMesh.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2012-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::DistributedDelaunayMesh
28
29Description
30
31SourceFiles
32 DistributedDelaunayMeshI.H
33 DistributedDelaunayMesh.C
34 DistributedDelaunayMeshIO.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef DistributedDelaunayMesh_H
39#define DistributedDelaunayMesh_H
40
41#include "DelaunayMesh.H"
43#include "autoPtr.H"
44#include "boundBox.H"
45#include "indexedVertex.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52class mapDistribute;
53
54/*---------------------------------------------------------------------------*\
55 Class DistributedDelaunayMesh Declaration
56\*---------------------------------------------------------------------------*/
57
58template<class Triangulation>
59class DistributedDelaunayMesh
61 public DelaunayMesh<Triangulation>
63public:
64
65 typedef typename Triangulation::Vertex_handle Vertex_handle;
66 typedef typename Triangulation::Cell_handle Cell_handle;
67 typedef typename Triangulation::Point Point;
68
69 typedef typename Triangulation::Finite_vertices_iterator
71 typedef typename Triangulation::Finite_cells_iterator
73 typedef typename Triangulation::All_cells_iterator
75
76private:
77
78 autoPtr<List<boundBox>> allBackgroundMeshBounds_;
79
80
81 // Private Member Functions
82
83 //-
84 bool distributeBoundBoxes(const boundBox& bb);
85
86 //-
87 bool isLocal(const Vertex_handle& v) const;
88
89 bool isLocal(const label localProcIndex) const;
90
91 labelList overlapProcessors
92 (
93 const point& centre,
94 const scalar radiusSqr
95 ) const;
96
97 bool checkProcBoundaryCell
98 (
99 const Cell_handle& cit,
100 Map<labelList>& circumsphereOverlaps
101 ) const;
102
103 void findProcessorBoundaryCells
104 (
105 Map<labelList>& circumsphereOverlaps
106 ) const;
107
108 void markVerticesToRefer
109 (
110 const Map<labelList>& circumsphereOverlaps,
111 PtrList<labelPairHashSet>& referralVertices,
112 DynamicList<label>& targetProcessor,
113 DynamicList<Vb>& parallelInfluenceVertices
114 );
115
116 label referVertices
117 (
118 const labelUList& targetProcessor,
119 DynamicList<Vb>& parallelVertices,
120 PtrList<labelPairHashSet>& referralVertices,
121 labelPairHashSet& receivedVertices
122 );
123
124 //- No copy construct
125 DistributedDelaunayMesh
126 (
127 const DistributedDelaunayMesh&
128 ) = delete;
129
130 //- No copy assignment
131 void operator=(const DistributedDelaunayMesh<Triangulation>&) = delete;
132
133
134public:
135
136 // Constructors
137
138 //- Construct from components
139 explicit DistributedDelaunayMesh(const Time& runTime);
140
141 DistributedDelaunayMesh
142 (
143 const Time& runTime,
144 const word& meshName
145 );
147
148 //- Destructor
149 ~DistributedDelaunayMesh() = default;
150
151
152 // Queries
153
154 //- Use DelaunayMesh timeCheck function
155 using DelaunayMesh<Triangulation>::timeCheck;
157 scalar calculateLoadUnbalance() const;
158
159
160 // Member Functions
161
162 //- Build a mapDistribute for the supplied destination processor data
163 static autoPtr<mapDistribute> buildMap(const labelUList& toProc);
164
165 //-
166 bool distribute(const boundBox& bb);
167
169 (
170 const backgroundMeshDecomposition& decomposition,
172 );
173
174 //- Refer vertices so that the processor interfaces are consistent
175 void sync(const boundBox& bb);
176
177 //- Refer vertices so that the processor interfaces are consistent
178 void sync
180 const boundBox& bb,
181 PtrList<labelPairHashSet>& referralVertices,
182 labelPairHashSet& receivedVertices,
183 bool iterateReferral = true
184 );
185
186 //- Inserts points into the triangulation if the point is within
187 // the circumsphere of another cell. Returns HashSet of failed
188 // point insertions
189 template<class PointIterator>
191 (
192 PointIterator begin,
193 PointIterator end,
194 bool printErrors = true
195 );
196
197};
198
199
200// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201
202} // End namespace Foam
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206//#include "DistributedDelaunayMeshI.H"
207
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210#ifdef NoRepository
212#endif
213
214// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215
216#endif
217
218// ************************************************************************* //
void timeCheck(const string &description, const bool check=true) const
Write the cpuTime to screen.
DistributedDelaunayMesh(const Time &runTime)
Construct from components.
bool distribute(const boundBox &bb)
Triangulation::Vertex_handle Vertex_handle
Triangulation::Finite_vertices_iterator Finite_vertices_iterator
DistributedDelaunayMesh(const Time &runTime, const word &meshName)
Triangulation::All_cells_iterator All_cells_iterator
scalar calculateLoadUnbalance() const
static autoPtr< mapDistribute > buildMap(const labelUList &toProc)
Build a mapDistribute for the supplied destination processor data.
Triangulation::Cell_handle Cell_handle
labelPairHashSet rangeInsertReferredWithInfo(PointIterator begin, PointIterator end, bool printErrors=true)
Inserts points into the triangulation if the point is within.
Triangulation::Finite_cells_iterator Finite_cells_iterator
~DistributedDelaunayMesh()=default
Destructor.
void sync(const boundBox &bb)
Refer vertices so that the processor interfaces are consistent.
autoPtr< mapDistribute > distribute(const backgroundMeshDecomposition &decomposition, List< Foam::point > &points)
void sync(const boundBox &bb, PtrList< labelPairHashSet > &referralVertices, labelPairHashSet &receivedVertices, bool iterateReferral=true)
Refer vertices so that the processor interfaces are consistent.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A HashTable to objects of type <T> with a label key.
Definition Map.H:54
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Store a background polyMesh to use for the decomposition of space and queries for parallel conformalV...
A bounding box defined in terms of min/max extrema points.
Definition boundBox.H:71
Class containing processor-to-processor mapping information.
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
const pointField & points
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
vector point
Point is a vector.
Definition point.H:37
UList< label > labelUList
A UList of labels.
Definition UList.H:75
HashSet< labelPair, Foam::Hash< labelPair > > labelPairHashSet
A HashSet for a labelPair. The hashing is based on labelPair (FixedList) and is thus non-commutative.