12#include "libmesh/elem.h"
21 params.
addRequiredParam<std::vector<MeshDivisionName>>(
"divisions",
"Nested divisions");
27 for (
const auto & div_name : getParam<std::vector<MeshDivisionName>>(
"divisions"))
30 paramError(
"divisions",
"You cannot pass an empty vector of divisions");
53 if (!division->coversEntireMesh())
63 unsigned int index = 0;
64 unsigned int running_product = 1;
68 index +=
_divisions[N_divs - 1 - i]->divisionIndex(elem) * running_product;
69 running_product *=
_num_divs[N_divs - 1 - i];
77 unsigned int index = 0;
78 unsigned int running_product = 1;
82 index +=
_divisions[N_divs - 1 - i]->divisionIndex(pt) * running_product;
83 running_product *=
_num_divs[N_divs - 1 - i];
registerMooseObject("MooseApp", NestedDivision)
MeshDivision & getMeshDivision(const std::string &name, const THREAD_ID tid=0) const
Get a MeshDivision.
Base class for MeshDivision objects.
static InputParameters validParams()
Class constructor.
const FEProblemBase *const _fe_problem
Pointer to the problem, needed to retrieve pointers to various objects.
void setNumDivisions(const unsigned int ndivs)
Set the number of divisions.
bool _mesh_fully_indexed
Whether the mesh is fully covered / indexed, all elements and points have a valid index.
const std::string & name() const
Get the name of the class.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Divides the mesh based on nested divisions.
NestedDivision(const InputParameters ¶meters)
static InputParameters validParams()
virtual void initialize() override
Set up any data members that would be necessary to obtain the division indices.
std::vector< const MeshDivision * > _divisions
Vector of nested divisions. Indexing is more and more 'inner' as we progress in the vector.
virtual unsigned int divisionIndex(const Point &pt) const override
Return the index of the division to which the point belongs.
std::vector< unsigned int > _num_divs
Vector of the number of divisions for each nested division.