21 "Positions object. The last Positions is distributed over all the Positions prior in the " 25 params.
set<
bool>(
"auto_sort") =
false;
27 params.
set<
bool>(
"auto_broadcast") =
false;
32 "Distribute positions, using translations, over one or more positions");
39 const auto & base_names = getParam<std::vector<PositionsName>>(
"positions");
40 for (
const auto & base_name : base_names)
46 " has not been created yet. If it exists, re-order Positions in the input " 47 "file or implement automated construction ordering");
63 if (!pos_obj->initialized(initial))
64 mooseError(
"Positions '", pos_obj->name(),
"' is not initialized.");
67 unsigned int n_positions = 1;
70 const auto n_pos_obj = pos_obj->getNumPositions(initial);
72 paramError(
"positions",
"Positions " + pos_obj->name() +
" has 0 positions.");
73 n_positions *= pos_obj->getNumPositions(initial);
79 unsigned int current_index = 1;
86 for (
const auto & translation : current_positions->getPositions(initial))
87 _positions[i + (j++) * current_index] += translation;
89 current_index *= current_positions->getNumPositions(initial);
A MultiMooseEnum object to hold "execute_on" flags.
DistributedPositions(const InputParameters ¶meters)
static InputParameters validParams()
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 ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
void clearPositions()
Clear all positions vectors.
Positions objects are under the hood Reporters.
bool hasUserObject(const std::string &name) const
Check if there if a user object of given name.
const Positions & getPositionsObject(const std::string &name) const
Get the Positions object by its name.
bool _initialized
Whether the positions object has been initialized. This must be set by derived objects.
std::vector< const Positions * > _positions_objs
Pointers to positions objects that will be distributed.
const ExecFlagType EXEC_TIMESTEP_BEGIN
std::vector< Point > & _positions
For now, only the 1D vector will be shared across all ranks.
static InputParameters validParams()
virtual void initialize() override
In charge of computing / loading the positions.
const ExecFlagType EXEC_LINEAR
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
IntRange< T > make_range(T beg, T end)
virtual void finalize() override
In charge of reduction across all ranks & sorting for consistent output.
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...
registerMooseObject("MooseApp", DistributedPositions)
Positions created by distributing Positions objects onto one another.
auto index_range(const T &sizable)
const ExecFlagType EXEC_INITIAL