19#ifndef LIBMESH_CENTROID_PARTITIONER_H
20#define LIBMESH_CENTROID_PARTITIONER_H
23#include "libmesh/partitioner.h"
24#include "libmesh/point.h"
90 virtual std::unique_ptr<Partitioner>
clone ()
const override
92 return std::make_unique<CentroidPartitioner>(*
this);
111 const unsigned int n)
override;
119 const unsigned int n)
override;
133 static bool sort_x (
const std::pair<Point, Elem *> & lhs,
134 const std::pair<Point, Elem *> & rhs);
140 static bool sort_y (
const std::pair<Point, Elem *> & lhs,
141 const std::pair<Point, Elem *> & rhs);
147 static bool sort_z (
const std::pair<Point, Elem *> & lhs,
148 const std::pair<Point, Elem *> & rhs);
154 static bool sort_radial (
const std::pair<Point, Elem *> & lhs,
155 const std::pair<Point, Elem *> & rhs);
Partitions the Mesh based on the locations of element vertex averages.
CentroidPartitioner(const CentroidSortMethod sm=X)
Constructor.
CentroidSortMethod
A typedef which controls the sorting method used for ordering the vertex averages.
static bool sort_radial(const std::pair< Point, Elem * > &lhs, const std::pair< Point, Elem * > &rhs)
Helper function which sorts by the vertex averages's distance from the origin in the internal std::so...
CentroidSortMethod _sort_method
Flag indicating the type of sort method we are using.
virtual std::unique_ptr< Partitioner > clone() const override
void set_sort_method(const CentroidSortMethod sm)
Setter for the current sorting method.
CentroidPartitioner(CentroidPartitioner &&)=default
virtual void _do_partition(MeshBase &mesh, const unsigned int n) override
Partitions the mesh into n subdomains.
virtual ~CentroidPartitioner()=default
void compute_vertex_avgs(MeshBase::element_iterator it, MeshBase::element_iterator end)
Computes a list of element vertex averages for the mesh.
CentroidPartitioner & operator=(const CentroidPartitioner &)=default
static bool sort_z(const std::pair< Point, Elem * > &lhs, const std::pair< Point, Elem * > &rhs)
Helper function which sorts by the vertex average's z-coordinate in the internal std::sort call.
std::vector< std::pair< Point, Elem * > > _elem_vertex_avgs
Vector which holds pairs of vertex averages and their respective element pointers.
CentroidPartitioner(const CentroidPartitioner &)=default
Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this c...
virtual PartitionerType type() const override
static bool sort_y(const std::pair< Point, Elem * > &lhs, const std::pair< Point, Elem * > &rhs)
Helper function which sorts by the vertex average's y-coordinate in the internal std::sort call.
CentroidSortMethod sort_method() const
Getter for the current sorting method.
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_x(const std::pair< Point, Elem * > &lhs, const std::pair< Point, Elem * > &rhs)
Helper function which sorts by the vertex average's x-coordinate in the internal std::sort call.
This is the MeshBase class.
The Partitioner class provides a uniform interface for partitioning algorithms.
The libMesh namespace provides an interface to certain functionality in the library.
PartitionerType
Defines an enum for mesh partitioner types.
The definition of the element_iterator struct.