20 #ifndef LIBMESH_PARTITIONER_H 21 #define LIBMESH_PARTITIONER_H 24 #include "libmesh/libmesh.h" 25 #include "libmesh/id_types.h" 26 #include "libmesh/mesh_base.h" 31 #include <unordered_map> 76 static std::unique_ptr<Partitioner>
85 virtual std::unique_ptr<Partitioner>
clone ()
const = 0;
103 const unsigned int n);
141 { libmesh_not_implemented(); }
150 const unsigned int n);
166 const unsigned int n);
242 const unsigned int n) = 0;
310 #endif // LIBMESH_PARTITIONER_H The definition of the element_iterator struct.
Partitioner()
Constructor.
static void set_interface_node_processor_ids_petscpartitioner(MeshBase &mesh)
Nodes on the partitioning interface is partitioned into two groups using a PETSc partitioner for each...
std::unordered_map< dof_id_type, dof_id_type > _global_index_by_pid_map
Maps active element ids into a contiguous range, as needed by parallel partitioner.
bool single_partition(MeshBase &mesh)
Trivially "partitions" the mesh for one processor.
static void set_interface_node_processor_ids_BFS(MeshBase &mesh)
Nodes on the partitioning interface is clustered into two groups BFS (Breadth First Search)scheme for...
virtual void attach_weights(ErrorVector *)
Attach weights that can be used for partitioning.
bool single_partition_range(MeshBase::element_iterator it, MeshBase::element_iterator end)
Slightly generalized version of single_partition which acts on a range of elements defined by the pai...
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
static void set_node_processor_ids(MeshBase &mesh)
This function is called after partitioning to set the processor IDs for the nodes.
static void set_interface_node_processor_ids_linear(MeshBase &mesh)
Nodes on the partitioning interface is linearly assigned to each pair of processors.
void assign_partitioning(MeshBase &mesh, const std::vector< dof_id_type > &parts)
Assign the computed partitioning to the mesh.
virtual std::unique_ptr< Partitioner > clone() const =0
The libMesh namespace provides an interface to certain functionality in the library.
virtual void partition_range(MeshBase &, MeshBase::element_iterator, MeshBase::element_iterator, const unsigned int)
Partitions elements in the range (it, end) into n parts.
virtual void build_graph(const MeshBase &mesh)
Build a dual graph for partitioner.
std::vector< Elem * > _local_id_to_elem
This is the MeshBase class.
The Partitioner class provides a uniform interface for partitioning algorithms.
virtual void _do_repartition(MeshBase &mesh, const unsigned int n)
This is the actual re-partitioning method which can be overridden in derived classes.
void repartition(MeshBase &mesh, const unsigned int n)
Repartitions the MeshBase into n parts.
ErrorVector * _weights
The weights that might be used for partitioning.
PartitionerType
Defines an enum for mesh partitioner types.
static std::unique_ptr< Partitioner > build(const PartitionerType solver_package)
Builds a Partitioner of the type specified by partitioner_type.
static void processor_pairs_to_interface_nodes(MeshBase &mesh, std::map< std::pair< processor_id_type, processor_id_type >, std::set< dof_id_type >> &processor_pair_to_nodes)
On the partitioning interface, a surface is shared by two and only two processors.
virtual void _find_global_index_by_pid_map(const MeshBase &mesh)
Construct contiguous global indices for the current partitioning.
virtual ~Partitioner()=default
virtual void _do_partition(MeshBase &mesh, const unsigned int n)=0
This is the actual partitioning method which must be overridden in derived classes.
static void partition_unpartitioned_elements(MeshBase &mesh)
These functions assign processor IDs to newly-created elements (in parallel) which are currently assi...
Partitioner & operator=(const Partitioner &)=default
static const dof_id_type communication_blocksize
The blocksize to use when doing blocked parallel communication.
virtual void partition(MeshBase &mesh, const unsigned int n)
Partitions the MeshBase into n parts by setting processor_id() on Nodes and Elems.
virtual PartitionerType type() const
static void set_parent_processor_ids(MeshBase &mesh)
This function is called after partitioning to set the processor IDs for the inactive parent elements...
std::vector< std::vector< dof_id_type > > _dual_graph
A dual graph corresponds to the mesh, and it is typically used in paritioner.
void ErrorVector unsigned int
std::vector< dof_id_type > _n_active_elem_on_proc
The number of active elements on each processor.