13#include "libmesh/mesh_base.h"
14#include "libmesh/elem.h"
24 "Divide the mesh by increasing subdomain ids. The division will be contiguously "
25 "numbered even if the subdomain ids are not");
42 const auto & subdomain_ids =
blockIDs();
45 for (
const auto sub_id : subdomain_ids)
54 for (
const auto sub_id : subdomain_ids)
77 std::set<const Elem *> candidates;
78 (*pl)(pt, candidates);
81 const Elem * elem =
nullptr;
83 for (
const auto elem_ptr : candidates)
84 if (elem_ptr->subdomain_id() < min_sub_id)
87 min_sub_id = elem_ptr->subdomain_id();
registerMooseObject("MooseApp", SubdomainsDivision)
An interface that restricts an object to subdomains via the 'blocks' input parameter.
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted,...
virtual bool blockRestricted() const
Returns true if this object has been restricted to a block.
const std::vector< SubdomainName > & blocks() const
Return the block names for this object.
static InputParameters validParams()
Base class for MeshDivision objects.
static InputParameters validParams()
Class constructor.
void setNumDivisions(const unsigned int ndivs)
Set the number of divisions.
const MooseMesh & _mesh
Mesh that is being divided.
bool _mesh_fully_indexed
Whether the mesh is fully covered / indexed, all elements and points have a valid index.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
Divides the mesh based on the subdomains.
virtual unsigned int divisionIndex(const Point &pt) const override
Return the index of the division to which the point belongs.
std::unordered_map< SubdomainID, unsigned int > _subdomain_ids_to_division_index
Map from subdomain ids to division index. Created on calls to initialize()
static InputParameters validParams()
SubdomainsDivision(const InputParameters ¶meters)
virtual void initialize() override
Set up any data members that would be necessary to obtain the division indices.
unsigned int INVALID_DIVISION_INDEX
Invalid subdomain id to return when outside the mesh division.
const SubdomainID INVALID_BLOCK_ID