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;
83 for (
const auto i : make_range(current_index))
86 for (
const auto & translation : current_positions->getPositions(initial))
87 _positions[i + (j++) * current_index] += translation;
89 current_index *= current_positions->getNumPositions(initial);
registerMooseObject("MooseApp", DistributedPositions)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_TIMESTEP_BEGIN
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_LINEAR
Positions created by distributing Positions objects onto one another.
DistributedPositions(const InputParameters ¶meters)
virtual void initialize() override
In charge of computing / loading the positions.
std::vector< const Positions * > _positions_objs
Pointers to positions objects that will be distributed.
static InputParameters validParams()
A MultiMooseEnum object to hold "execute_on" flags.
const Positions & getPositionsObject(const std::string &name) const
Get the Positions object by its name.
bool hasUserObject(const std::string &name) const
Check if there if a user object of given name.
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
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 ...
Positions objects are under the hood Reporters.
void clearPositions()
Clear all positions vectors.
std::vector< Point > & _positions
For now, only the 1D vector will be shared across all ranks.
static InputParameters validParams()
virtual void finalize() override
In charge of reduction across all ranks & sorting for consistent output.
bool _initialized
Whether the positions object has been initialized. This must be set by derived objects.
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.