15 #include "libmesh/elem.h" 27 params.
addParam<Point>(
"center",
"Center of the sphere");
28 params.
addParam<PositionsName>(
"center_positions",
"Positions of the centers of the spheres");
32 "r_min", 0,
"r_min>=0",
"Minimum radial coordinate (for a hollow sphere)");
37 "n_radial",
"n_radial>0",
"Number of divisions in the sphere radial direction");
39 params.
addParam<
bool>(
"assign_domain_outside_grid_to_border",
41 "Whether to map the domain outside the grid back to the border of the grid " 42 "(radially or axially)");
49 _center(isParamValid(
"center") ? &getParam<Point>(
"center") : nullptr),
51 isParamValid(
"center_positions")
52 ? &_fe_problem->getPositionsObject(getParam<PositionsName>(
"center_positions"))
54 _min_r(getParam<
Real>(
"r_min")),
55 _max_r(getParam<
Real>(
"r_max")),
56 _n_radial(getParam<unsigned
int>(
"n_radial")),
57 _outside_grid_counts_as_border(getParam<bool>(
"assign_domain_outside_grid_to_border"))
63 paramError(
"center",
"You must pass a parameter for the center of the spherical frame");
67 paramError(
"r_min",
"Maximum radius must be larger than minimum radius");
71 paramError(
"n_radial",
"Zero-thickness sphere cannot be subdivided radially");
91 "Spherical grids centered on the positions are too close to each other (min distance: ",
93 "), closer than the radial extent of each grid. Mesh division is ill-defined");
115 unsigned int offset = 0;
123 offset = nearest_center_index *
_n_radial;
144 "Querying the division index for a point of a boundary between two regions radially: " +
146 if (border_r >= pc(0))
148 ir = jr > 0 ? jr - 1 : 0;
161 mooseAssert(ir != not_found,
"We should have found a mesh division bin radially");
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 Real _min_r
Minimal radial extent of the sphere.
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 Real _max_r
Maximal radial extent of the sphere.
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
const bool _outside_grid_counts_as_border
Whether to map outside the grid onto the inner/outer shells (radially)
const Point *const _center
Point at the center of the sphere, serving as the coordinate frame center.
virtual unsigned int divisionIndex(const Point &pt) const override
Return the index of the division to which the point belongs.
SphericalGridDivision(const InputParameters ¶meters)
const Point & getPosition(unsigned int index, bool initial) const
Getter for a single position at a known index.
const unsigned int _n_radial
Number of divisions in the radial direction.
Base class for MeshDivision objects.
virtual void initialize() override
Set up any data members that would be necessary to obtain the division indices.
unsigned int getNearestPositionIndex(const Point &target, bool initial) const
Find the nearest Position index for a given point.
bool absoluteFuzzyLessThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether a variable is less than another variable within an absolute tolerance...
unsigned int getNumPositions(bool initial=false) const
}
std::string stringify(const T &t)
conversion to string
unsigned int INVALID_DIVISION_INDEX
Invalid subdomain id to return when outside the mesh division.
Divides the mesh based on a spherical grid.
const Positions *const _center_positions
Positions giving all the centers of the spheres, serving as the coordinate frame center.
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
const FEProblemBase *const _fe_problem
Pointer to the problem, needed to retrieve pointers to various objects.
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
IntRange< T > make_range(T beg, T end)
bool absoluteFuzzyGreaterEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether a variable is greater than or equal to another variable within an absolute ...
Real getMinDistanceBetweenPositions() const
Find the minimum distance between positions.
static InputParameters validParams()
Class constructor.
void ErrorVector unsigned int
bool absoluteFuzzyGreaterThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether a variable is greater than another variable within an absolute tolerance...
registerMooseObject("MooseApp", SphericalGridDivision)
static InputParameters validParams()
const ExecFlagType EXEC_INITIAL