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 : #include "AdaptiveSamplingCompletedPostprocessor.h" 11 : 12 : #include "Sampler.h" 13 : 14 : registerMooseObject("StochasticToolsApp", AdaptiveSamplingCompletedPostprocessor); 15 : 16 : InputParameters 17 292 : AdaptiveSamplingCompletedPostprocessor::validParams() 18 : { 19 292 : InputParameters params = GeneralPostprocessor::validParams(); 20 584 : params.addRequiredParam<SamplerName>( 21 : "sampler", "Sampler for which we want to know if the sampling has been completed."); 22 292 : params.addClassDescription( 23 : "Informs whether a sampler has finished its sampling (1 = completed, 0 otherwise)."); 24 292 : return params; 25 0 : } 26 : 27 146 : AdaptiveSamplingCompletedPostprocessor::AdaptiveSamplingCompletedPostprocessor( 28 146 : const InputParameters & parameters) 29 146 : : GeneralPostprocessor(parameters), _sampler(getSampler("sampler")), _sampling_completed(0) 30 : { 31 146 : } 32 : 33 : void 34 3428 : AdaptiveSamplingCompletedPostprocessor::execute() 35 : { 36 3428 : _sampling_completed = _sampler.isAdaptiveSamplingCompleted(); 37 3428 : } 38 : 39 : void 40 3428 : AdaptiveSamplingCompletedPostprocessor::finalize() 41 : { 42 3428 : gatherMax(_sampling_completed); 43 3428 : } 44 : 45 : Real 46 3428 : AdaptiveSamplingCompletedPostprocessor::getValue() const 47 : { 48 3428 : return _sampling_completed; 49 : }