#include <mesh_communication.h>
This is the MeshCommunication
class. It handles all the details of communicating mesh information from one processor to another. All parallelization of the Mesh
data structures is done via this class.
Definition at line 50 of file mesh_communication.h.
|
inline |
|
inline |
|
inline |
This method takes an input DistributedMesh
which may be distributed among all the processors. Each processor then sends its local nodes and elements to the other processors. The end result is that a previously distributed DistributedMesh
will be serialized on each processor. Since this method is collective it must be called by all processors.
Definition at line 135 of file mesh_communication.h.
References gather(), libMesh::DofObject::invalid_processor_id, and mesh.
Referenced by libMesh::DistributedMesh::allgather().
void libMesh::MeshCommunication::assign_global_indices | ( | MeshBase & | mesh | ) | const |
This method assigns globally unique, partition-agnostic indices to the nodes and elements in the mesh. The approach is to compute the Hilbert space-filling curve key and use its value to assign an index in [0,N_global). Since the Hilbert key is unique for each spatial location, two objects occupying the same location will be assigned the same global id. Thus, this method can also be useful for identifying duplicate nodes which may occur during parallel refinement.
Definition at line 168 of file mesh_communication_global_indices.C.
References libMesh::Parallel::Sort< KeyType, IdxType >::bin(), libMesh::ParallelObject::comm(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshBase::element_ptr_range(), end, libMesh::MeshTools::Generation::Private::idx(), libMesh::MeshBase::local_elements_begin(), libMesh::MeshBase::local_elements_end(), libMesh::MeshBase::local_nodes_begin(), libMesh::MeshBase::local_nodes_end(), mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::node_ptr_range(), libMesh::Threads::parallel_for(), libMesh::Parallel::pull_parallel_vector_data(), and libMesh::Parallel::Sort< KeyType, IdxType >::sort().
Referenced by libMesh::MeshTools::Private::globally_renumber_nodes_and_elements().
void libMesh::MeshCommunication::broadcast | ( | MeshBase & | mesh | ) | const |
Finds all the processors that may contain elements that neighbor my elements. This list is guaranteed to include all processors that border any of my elements, but may include additional ones as well. This method computes bounding boxes for the elements on each processor and checks for overlaps. This method takes a mesh (which is assumed to reside on processor 0) and broadcasts it to all the other processors. It also broadcasts any boundary information the mesh has associated with it.
Definition at line 1084 of file mesh_communication.C.
Referenced by libMesh::NameBasedIO::read(), and libMesh::CheckpointIO::read().
void libMesh::MeshCommunication::check_for_duplicate_global_indices | ( | MeshBase & | mesh | ) | const |
Throw an error if we have any index clashes in the numbering used by assign_global_indices.
Definition at line 575 of file mesh_communication_global_indices.C.
References libMesh::MeshTools::create_nodal_bounding_box(), libMesh::err, libMesh::MeshBase::local_elements_begin(), libMesh::MeshBase::local_elements_end(), libMesh::MeshBase::local_nodes_begin(), libMesh::MeshBase::local_nodes_end(), mesh, and libMesh::Threads::parallel_for().
void libMesh::MeshCommunication::clear | ( | ) |
Clears all data structures and resets to a pristine state.
Definition at line 275 of file mesh_communication.C.
void libMesh::MeshCommunication::delete_remote_elements | ( | DistributedMesh & | mesh, |
const std::set< Elem *> & | extra_ghost_elem_ids | ||
) | const |
This method takes an input DistributedMesh
which may be distributed among all the processors. Each processor deletes all elements which are neither local elements nor "ghost" elements which touch local elements, and deletes all nodes which are not contained in local or ghost elements. The end result is that a previously serial DistributedMesh
will be distributed between processors. Since this method is collective it must be called by all processors.
The std::set is a list of extra elements that you don't want to delete. These will be left on the current processor along with local elements and ghosted neighbors.
Definition at line 1844 of file mesh_communication.C.
References libMesh::Elem::active_family_tree(), libMesh::MeshBase::active_pid_elements_begin(), libMesh::MeshBase::active_pid_elements_end(), libMesh::as_range(), libMesh::MeshBase::clear_point_locator(), libMesh::ParallelObject::comm(), libMesh::connect_children(), libMesh::connect_families(), libMesh::MeshBase::delete_elem(), libMesh::MeshBase::delete_node(), libMesh::MeshBase::get_boundary_info(), libMesh::MeshBase::ghosting_functors_begin(), libMesh::MeshBase::ghosting_functors_end(), libMesh::MeshBase::is_serial(), libMesh::MeshBase::level_elements_begin(), libMesh::MeshBase::level_elements_end(), libMesh::MeshTools::libmesh_assert_valid_refinement_tree(), libMesh::Elem::make_links_to_me_remote(), libMesh::MeshBase::max_elem_id(), libMesh::MeshBase::max_node_id(), mesh, libMesh::MeshTools::n_levels(), libMesh::MeshBase::node_ptr_range(), libMesh::MeshBase::pid_elements_begin(), libMesh::MeshBase::pid_elements_end(), libMesh::ParallelObject::processor_id(), libMesh::query_ghosting_functors(), libMesh::reconnect_nodes(), libMesh::BoundaryInfo::regenerate_id_sets(), libMesh::Elem::subactive(), and libMesh::Parallel::Communicator::verify().
Referenced by libMesh::DistributedMesh::delete_remote_elements().
void libMesh::MeshCommunication::find_global_indices | ( | const Parallel::Communicator & | communicator, |
const libMesh::BoundingBox & | bbox, | ||
const ForwardIterator & | begin, | ||
const ForwardIterator & | end, | ||
std::vector< dof_id_type > & | index_map | ||
) | const |
This method determines a globally unique, partition-agnostic index for each object in the input range.
Definition at line 708 of file mesh_communication_global_indices.C.
References libMesh::Parallel::Sort< KeyType, IdxType >::bin(), end, libMesh::MeshTools::Generation::Private::idx(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_ignore(), std::max(), libMesh::Parallel::pull_parallel_vector_data(), libMesh::Real, and libMesh::Parallel::Sort< KeyType, IdxType >::sort().
Referenced by libMesh::ParmetisPartitioner::initialize(), libMesh::MetisPartitioner::partition_range(), and libMesh::Partitioner::partition_unpartitioned_elements().
void libMesh::MeshCommunication::find_local_indices | ( | const libMesh::BoundingBox & | bbox, |
const ForwardIterator & | begin, | ||
const ForwardIterator & | end, | ||
std::unordered_map< dof_id_type, dof_id_type > & | index_map | ||
) | const |
This method determines a locally unique, contiguous index for each object in the input range.
Definition at line 672 of file mesh_communication_global_indices.C.
References end.
Referenced by libMesh::Partitioner::_find_global_index_by_pid_map().
void libMesh::MeshCommunication::gather | ( | const processor_id_type | root_id, |
DistributedMesh & | mesh | ||
) | const |
This method takes an input DistributedMesh
which may be distributed among all the processors. Each processor then sends its local nodes and elements to processor root_id
. The end result is that a previously distributed DistributedMesh
will be serialized on processor root_id
. Since this method is collective it must be called by all processors. For the special case of root_id
equal to DofObject::invalid_processor_id
this function performs an allgather.
Definition at line 1156 of file mesh_communication.C.
Referenced by allgather(), and libMesh::DistributedMesh::gather_to_zero().
void libMesh::MeshCommunication::gather_neighboring_elements | ( | DistributedMesh & | mesh | ) | const |
Definition at line 540 of file mesh_communication.C.
Referenced by libMesh::Nemesis_IO::read().
void libMesh::MeshCommunication::make_elems_parallel_consistent | ( | MeshBase & | mesh | ) |
Copy ids of ghost elements from their local processors.
Definition at line 1505 of file mesh_communication.C.
References libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), libMesh::ParallelObject::comm(), mesh, libMesh::Parallel::sync_dofobject_data_by_id(), and libMesh::Parallel::sync_element_data_by_parent_id().
Referenced by libMesh::MeshRefinement::_refine_elements().
void libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent | ( | MeshBase & | mesh | ) |
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.
Definition at line 1685 of file mesh_communication.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::element_ptr_range(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), mesh, std::min(), libMesh::Elem::node_ref(), libMesh::Elem::node_ref_range(), libMesh::MeshBase::not_local_elements_begin(), libMesh::MeshBase::not_local_elements_end(), libMesh::DofObject::processor_id(), libMesh::Parallel::sync_node_data_by_element_id(), and libMesh::Parallel::sync_node_data_by_element_id_once().
void libMesh::MeshCommunication::make_new_nodes_parallel_consistent | ( | MeshBase & | mesh | ) |
Copy processor_ids and ids on new nodes from their local processors.
Definition at line 1805 of file mesh_communication.C.
References libMesh::ParallelObject::comm(), libMesh::MeshTools::correct_node_proc_ids(), and mesh.
Referenced by libMesh::MeshRefinement::_refine_elements().
void libMesh::MeshCommunication::make_node_ids_parallel_consistent | ( | MeshBase & | mesh | ) |
Assuming all ids on local nodes are globally unique, and assuming all processor ids are parallel consistent, this function makes all other ids parallel consistent.
Definition at line 1452 of file mesh_communication.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), mesh, and libMesh::Parallel::sync_node_data_by_element_id().
void libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent | ( | MeshBase & | mesh | ) |
Assuming all processor ids on nodes touching local elements are parallel consistent, this function makes all other processor ids parallel consistent as well.
Definition at line 1656 of file mesh_communication.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), mesh, and libMesh::Parallel::sync_node_data_by_element_id().
void libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent | ( | MeshBase & | mesh | ) |
Assuming all unique_ids on local nodes are globally unique, and assuming all processor ids are parallel consistent, this function makes all ghost unique_ids parallel consistent.
Definition at line 1481 of file mesh_communication.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_ignore(), mesh, libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), and libMesh::Parallel::sync_dofobject_data_by_id().
Referenced by libMesh::BoundaryInfo::add_elements(), and libMesh::Nemesis_IO::read().
void libMesh::MeshCommunication::make_nodes_parallel_consistent | ( | MeshBase & | mesh | ) |
Copy processor_ids and ids on ghost nodes from their local processors. This is useful for code which wants to add nodes to a distributed mesh.
Definition at line 1763 of file mesh_communication.C.
References libMesh::ParallelObject::comm(), libMesh::MeshTools::correct_node_proc_ids(), and mesh.
Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::UnstructuredMesh::all_second_order(), and libMesh::MeshTools::Modification::all_tri().
void libMesh::MeshCommunication::make_p_levels_parallel_consistent | ( | MeshBase & | mesh | ) |
Copy p levels of ghost elements from their local processors.
Definition at line 1529 of file mesh_communication.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), mesh, and libMesh::Parallel::sync_dofobject_data_by_id().
Referenced by libMesh::MeshRefinement::_coarsen_elements(), and libMesh::MeshRefinement::_refine_elements().
void libMesh::MeshCommunication::redistribute | ( | DistributedMesh & | mesh, |
bool | newly_coarsened_only = false |
||
) | const |
This method takes a parallel distributed mesh and redistributes the elements. Specifically, any elements stored on a given processor are sent to the processor which "owns" them. Similarly, any elements assigned to the current processor but stored on another are received. Once this step is completed any required ghost elements are updated. The final result is that each processor stores only the elements it actually owns and any ghost elements required to satisfy data dependencies. This method can be invoked after a partitioning step to affect the new partitioning.
Redistribution can also be done with newly coarsened elements' neighbors only.
Definition at line 284 of file mesh_communication.C.
Referenced by libMesh::DistributedMesh::redistribute().
void libMesh::MeshCommunication::send_coarse_ghosts | ( | MeshBase & | mesh | ) | const |
Examine a just-coarsened mesh, and for any newly-coarsened elements, send the associated ghosted elements to the processor which needs them.
Definition at line 915 of file mesh_communication.C.
Referenced by libMesh::MeshRefinement::_coarsen_elements().