Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
NumRelationshipManagers.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 // MOOSE includes
12 #include "RelationshipManager.h"
13 #include "MooseApp.h"
14 
16 
19 {
21  MooseEnum rm_type("GEOMETRIC ALGEBRAIC COUPLING ALL", "ALL");
22  params.addParam<MooseEnum>(
23  "rm_type",
24  rm_type,
25  "The type of relationship managers to include in the relationship manager count");
26 
27  params.addClassDescription("Return the number of relationship managers active.");
28  return params;
29 }
30 
32  : GeneralPostprocessor(parameters), _rm_type(getParam<MooseEnum>("rm_type"))
33 {
34 }
35 
36 Real
38 {
39  const auto & rms = _app.relationshipManagers();
40 
41  if (_rm_type == "ALL")
42  return rms.size();
43 
44  unsigned int count = 0;
45  if (_rm_type == "GEOMETRIC")
46  {
47  for (const auto & rm : rms)
49  ++count;
50  }
51  else if (_rm_type == "ALGEBRAIC")
52  {
53  for (const auto & rm : rms)
55  ++count;
56  }
57  else if (_rm_type == "COUPLING")
58  {
59  for (const auto & rm : rms)
61  ++count;
62  }
63  else
64  mooseError("Invalid relationship manager type ", _rm_type);
65 
66  return count;
67 }
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
const std::set< std::shared_ptr< RelationshipManager > > & relationshipManagers() const
Return the container of relationship managers.
Definition: MooseApp.h:1068
registerMooseObject("MooseApp", NumRelationshipManagers)
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:84
NumRelationshipManagers(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...