Line data Source code
1 : #include "ThresholdHeuristicUserObject.h" 2 : 3 : registerMooseObject("CardinalApp", ThresholdHeuristicUserObject); 4 : 5 : InputParameters 6 24 : ThresholdHeuristicUserObject::validParams() 7 : { 8 : 9 24 : InputParameters params = ClusteringUserObjectBase::validParams(); 10 48 : params.addRequiredParam<double>("threshold", 11 : " The value against which the clustering process is compared."); 12 48 : params.addParam<bool>("cluster_if_above_threshold", 13 48 : true, 14 : " Cluster elements if the value is more than the threshold"); 15 24 : params.addClassDescription( 16 : "Clusters elements whose values are less/more than a specified threshold."); 17 : 18 24 : return params; 19 0 : } 20 : 21 12 : ThresholdHeuristicUserObject::ThresholdHeuristicUserObject(const InputParameters & parameters) 22 : : ClusteringUserObjectBase(parameters), 23 12 : _threshold(getParam<double>("threshold")), 24 36 : _cluster_if_above_threshold(getParam<bool>("cluster_if_above_threshold")) 25 : { 26 12 : } 27 : 28 : bool 29 4320 : ThresholdHeuristicUserObject::evaluate(libMesh::Elem * elem, libMesh::Elem * neighbor_elem) const 30 : { 31 : 32 4320 : return _cluster_if_above_threshold 33 4320 : ? ((getMetricData(elem) > _threshold && getMetricData(neighbor_elem) > _threshold)) 34 2160 : : ((getMetricData(elem) < _threshold && getMetricData(neighbor_elem) < _threshold)); 35 : }