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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::DistributedDelaunayMesh
28 
29 Description
30 
31 SourceFiles
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 
49 namespace Foam
50 {
51 
52 class mapDistribute;
53 
54 /*---------------------------------------------------------------------------*\
55  Class DistributedDelaunayMesh Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class Triangulation>
60 :
61  public DelaunayMesh<Triangulation>
62 {
63 public:
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 
76 private:
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 DynamicList<label>& targetProcessor,
119  DynamicList<Vb>& parallelVertices,
120  PtrList<labelPairHashSet>& referralVertices,
121  labelPairHashSet& receivedVertices
122  );
123 
124  //- No copy construct
126  (
128  ) = delete;
129 
130  //- No copy assignment
131  void operator=(const DistributedDelaunayMesh<Triangulation>&) = delete;
132 
133 
134 public:
135 
136  // Constructors
137 
138  //- Construct from components
139  explicit DistributedDelaunayMesh(const Time& runTime);
140 
142  (
143  const Time& runTime,
144  const word& meshName
145  );
146 
147 
148  //- Destructor
149  ~DistributedDelaunayMesh() = default;
150 
151 
152  // Queries
153 
154  //- Use DelaunayMesh timeCheck function
156 
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 List<label>& 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
179  (
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
211  #include "DistributedDelaunayMesh.C"
212 #endif
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #endif
217 
218 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
stdFoam::begin
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
Definition: stdFoam.H:97
Foam::DynamicList< label >
Foam::Map
A HashTable to objects of type <T> with a label key.
Definition: lumpedPointController.H:69
Foam::HashSet
A HashTable with keys but without contents that is similar to std::unordered_set.
Definition: HashSet.H:77
Foam::DistributedDelaunayMesh::rangeInsertReferredWithInfo
labelPairHashSet rangeInsertReferredWithInfo(PointIterator begin, PointIterator end, bool printErrors=true)
Inserts points into the triangulation if the point is within.
Foam::DistributedDelaunayMesh::Finite_cells_iterator
Triangulation::Finite_cells_iterator Finite_cells_iterator
Definition: DistributedDelaunayMesh.H:71
Foam::DistributedDelaunayMesh::buildMap
static autoPtr< mapDistribute > buildMap(const List< label > &toProc)
Build a mapDistribute for the supplied destination processor data.
Foam::DistributedDelaunayMesh::Cell_handle
Triangulation::Cell_handle Cell_handle
Definition: DistributedDelaunayMesh.H:65
backgroundMeshDecomposition.H
Foam::DistributedDelaunayMesh::sync
void sync(const boundBox &bb)
Refer vertices so that the processor interfaces are consistent.
DistributedDelaunayMesh.C
Foam::DistributedDelaunayMesh::~DistributedDelaunayMesh
~DistributedDelaunayMesh()=default
Destructor.
Foam::DistributedDelaunayMesh::All_cells_iterator
Triangulation::All_cells_iterator All_cells_iterator
Definition: DistributedDelaunayMesh.H:73
Foam::DistributedDelaunayMesh
Definition: DistributedDelaunayMesh.H:58
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::DistributedDelaunayMesh::calculateLoadUnbalance
scalar calculateLoadUnbalance() const
stdFoam::end
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Definition: stdFoam.H:121
Foam::DistributedDelaunayMesh::Vertex_handle
Triangulation::Vertex_handle Vertex_handle
Definition: DistributedDelaunayMesh.H:64
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
boundBox.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::DelaunayMesh< CellSizeDelaunay >::Cell_handle
CellSizeDelaunay ::Cell_handle Cell_handle
Definition: DelaunayMesh.H:66
Foam::DistributedDelaunayMesh::distribute
bool distribute(const boundBox &bb)
Foam::Vector< scalar >
Foam::List< label >
Foam::DistributedDelaunayMesh::Finite_vertices_iterator
Triangulation::Finite_vertices_iterator Finite_vertices_iterator
Definition: DistributedDelaunayMesh.H:69
Foam::backgroundMeshDecomposition
Store a background polyMesh to use for the decomposition of space and queries for parallel conformalV...
Definition: backgroundMeshDecomposition.H:94
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
Point
CGAL::Point_3< K > Point
Definition: CGALIndexedPolyhedron.H:53
Foam::DelaunayMesh
The vertex and cell classes must have an index defined.
Definition: DelaunayMesh.H:60
Foam::DistributedDelaunayMesh::Point
Triangulation::Point Point
Definition: DistributedDelaunayMesh.H:66
DelaunayMesh.H
Foam::DelaunayMesh< CellSizeDelaunay >::Vertex_handle
CellSizeDelaunay ::Vertex_handle Vertex_handle
Definition: DelaunayMesh.H:67
autoPtr.H