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 "NumRelationshipManagers.h" 12 : #include "RelationshipManager.h" 13 : #include "MooseApp.h" 14 : 15 : registerMooseObject("MooseApp", NumRelationshipManagers); 16 : 17 : InputParameters 18 14367 : NumRelationshipManagers::validParams() 19 : { 20 14367 : InputParameters params = GeneralPostprocessor::validParams(); 21 14367 : MooseEnum rm_type("GEOMETRIC ALGEBRAIC COUPLING ALL", "ALL"); 22 14367 : params.addParam<MooseEnum>( 23 : "rm_type", 24 : rm_type, 25 : "The type of relationship managers to include in the relationship manager count"); 26 : 27 14367 : params.addClassDescription("Return the number of relationship managers active."); 28 28734 : return params; 29 14367 : } 30 : 31 51 : NumRelationshipManagers::NumRelationshipManagers(const InputParameters & parameters) 32 51 : : GeneralPostprocessor(parameters), _rm_type(getParam<MooseEnum>("rm_type")) 33 : { 34 51 : } 35 : 36 : Real 37 46 : NumRelationshipManagers::getValue() const 38 : { 39 46 : const auto & rms = _app.relationshipManagers(); 40 : 41 46 : if (_rm_type == "ALL") 42 35 : return rms.size(); 43 : 44 11 : unsigned int count = 0; 45 11 : if (_rm_type == "GEOMETRIC") 46 : { 47 33 : for (const auto & rm : rms) 48 22 : if (rm->isType(Moose::RelationshipManagerType::GEOMETRIC)) 49 22 : ++count; 50 : } 51 0 : else if (_rm_type == "ALGEBRAIC") 52 : { 53 0 : for (const auto & rm : rms) 54 0 : if (rm->isType(Moose::RelationshipManagerType::ALGEBRAIC)) 55 0 : ++count; 56 : } 57 0 : else if (_rm_type == "COUPLING") 58 : { 59 0 : for (const auto & rm : rms) 60 0 : if (rm->isType(Moose::RelationshipManagerType::COUPLING)) 61 0 : ++count; 62 : } 63 : else 64 0 : mooseError("Invalid relationship manager type ", _rm_type); 65 : 66 11 : return count; 67 : }