14 #include "libmesh/mesh_base.h" 15 #include "libmesh/elem.h" 24 "Divide the mesh along based on uniformly binned values of a functor.");
28 "num_bins",
"num_bins>0",
"Number of uniform bins in functor values");
30 "functor",
"Functor to evaluate to assign points/elements to the bins");
31 params.
addParam<
bool>(
"assign_out_of_bounds_to_extreme_bins",
33 "Whether to map functor values outside of the [min,max] range to the " 34 "lowest and highest bins, or to use the invalid division index");
42 _min(getParam<
Real>(
"min_value")),
43 _max(getParam<
Real>(
"max_value")),
44 _nbins(getParam<unsigned
int>(
"num_bins")),
45 _functor(getFunctor<
Real>(
"functor")),
46 _oob_is_edge_bins(getParam<bool>(
"assign_out_of_bounds_to_extreme_bins"))
49 paramError(
"max_value",
"Maximum value should be above minimum value.");
90 if (
value < border_value)
91 return (i_bin > 0) ? i_bin - 1 : 0;
111 std::set<const Elem *> candidates;
112 (*pl)(pt, candidates);
115 const Elem * elem =
nullptr;
117 for (
const auto elem_ptr : candidates)
118 if (elem_ptr->id() < min_elem_id)
121 min_elem_id = elem_ptr->id();
124 mooseError(
"Division index queried for a point outside the local mesh");
An interface for accessing Moose::Functors for systems that do not care about automatic differentiati...
unsigned int getBinIndex(Real value, const Point &pt) const
Get the bin for that functor value.
Divides the mesh based on the binned values of a functor.
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
const unsigned int invalid_uint
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 ...
const unsigned int _nbins
Number of value bins.
static InputParameters validParams()
A structure that is used to evaluate Moose functors at an arbitrary physical point contained within a...
Base class for MeshDivision objects.
virtual void initialize() override
Set up any data members that would be necessary to obtain the division indices.
const MooseMesh & _mesh
Mesh that is being divided.
const Real _max
Max functor bin value.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
const Moose::Functor< Real > & _functor
Functor to use to subdivide the mesh.
virtual unsigned int divisionIndex(const Point &pt) const override
Return the index of the division to which the point belongs.
const Real _min
Min functor bin value.
A structure that is used to evaluate Moose functors logically at an element/cell center.
std::string stringify(const T &t)
conversion to string
unsigned int INVALID_DIVISION_INDEX
Invalid subdomain id to return when outside the mesh division.
bool _mesh_fully_indexed
Whether the mesh is fully covered / indexed, all elements and points have a valid index...
void setNumDivisions(const unsigned int ndivs)
Set the number of divisions.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
FunctorBinnedValuesDivision(const InputParameters ¶meters)
bool absoluteFuzzyLessEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether a variable is less than or equal to another variable within an absolute tol...
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
IntRange< T > make_range(T beg, T end)
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...
State argument for evaluating functors.
const bool _oob_is_edge_bins
Whether to map functor values outside [min, max] onto the edge bins.
registerMooseObject("MooseApp", FunctorBinnedValuesDivision)
static InputParameters validParams()
Class constructor.
void ErrorVector unsigned int