https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NearestPositionsDivision.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11#include "MooseMesh.h"
12#include "Positions.h"
13
14#include "libmesh/mesh_base.h"
15#include "libmesh/elem.h"
16
18
21{
23 params.addClassDescription("Divide the mesh using a nearest-point / voronoi algorithm, with the "
24 "points coming from a Positions object");
25 params.addRequiredParam<PositionsName>(
26 "positions", "The name of the Positions object to form the nearest-neighbor division with");
27 return params;
28}
29
31 : MeshDivision(parameters),
32 _nearest_positions_obj(&_fe_problem->getPositionsObject(getParam<PositionsName>("positions")))
33{
36}
37
38void
43
44unsigned int
46{
47 const bool initial = _fe_problem->getCurrentExecuteOnFlag() == EXEC_INITIAL;
48 return _nearest_positions_obj->getNearestPositionIndex(elem.vertex_average(), initial);
49}
50
51unsigned int
53{
54 const bool initial = _fe_problem->getCurrentExecuteOnFlag() == EXEC_INITIAL;
56}
const ExecFlagType EXEC_INITIAL
Definition Moose.C:30
registerMooseObject("MooseApp", NearestPositionsDivision)
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
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.
Divides the mesh based on a nearest-neighbor algorithm applied to the positions from a Positions obje...
static InputParameters validParams()
virtual void initialize() override
Set up any data members that would be necessary to obtain the division indices.
NearestPositionsDivision(const InputParameters &parameters)
virtual unsigned int divisionIndex(const Point &pt) const override
Return the index of the division to which the point belongs.
const Positions *const _nearest_positions_obj
unsigned int getNearestPositionIndex(const Point &target, bool initial) const
Find the nearest Position index for a given point.
Definition Positions.C:96
unsigned int getNumPositions(bool initial=false) const
}
Definition Positions.h:37