Go to the documentation of this file.
19 #ifndef LIBMESH_CENTROID_PARTITIONER_H
20 #define LIBMESH_CENTROID_PARTITIONER_H
23 #include "libmesh/partitioner.h"
24 #include "libmesh/point.h"
25 #include "libmesh/auto_ptr.h"
83 virtual std::unique_ptr<Partitioner>
clone ()
const override
85 return libmesh_make_unique<CentroidPartitioner>(*
this);
104 const unsigned int n)
override;
112 const unsigned int n)
override;
126 static bool sort_x (
const std::pair<Point, Elem *> & lhs,
127 const std::pair<Point, Elem *> & rhs);
133 static bool sort_y (
const std::pair<Point, Elem *> & lhs,
134 const std::pair<Point, Elem *> & rhs);
140 static bool sort_z (
const std::pair<Point, Elem *> & lhs,
141 const std::pair<Point, Elem *> & rhs);
147 static bool sort_radial (
const std::pair<Point, Elem *> & lhs,
148 const std::pair<Point, Elem *> & rhs);
164 #endif // LIBMESH_CENTROID_PARTITIONER_H
The definition of the element_iterator struct.
CentroidPartitioner(const CentroidSortMethod sm=X)
Constructor.
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.
CentroidPartitioner & operator=(const CentroidPartitioner &)=default
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.
The Partitioner class provides a uniform interface for partitioning algorithms.
void compute_centroids(MeshBase::element_iterator it, MeshBase::element_iterator end)
Computes a list of element centroids for the mesh.
CentroidSortMethod
A typedef which controls the sorting method used for ordering the centroids.
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...
virtual ~CentroidPartitioner()=default
Partitions the Mesh based on the locations of element centroids.
This is the MeshBase class.
CentroidSortMethod _sort_method
Flag indicating the type of sort method we are using.
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.
virtual std::unique_ptr< Partitioner > clone() const override
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.
void set_sort_method(const CentroidSortMethod sm)
Setter for the current sorting method.
virtual void _do_partition(MeshBase &mesh, const unsigned int n) override
Partitions the mesh into n subdomains.