Line data Source code
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 : // MOOSE includes 11 : #include "NumPositions.h" 12 : #include "Positions.h" 13 : 14 : registerMooseObject("MooseApp", NumPositions); 15 : 16 : InputParameters 17 14361 : NumPositions::validParams() 18 : { 19 14361 : InputParameters params = GeneralPostprocessor::validParams(); 20 14361 : params.addRequiredParam<PositionsName>("positions", "Positions to count the number of"); 21 : 22 14361 : params.addClassDescription("Return the number of Positions from a Positions object."); 23 14361 : return params; 24 0 : } 25 : 26 48 : NumPositions::NumPositions(const InputParameters & parameters) 27 : : GeneralPostprocessor(parameters), 28 48 : _positions(_fe_problem.getPositionsObject(getParam<PositionsName>("positions"))) 29 : { 30 48 : } 31 : 32 : Real 33 44 : NumPositions::getValue() const 34 : { 35 44 : if (_fe_problem.getCurrentExecuteOnFlag() == EXEC_INITIAL) 36 0 : return _positions.getPositions(/*initial=*/true).size(); 37 : else 38 44 : return _positions.getPositions(/*initial=*/false).size(); 39 : }