mesh_communication.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_MESH_COMMUNICATION_H
21 #define LIBMESH_MESH_COMMUNICATION_H
22 
23 // Local Includes
25 #include "libmesh/libmesh_common.h"
26 #include "libmesh/mesh_tools.h"
27 
28 // C++ Includes
29 #include <unordered_map>
30 
31 namespace libMesh
32 {
33 
34 // Forward declarations
35 class MeshBase;
36 class DistributedMesh;
37 
38 // This is for backwards compatibility, but if your code relies on
39 // forward declarations in our headers then fix it.
40 class ParallelMesh;
41 
51 {
52 public:
53 
58 
63 
67  void clear ();
68 
69  // /**
70  // * Finds all the processors that may contain
71  // * elements that neighbor my elements. This list
72  // * is guaranteed to include all processors that border
73  // * any of my elements, but may include additional ones as
74  // * well. This method computes bounding boxes for the
75  // * elements on each processor and checks for overlaps.
76  // */
77  // void find_neighboring_processors(const MeshBase &);
78 
85  void broadcast (MeshBase &) const;
86 
102  bool newly_coarsened_only = false) const;
103 
108 
113  void send_coarse_ghosts (MeshBase &) const;
114 
125  void gather (const processor_id_type root_id, DistributedMesh &) const;
126 
137 
152  void delete_remote_elements (DistributedMesh &, const std::set<Elem *> &) const;
153 
164  void assign_global_indices (MeshBase &) const;
165 
171 
176  template <typename ForwardIterator>
178  const ForwardIterator &,
179  const ForwardIterator &,
180  std::unordered_map<dof_id_type, dof_id_type> &) const;
181 
186  template <typename ForwardIterator>
188  const libMesh::BoundingBox &,
189  const ForwardIterator &,
190  const ForwardIterator &,
191  std::vector<dof_id_type> &) const;
192 
197 
198 #ifdef LIBMESH_ENABLE_AMR
199 
203 #endif // LIBMESH_ENABLE_AMR
204 
211 
218 
225 
232 
239 
245 };
246 
247 
248 // Related utilities
249 
250 // Ask a mesh's ghosting functors to insert into a set all elements
251 // that are either on or connected to processor id \p pid. Ask only
252 // for elements in the range from \p elem_it before \p elem_end;
253 // typically this may be mesh.active_pid_elements_*(pid)
254 void query_ghosting_functors(const MeshBase & mesh,
255  processor_id_type pid,
256  MeshBase::const_element_iterator elem_it,
257  MeshBase::const_element_iterator elem_end,
258  std::set<const Elem *, CompareElemIdsByLevel> & connected_elements);
259 
260 // Take a set of elements and insert all immediate
261 // children of elements in the given range
262 void connect_children(const MeshBase & mesh,
263  MeshBase::const_element_iterator elem_it,
264  MeshBase::const_element_iterator elem_end,
265  std::set<const Elem *, CompareElemIdsByLevel> & connected_elements);
266 
267 // Take a set of elements and insert all elements' ancestors and
268 // subactive descendants as well.
269 void connect_families(std::set<const Elem *, CompareElemIdsByLevel> & connected_elements);
270 
271 // Take a set of elements and create a set of connected nodes.
272 void reconnect_nodes (const std::set<const Elem *, CompareElemIdsByLevel> & connected_elements,
273  std::set<const Node *> & connected_nodes);
274 
275 
276 
277 //--------------------------------------------------------------
278 // MeshCommunication inline members
279 
280 
281 } // namespace libMesh
282 
283 #endif // LIBMESH_MESH_COMMUNICATION_H
void find_global_indices(const Parallel::Communicator &communicator, const libMesh::BoundingBox &, const ForwardIterator &, const ForwardIterator &, std::vector< dof_id_type > &) const
void make_node_unique_ids_parallel_consistent(MeshBase &)
void make_elems_parallel_consistent(MeshBase &)
MPI_Comm communicator
Definition: communicator.h:57
MeshBase & mesh
uint8_t processor_id_type
Definition: id_types.h:99
Base class for Mesh.
Definition: mesh_base.h:77
void check_for_duplicate_global_indices(MeshBase &) const
void make_new_node_proc_ids_parallel_consistent(MeshBase &)
void reconnect_nodes(const std::set< const Elem *, CompareElemIdsByLevel > &connected_elements, std::set< const Node *> &connected_nodes)
static const processor_id_type invalid_processor_id
Definition: dof_object.h:358
void connect_families(std::set< const Elem *, CompareElemIdsByLevel > &connected_elements)
void make_p_levels_parallel_consistent(MeshBase &)
void find_local_indices(const libMesh::BoundingBox &, const ForwardIterator &, const ForwardIterator &, std::unordered_map< dof_id_type, dof_id_type > &) const
void allgather(DistributedMesh &mesh) const
Mesh data structure which is distributed across all processors.
void gather_neighboring_elements(DistributedMesh &) const
void query_ghosting_functors(const MeshBase &mesh, processor_id_type pid, MeshBase::const_element_iterator elem_it, MeshBase::const_element_iterator elem_end, std::set< const Elem *, CompareElemIdsByLevel > &connected_elements)
void send_coarse_ghosts(MeshBase &) const
void make_node_ids_parallel_consistent(MeshBase &)
void make_nodes_parallel_consistent(MeshBase &)
void broadcast(MeshBase &) const
void make_node_proc_ids_parallel_consistent(MeshBase &)
void connect_children(const MeshBase &mesh, MeshBase::const_element_iterator elem_it, MeshBase::const_element_iterator elem_end, std::set< const Elem *, CompareElemIdsByLevel > &connected_elements)
void make_new_nodes_parallel_consistent(MeshBase &)
void gather(const processor_id_type root_id, DistributedMesh &) const
void delete_remote_elements(DistributedMesh &, const std::set< Elem *> &) const
void redistribute(DistributedMesh &mesh, bool newly_coarsened_only=false) const