25 "nx",
"nx>0",
"Number of points in the X direction");
27 "ny",
"ny>0",
"Number of points in the Y direction");
29 "nz",
"nz>0",
"Number of points in the Z direction");
36 "A double-indexed Cartesian-shaped array starting with the upper-left corner.");
37 params.
addParam<std::vector<unsigned int>>(
38 "include_in_pattern", {},
"A vector of the numbers in the pattern to include");
41 params.
set<
bool>(
"auto_sort") =
false;
43 params.
set<
bool>(
"auto_broadcast") =
false;
50 _center(getParam<Point>(
"center")),
51 _dx(getParam<
Real>(
"dx")),
52 _dy(getParam<
Real>(
"dy")),
53 _dz(getParam<
Real>(
"dz")),
54 _nx(getParam<unsigned
int>(
"nx")),
55 _ny(getParam<unsigned
int>(
"ny")),
56 _nz(getParam<unsigned
int>(
"nz")),
57 _pattern(getParam<
std::vector<
std::vector<
std::vector<unsigned
int>>>>(
"pattern")),
59 std::set<unsigned
int>(getParam<
std::vector<unsigned
int>>(
"include_in_pattern").begin(),
60 getParam<
std::vector<unsigned
int>>(
"include_in_pattern").end()))
66 "The 'pattern' parameter and the include_in_pattern must be both specified or both not " 67 "specified by the user.");
76 if (std::find(row.begin(), row.end(), include) != row.end())
81 "Pattern item " + std::to_string(include) +
82 " to include is not present in the pattern");
90 if (column.size() !=
_ny)
91 mooseError(
"Wrong pattern size in Y direction: ", column.size());
93 for (
const auto & row : column)
94 if (row.size() !=
_nx)
95 mooseError(
"Wrong pattern size in X direction: ", row.size());
110 unsigned int n_exclusions = 0;
117 const auto n_positions =
_nx *
_ny *
_nz - n_exclusions;
122 unsigned int pos_i = 0;
130 _dy / 2 * ((2. * iy + 1) /
_ny - 1),
131 _dz / 2 * ((2. * iz + 1) /
_nz - 1));
const unsigned int _nz
Number of points along the Z direction.
static InputParameters validParams()
std::set< unsigned int > _include_in_pattern
List of the pattern locations to include. Include all if empty.
const Real _dx
Extent of the lattice in the X direction.
registerMooseObject("ReactorApp", CartesianGridPositions)
Creates positions (points) following an Cartesian grid.
const Point _center
Center of the lattice.
CartesianGridPositions(const InputParameters ¶meters)
static InputParameters validParams()
const unsigned int _ny
Number of points along the Y direction.
const Real _dy
Extent of the lattice in the Y direction.
std::vector< Point > & _positions
const Real _dz
Extent of the lattice in the Z direction.
void paramError(const std::string ¶m, Args... args) const
void initialize() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
std::vector< std::vector< std::vector< unsigned int > > > _pattern
2D pattern of the pins to select (if specified)
virtual void finalize() override
void mooseError(Args &&... args) const
const unsigned int _nx
Number of points along the X direction.
void ErrorVector unsigned int
auto index_range(const T &sizable)