https://mooseframework.inl.gov
SCMPinPositions.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 
10 #include "SCMPinPositions.h"
11 
12 registerMooseObject("SubChannelApp", SCMPinPositions);
13 
16 {
18  params.addClassDescription("Create positions at the pin positions in the SubChannel mesh.");
19 
20  // Use user-provided ordering
21  params.set<bool>("auto_sort") = false;
22  // SCM mesh only defined on process 0
23  params.set<bool>("auto_broadcast") = true;
24 
25  return params;
26 }
27 
29  : Positions(parameters), _scm_mesh(dynamic_cast<const SubChannelMesh *>(&_fe_problem.mesh()))
30 {
31  // This makes this object half as useful. We should lift this
32  if (!_scm_mesh)
33  mooseError("Can only be used with a subchannel mesh at this time.");
34 
35  // Obtain the positions from the mesh
36  initialize();
37  // Sort if needed (user-specified)
38  finalize();
39 }
40 
41 void
43 {
45  // Add the pin positions
46  for (const auto i_pin : make_range(_scm_mesh->getNumOfPins()))
47  _positions.push_back(Point(*_scm_mesh->getPinNode(i_pin, 0)));
48 
49  _initialized = true;
50 }
static InputParameters validParams()
void clearPositions()
Creates positions (points) from the pins of a subchannel mesh.
T & set(const std::string &name, bool quiet_mode=false)
MeshBase & mesh
virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const =0
Get the pin mesh node for a given pin index and elevation index.
virtual unsigned int getNumOfPins() const =0
Return the number of pins.
static InputParameters validParams()
registerMooseObject("SubChannelApp", SCMPinPositions)
bool _initialized
void initialize() override
std::vector< Point > & _positions
const SubChannelMesh *const _scm_mesh
Pointer to the subchannel mesh.
IntRange< T > make_range(T beg, T end)
virtual void finalize() override
void mooseError(Args &&... args) const
SCMPinPositions(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)
Base class for subchannel meshes.