Go to the documentation of this file.
   22 #include "libmesh/centroid_partitioner.h" 
   23 #include "libmesh/elem.h" 
   24 #include "libmesh/int_range.h" 
   47   libmesh_assert_greater (n, 0);
 
   50   if (!
mesh.is_serial())
 
   51     libmesh_not_implemented();
 
  101       libmesh_error_msg(
"Unknown sort method: " << this->
sort_method());
 
  105   const dof_id_type target_size = cast_int<dof_id_type>
 
  115         std::min (cast_int<processor_id_type>(i / target_size),
 
  116                   cast_int<processor_id_type>(n-1));
 
  123                                          const unsigned int n)
 
  126                         mesh.elements_begin(),
 
  146                                   const std::pair<Point, Elem *> & rhs)
 
  148   return (lhs.first(0) < rhs.first(0));
 
  155                                   const std::pair<Point, Elem *> & rhs)
 
  157   return (lhs.first(1) < rhs.first(1));
 
  165                                   const std::pair<Point, Elem *> & rhs)
 
  167   return (lhs.first(2) < rhs.first(2));
 
  173                                        const std::pair<Point, Elem *> & rhs)
 
  175   return (lhs.first.norm() < rhs.first.norm());
 
  
void 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 definition of the element_iterator struct.
 
static bool sort_y(const std::pair< Point, Elem * > &lhs, const std::pair< Point, Elem * > &rhs)
Helper function which sorts by the centroid's y-coordinate in the internal std::sort call.
 
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
 
The libMesh namespace provides an interface to certain functionality in the library.
 
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end.
 
void compute_centroids(MeshBase::element_iterator it, MeshBase::element_iterator end)
Computes a list of element centroids for the mesh.
 
processor_id_type processor_id() const
 
static bool sort_radial(const std::pair< Point, Elem * > &lhs, const std::pair< Point, Elem * > &rhs)
Helper function which sorts by the centroid's distance from the origin in the internal std::sort call...
 
This is the MeshBase class.
 
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
 
CentroidSortMethod sort_method() const
Getter for the current sorting method.
 
std::vector< std::pair< Point, Elem * > > _elem_centroids
Vector which holds pairs of centroids and their respective element pointers.
 
This is the base class from which all geometric element types are derived.
 
static bool sort_x(const std::pair< Point, Elem * > &lhs, const std::pair< Point, Elem * > &rhs)
Helper function which sorts by the centroid's x-coordinate in the internal std::sort call.
 
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).
 
static bool sort_z(const std::pair< Point, Elem * > &lhs, const std::pair< Point, Elem * > &rhs)
Helper function which sorts by the centroid's z-coordinate in the internal std::sort call.
 
virtual void _do_partition(MeshBase &mesh, const unsigned int n) override
Partitions the mesh into n subdomains.