20 "Create positions along a hexagonal grid. Numbering of positions increases first " 21 "counterclockwise, then expanding outwards from the inner ring. " 22 "Inner-numbering is within a radial ring.");
26 "lattice_flat_to_flat",
27 "lattice_flat_to_flat>0",
28 "Distance between two (inner) opposite sides of a lattice. Also known as bundle pitch or " 29 "inner flat-to-flat distance");
34 "Rotation angle to apply to the underlying hexagonal lattice (in degrees)");
40 "A double-indexed hexagonal-shaped array starting with the upper-left corner. '-1's are not " 41 "selected as positions.");
42 params.
addParam<std::vector<unsigned int>>(
43 "include_in_pattern", {},
"A vector of the numbers in the pattern to include");
44 params.
addParam<std::vector<std::vector<int>>>(
47 "A double-indexed hexagonal-shaped array with the index of other Positions objects starting " 48 "with the upper-left corner. These positions objects will be distributed within the " 49 "hexagonal grid. The indexing is given in 'positions_pattern_indexing'. Use '-1' to discard " 50 "a position in the lattice.");
51 params.
addParam<std::map<std::string, unsigned int>>(
52 "positions_pattern_indexing",
54 "A map from the name of positions objects to their index in the 'positions_pattern'");
57 params.
set<
bool>(
"auto_sort") =
false;
59 params.
set<
bool>(
"auto_broadcast") =
false;
66 _center(getParam<Point>(
"center")),
67 _lattice_flat_to_flat(getParam<
Real>(
"lattice_flat_to_flat")),
68 _pin_pitch(getParam<
Real>(
"pin_pitch")),
70 _nr(getParam<unsigned
int>(
"nr")),
71 _pattern(getParam<
std::vector<
std::vector<unsigned
int>>>(
"pattern")),
73 std::set<unsigned
int>(getParam<
std::vector<unsigned
int>>(
"include_in_pattern").begin(),
74 getParam<
std::vector<unsigned
int>>(
"include_in_pattern").end())),
75 _positions_pattern(getParam<
std::vector<
std::vector<
int>>>(
"positions_pattern")),
76 _positions_pattern_indexing(
77 getParam<
std::map<
std::string, unsigned
int>>(
"positions_pattern_indexing"))
84 "For one ring, the lattice flat to flat must be at least the pin pitch");
91 "Lattice flat to flat distance is less than the minimum (3 * nr - 1) * pin_pitch " 92 "/ sqrt(3) given nr rings with a pitch of pin_pitch");
100 "The 'pattern' parameter and the 'include_in_pattern' must be both specified or both not " 101 "specified by the user.");
106 if (std::find(row.begin(), row.end(), include) != row.end())
110 "Pattern item '" + std::to_string(include) +
111 "' to include is not present in the pattern");
118 "The 'positions_pattern' parameter and the 'positions_pattern_indexing' must be " 119 "both specified or both not specified by the user.");
124 if (std::find(row.begin(), row.end(), index) != row.end())
128 "Pattern item '" + pos_name +
"' with index '" + std::to_string(index) +
129 "' to include is not present in the pattern");
137 "'pattern'/'include_in_pattern' are not supported in combination with " 138 "'positions_pattern/positions_pattern_indexing'. Only one pattern is supported");
159 getParam<Real>(
"rotation_around_axis"));
164 std::vector<int> pattern_unrolled;
169 std::size_t pattern_size = 0;
171 pattern_size += row.size();
172 if (
_pattern.size() != cast_int<std::size_t>(2 *
_nr - 1))
175 ") should be equal to twice the number of hexagonal rings minus one");
179 ") does not match the number of pins with ",
190 unsigned int row_i, within_row_i;
191 _hex_latt->get2DInputPatternIndex(i, row_i, within_row_i);
192 pattern_unrolled[i++] =
_pattern[row_i][within_row_i];
200 unsigned int n_exclusions = 0;
202 for (
const auto patt : pattern_unrolled)
207 const auto n_positions = cast_int<std::size_t>(
_hex_latt->totalPins(
_nr) - n_exclusions);
212 unsigned int pos_i = 0;
213 for (
const auto patt_i :
index_range(pattern_unrolled))
224 unsigned pattern_size = 0;
226 pattern_size += row.size();
228 mooseError(
"Number of rows in 'positions_pattern' (",
230 ") should be equal to twice the number of hexagonal rings minus one");
234 " does not match the number of pins with ",
240 unsigned num_pos = 0;
247 std::map<unsigned int, PositionsName> index_to_pos;
249 index_to_pos[index] = pos_name;
252 std::vector<PositionsName> pattern_unrolled;
259 unsigned int row_i, within_row_i;
260 _hex_latt->get2DInputPatternIndex(i, row_i, within_row_i);
262 if (
auto it = index_to_pos.find(cast_int<unsigned int>(pos_index));
263 it != index_to_pos.end())
264 pattern_unrolled[i++] = it->second;
265 else if (pos_index != -1)
267 "Index '" + std::to_string(pos_index) +
268 "' in pattern is not found in 'positions_pattern_indexing'");
270 pattern_unrolled[i++] =
"-1";
274 for (
const auto patt_i :
index_range(pattern_unrolled))
276 const auto & pos_name = pattern_unrolled[patt_i];
277 if (pos_name !=
"-1")
static InputParameters validParams()
const Real _pin_pitch
Pitch between fuel pins.
std::map< std::string, unsigned int > _positions_pattern_indexing
Indexing of the positions objects in the pattern.
void paramError(const std::string ¶m, Args... args) const
void initialize() override
const ExecFlagType & getCurrentExecuteOnFlag() const
const Real _lattice_flat_to_flat
Distance from one side to the one facing it of the lattice.
Creates positions (points) following an hexagonal grid.
bool hasUserObject(const std::string &name) const
const Positions & getPositionsObject(const std::string &name) const
std::vector< std::vector< int > > _positions_pattern
List of positions objects, the positions of which are translated in the parent hexagonal pattern...
std::set< unsigned int > _include_in_pattern
List of the pattern locations to include. Include all if empty.
HexagonalGridPositions(const InputParameters ¶meters)
void libmesh_ignore(const Args &...)
const MooseEnum _z_axis_index
Axial component for the Z axis.
std::unique_ptr< HexagonalLatticeUtils > _hex_latt
Hexagonal lattice utility object.
registerMooseObject("ReactorApp", HexagonalGridPositions)
std::vector< Point > & _positions
unsigned int getNumPositions(bool initial=false) const
const std::vector< Point > & getPositions(bool initial) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
FEProblemBase & _fe_problem
IntRange< T > make_range(T beg, T end)
virtual void finalize() override
void mooseError(Args &&... args) const
static InputParameters validParams()
std::vector< std::vector< unsigned int > > _pattern
2D pattern of the pins to select (if specified)
bool isParamSetByUser(const std::string &name) const
void ErrorVector unsigned int
auto index_range(const T &sizable)
bool absoluteFuzzyGreaterThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
const ExecFlagType EXEC_INITIAL
const unsigned int _nr
Number of rings in the radial direction.