libMesh
mesh_communication.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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
24 #include "libmesh/compare_elems_by_level.h"
25 #include "libmesh/libmesh_common.h"
26 #include "libmesh/mesh_tools.h"
27 
28 namespace libMesh
29 {
30 
31 // Forward declarations
32 class MeshBase;
33 class DistributedMesh;
34 
35 // This is for backwards compatibility, but if your code relies on
36 // forward declarations in our headers then fix it.
37 class ParallelMesh;
38 
48 {
49 public:
50 
55 
60 
64  void clear ();
65 
66  // /**
67  // * Finds all the processors that may contain
68  // * elements that neighbor my elements. This list
69  // * is guaranteed to include all processors that border
70  // * any of my elements, but may include additional ones as
71  // * well. This method computes bounding boxes for the
72  // * elements on each processor and checks for overlaps.
73  // */
74  // void find_neighboring_processors(const MeshBase &);
75 
82  void broadcast (MeshBase &) const;
83 
99  bool newly_coarsened_only = false) const;
100 
105 
110  void send_coarse_ghosts (MeshBase &) const;
111 
122  void gather (const processor_id_type root_id, DistributedMesh &) const;
123 
132  void allgather (DistributedMesh & mesh) const
134 
149  void delete_remote_elements (DistributedMesh &, const std::set<Elem *> &) const;
150 
161  void assign_global_indices (MeshBase &) const;
162 
168 
173  template <typename ForwardIterator>
175  const libMesh::BoundingBox &,
176  const ForwardIterator &,
177  const ForwardIterator &,
178  std::vector<dof_id_type> &) const;
179 
184 
185 #ifdef LIBMESH_ENABLE_AMR
186 
190 #endif // LIBMESH_ENABLE_AMR
191 
198 
205 
212 
219 
226 
232 };
233 
234 
235 // Related utilities
236 
237 // Ask a mesh's ghosting functors to insert into a set all elements
238 // that are either on or connected to processor id \p pid. Ask only
239 // for newly-coarsened elements if \p newly_coarsened_only is true.
241  processor_id_type pid,
242  bool newly_coarsened_only,
243  std::set<const Elem *, CompareElemIdsByLevel> & connected_elements);
244 
245 // Take a set of elements and insert all elements' immediate
246 // children as well.
247 void connect_children(const MeshBase & mesh,
248  processor_id_type pid,
249  std::set<const Elem *, CompareElemIdsByLevel> & connected_elements);
250 
251 // Take a set of elements and insert all elements' ancestors and
252 // subactive descendants as well.
253 void connect_families(std::set<const Elem *, CompareElemIdsByLevel> & connected_elements);
254 
255 // Take a set of elements and create a set of connected nodes.
256 void reconnect_nodes (const std::set<const Elem *, CompareElemIdsByLevel> & connected_elements,
257  std::set<const Node *> & connected_nodes);
258 
259 
260 
261 //--------------------------------------------------------------
262 // MeshCommunication inline members
263 
264 
265 } // namespace libMesh
266 
267 #endif // LIBMESH_MESH_COMMUNICATION_H
void redistribute(DistributedMesh &mesh, bool newly_coarsened_only=false) const
This method takes a parallel distributed mesh and redistributes the elements.
void make_node_unique_ids_parallel_consistent(MeshBase &)
Assuming all unique_ids on local nodes are globally unique, and assuming all processor ids are parall...
void assign_global_indices(MeshBase &) const
This method assigns globally unique, partition-agnostic indices to the nodes and elements in the mesh...
Encapsulates the MPI_Comm object.
Definition: parallel.h:657
void connect_children(const MeshBase &mesh, processor_id_type pid, std::set< const Elem *, CompareElemIdsByLevel > &connected_elements)
void reconnect_nodes(const std::set< const Elem *, CompareElemIdsByLevel > &connected_elements, std::set< const Node * > &connected_nodes)
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
void make_elems_parallel_consistent(MeshBase &)
Copy ids of ghost elements from their local processors.
MPI_Comm communicator
Communicator object for talking with subsets of processors.
Definition: parallel.h:181
void clear()
Clears all data structures and resets to a pristine state.
MeshBase & mesh
uint8_t processor_id_type
Definition: id_types.h:99
void find_global_indices(const Parallel::Communicator &communicator, const libMesh::BoundingBox &, const ForwardIterator &, const ForwardIterator &, std::vector< dof_id_type > &) const
This method determines a globally unique, partition-agnostic index for each object in the input range...
The libMesh namespace provides an interface to certain functionality in the library.
void send_coarse_ghosts(MeshBase &) const
Examine a just-coarsened mesh, and for any newly-coarsened elements, send the associated ghosted elem...
void gather_neighboring_elements(DistributedMesh &) const
void gather(const processor_id_type root_id, DistributedMesh &) const
This method takes an input DistributedMesh which may be distributed among all the processors...
This is the MeshBase class.
Definition: mesh_base.h:68
void make_new_node_proc_ids_parallel_consistent(MeshBase &)
Assuming all processor ids on nodes touching local elements are parallel consistent, this function makes processor ids on new nodes on other processors parallel consistent as well.
This is the MeshCommunication class.
static const processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:335
void connect_families(std::set< const Elem *, CompareElemIdsByLevel > &connected_elements)
void make_p_levels_parallel_consistent(MeshBase &)
Copy p levels of ghost elements from their local processors.
void check_for_duplicate_global_indices(MeshBase &) const
Throw an error if we have any index clashes in the numbering used by assign_global_indices.
The DistributedMesh class is derived from the MeshBase class, and is intended to provide identical fu...
Defines a Cartesian bounding box by the two corner extremum.
Definition: bounding_box.h:40
void make_node_ids_parallel_consistent(MeshBase &)
Assuming all ids on local nodes are globally unique, and assuming all processor ids are parallel cons...
void make_nodes_parallel_consistent(MeshBase &)
Copy processor_ids and ids on ghost nodes from their local processors.
void allgather(DistributedMesh &mesh) const
This method takes an input DistributedMesh which may be distributed among all the processors...
void make_node_proc_ids_parallel_consistent(MeshBase &)
Assuming all processor ids on nodes touching local elements are parallel consistent, this function makes all other processor ids parallel consistent as well.
void query_ghosting_functors(const MeshBase &mesh, processor_id_type pid, bool newly_coarsened_only, std::set< const Elem *, CompareElemIdsByLevel > &connected_elements)
void delete_remote_elements(DistributedMesh &, const std::set< Elem * > &) const
This method takes an input DistributedMesh which may be distributed among all the processors...
void make_new_nodes_parallel_consistent(MeshBase &)
Copy processor_ids and ids on new nodes from their local processors.