Line data Source code
1 : // MOOSE includes 2 : #include "ResponseHistoryMean.h" 3 : #include "PostprocessorInterface.h" 4 : #include "VectorPostprocessorInterface.h" 5 : #include "MastodonUtils.h" 6 : #include "ResponseHistoryBuilder.h" 7 : 8 : registerMooseObject("MastodonApp", ResponseHistoryMean); 9 : 10 : InputParameters 11 32 : ResponseHistoryMean::validParams() 12 : { 13 32 : InputParameters params = GeneralVectorPostprocessor::validParams(); 14 64 : params.addRequiredParam<VectorPostprocessorName>( 15 : "response_history", 16 : "Name of the ResponseHistoryBuilder vectorpostprocessor, for which " 17 : "response spectra are calculated."); 18 : 19 : // Make sure that csv files are created only at the final timestep 20 32 : params.set<bool>("contains_complete_history") = true; 21 32 : params.suppressParameter<bool>("contains_complete_history"); 22 : 23 96 : params.set<ExecFlagEnum>("execute_on") = {EXEC_FINAL}; 24 32 : params.suppressParameter<ExecFlagEnum>("execute_on"); 25 : 26 32 : params.addClassDescription( 27 : "Calculate the mean acceleration time series given a response history."); 28 32 : return params; 29 32 : } 30 : 31 16 : ResponseHistoryMean::ResponseHistoryMean(const InputParameters & parameters) 32 : : GeneralVectorPostprocessor(parameters), 33 16 : _builder_time(getVectorPostprocessorValue("response_history", "time")), 34 16 : _history_time(declareVector("time")), 35 16 : _history_mean(declareVector("mean")), 36 16 : _builder(getUserObjectByName<ResponseHistoryBuilder>( 37 32 : getParam<VectorPostprocessorName>("response_history"))) 38 : { 39 16 : } 40 : 41 : void 42 16 : ResponseHistoryMean::initialize() 43 : { 44 16 : } 45 : 46 : void 47 16 : ResponseHistoryMean::execute() 48 : { 49 : // Returning the times when response is recorded as an output. 50 16 : _history_time = _builder_time; 51 : 52 : // Calling the "mean" (overloaded) function to compute the mean of response histories. 53 16 : _history_mean = MastodonUtils::mean(_builder.getHistories()); 54 16 : }