21#include "libmesh/linear_partitioner.h"
22#include "libmesh/libmesh_logging.h"
23#include "libmesh/elem.h"
24#include "libmesh/enum_partitioner_type.h"
25#include "libmesh/parallel.h"
41 const bool mesh_is_serial =
mesh.is_serial();
44 if (it == end && mesh_is_serial)
53 libmesh_assert_greater (n, 0);
56 LOG_SCOPE (
"partition_range()",
"LinearPartitioner");
59 std::set<dof_id_type> element_ids;
66 (std::distance(it, end) / n);
69 for (
auto & elem :
as_range(it, end))
72 elem->processor_id() = cast_int<processor_id_type>(e/blksize);
74 elem->processor_id() = 0;
88 for (
const auto & elem :
as_range(it, end))
89 element_ids.insert(elem->id());
91 mesh.comm().set_union(element_ids);
94 (element_ids.size() / n);
97 for (
auto eid : element_ids)
99 Elem * elem =
mesh.query_elem_ptr(eid);
103 elem->
processor_id() = cast_int<processor_id_type>(e/blksize);
116 const unsigned int n)
119 mesh.active_elements_begin(),
120 mesh.active_elements_end(),
processor_id_type processor_id() const
This is the base class from which all geometric element types are derived.
virtual void partition_range(MeshBase &mesh, MeshBase::element_iterator it, MeshBase::element_iterator end, const unsigned int n) override
Called by the SubdomainPartitioner to partition elements in the range (it, end).
virtual void _do_partition(MeshBase &mesh, const unsigned int n) override
Partition the MeshBase into n subdomains.
virtual PartitionerType type() const override
This is the MeshBase class.
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 libMesh namespace provides an interface to certain functionality in the library.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
PartitionerType
Defines an enum for mesh partitioner types.
The definition of the element_iterator struct.