www.mooseframework.org
NumVars.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 // MOOSE includes
16 #include "NumVars.h"
17 
18 #include "AuxiliarySystem.h"
19 #include "NonlinearSystemBase.h"
20 #include "SubProblem.h"
21 
22 template <>
25 {
27 
28  MooseEnum system_options("nonlinear auxiliary", "nonlinear");
29  params.addParam<MooseEnum>(
30  "system", system_options, "The system for which you want to print the number of variables.");
31 
32  return params;
33 }
34 
35 NumVars::NumVars(const InputParameters & parameters)
36  : GeneralPostprocessor(parameters), _system(getParam<MooseEnum>("system"))
37 {
38 }
39 
40 Real
42 {
43  switch (_system)
44  {
45  case 0:
46  return _fe_problem.getNonlinearSystemBase().system().n_vars();
47  case 1:
48  return _fe_problem.getAuxiliarySystem().sys().n_vars();
49  }
50 
51  mooseError("Unknown system type!");
52 }
virtual Real getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
Definition: NumVars.C:41
NonlinearSystemBase & getNonlinearSystemBase()
virtual TransientExplicitSystem & sys()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< GeneralPostprocessor >()
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:37
NumVars(const InputParameters &parameters)
Definition: NumVars.C:35
AuxiliarySystem & getAuxiliarySystem()
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
Definition: UserObject.h:149
InputParameters validParams< NumVars >()
Definition: NumVars.C:24
virtual System & system() override
Get the reference to the libMesh system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
void mooseError(Args &&...args) const
Definition: MooseObject.h:80
MooseEnum _system
Definition: NumVars.h:38