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 | Copyright (C) 2012-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::DistributedDelaunayMesh
26 
27 Description
28 
29 SourceFiles
30  DistributedDelaunayMeshI.H
31  DistributedDelaunayMesh.C
32  DistributedDelaunayMeshIO.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef DistributedDelaunayMesh_H
37 #define DistributedDelaunayMesh_H
38 
39 #include "DelaunayMesh.H"
41 #include "autoPtr.H"
42 #include "boundBox.H"
43 #include "indexedVertex.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 class mapDistribute;
51 
52 /*---------------------------------------------------------------------------*\
53  Class DistributedDelaunayMesh Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class Triangulation>
58 :
59  public DelaunayMesh<Triangulation>
60 {
61 public:
62 
63  typedef typename Triangulation::Vertex_handle Vertex_handle;
64  typedef typename Triangulation::Cell_handle Cell_handle;
65  typedef typename Triangulation::Point Point;
66 
67  typedef typename Triangulation::Finite_vertices_iterator
69  typedef typename Triangulation::Finite_cells_iterator
71  typedef typename Triangulation::All_cells_iterator
73 
76 
77 
78 private:
79 
80  autoPtr<List<boundBox>> allBackgroundMeshBounds_;
81 
82 
83  // Private Member Functions
84 
85  //-
86  bool distributeBoundBoxes(const boundBox& bb);
87 
88  //-
89  bool isLocal(const Vertex_handle& v) const;
90 
91  bool isLocal(const label localProcIndex) const;
92 
93  labelList overlapProcessors
94  (
95  const point& centre,
96  const scalar radiusSqr
97  ) const;
98 
99  bool checkProcBoundaryCell
100  (
101  const Cell_handle& cit,
102  Map<labelList>& circumsphereOverlaps
103  ) const;
104 
105  void findProcessorBoundaryCells
106  (
107  Map<labelList>& circumsphereOverlaps
108  ) const;
109 
110  void markVerticesToRefer
111  (
112  const Map<labelList>& circumsphereOverlaps,
113  PtrList<labelPairHashSet>& referralVertices,
114  DynamicList<label>& targetProcessor,
115  DynamicList<Vb>& parallelInfluenceVertices
116  );
117 
118  label referVertices
119  (
120  const DynamicList<label>& targetProcessor,
121  DynamicList<Vb>& parallelVertices,
122  PtrList<labelPairHashSet>& referralVertices,
123  labelPairHashSet& receivedVertices
124  );
125 
126  //- Disallow default bitwise copy construct
128 
129  //- Disallow default bitwise assignment
130  void operator=(const DistributedDelaunayMesh<Triangulation>&);
131 
132 
133 public:
134 
135  // Constructors
136 
137  //- Construct from components
138  explicit DistributedDelaunayMesh(const Time& runTime);
139 
141  (
142  const Time& runTime,
143  const word& meshName
144  );
145 
146 
147  //- Destructor
149 
150 
151  // Queries
152 
153  //- Use DelaunayMesh timeCheck function
155 
156  scalar calculateLoadUnbalance() const;
157 
158 
159  // Member Functions
160 
161  //- Build a mapDistribute for the supplied destination processor data
162  static autoPtr<mapDistribute> buildMap(const List<label>& toProc);
163 
164  //-
165  bool distribute(const boundBox& bb);
166 
168  (
169  const backgroundMeshDecomposition& decomposition,
171  );
172 
173  //- Refer vertices so that the processor interfaces are consistent
174  void sync(const boundBox& bb);
175 
176  //- Refer vertices so that the processor interfaces are consistent
177  void sync
178  (
179  const boundBox& bb,
180  PtrList<labelPairHashSet>& referralVertices,
181  labelPairHashSet& receivedVertices,
182  bool iterateReferral = true
183  );
184 
185  //- Inserts points into the triangulation if the point is within
186  // the circumsphere of another cell. Returns HashSet of failed
187  // point insertions
188  template<class PointIterator>
189  labelPairHashSet rangeInsertReferredWithInfo
190  (
191  PointIterator begin,
192  PointIterator end,
193  bool printErrors = true
194  );
195 
196 // distributeField();
197 
198 
199  // Queries
200 
201 
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 //#include "DistributedDelaunayMeshI.H"
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #ifdef NoRepository
216  #include "DistributedDelaunayMesh.C"
217 #endif
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
scalar calculateLoadUnbalance() const
A HashTable with keys but without contents.
Definition: HashSet.H:59
Triangulation::All_cells_iterator All_cells_iterator
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
static autoPtr< mapDistribute > buildMap(const List< label > &toProc)
Build a mapDistribute for the supplied destination processor data.
The vertex and cell classes must have an index defined.
Definition: DelaunayMesh.H:60
labelPairHashSet rangeInsertReferredWithInfo(PointIterator begin, PointIterator end, bool printErrors=true)
Inserts points into the triangulation if the point is within.
bool distribute(const boundBox &bb)
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:58
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
static char meshName[]
Definition: globalFoam.H:7
const pointField & points
A class for handling words, derived from string.
Definition: word.H:59
Triangulation::Cell_handle Cell_handle
Triangulation::Vertex_handle Vertex_handle
Triangulation::Finite_vertices_iterator Finite_vertices_iterator
Triangulation::Finite_cells_iterator Finite_cells_iterator
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:63
Store a background polyMesh to use for the decomposition of space and queries for parallel conformalV...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
DelaunayMesh< Triangulation >::labelPairHashSet labelPairHashSet
~DistributedDelaunayMesh()
Destructor.
void sync(const boundBox &bb)
Refer vertices so that the processor interfaces are consistent.
Namespace for OpenFOAM.
A HashTable to objects of type <T> with a label key.
Definition: Map.H:49