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 "SolutionContainer.h" 11 : #include "NonlinearSystemBase.h" 12 : 13 : registerMooseObject("StochasticToolsApp", SolutionContainer); 14 : 15 : InputParameters 16 1940 : SolutionContainer::validParams() 17 : { 18 1940 : InputParameters params = SnapshotContainerBase::validParams(); 19 1940 : params.addClassDescription( 20 : "Class responsible for collecting distributed solution vectors into a container. We append " 21 : "a new distributed solution vector (containing all variables) at every execution."); 22 3880 : MooseEnum system_type("nonlinear aux", "nonlinear"); 23 3880 : params.addParam<MooseEnum>( 24 : "system", system_type, "The system whose solution should be collected."); 25 : 26 1940 : return params; 27 1940 : } 28 : 29 970 : SolutionContainer::SolutionContainer(const InputParameters & parameters) 30 1940 : : SnapshotContainerBase(parameters), _system_type(getParam<MooseEnum>("system")) 31 : { 32 2910 : if (isParamSetByUser("nonlinear_system_name") && _system_type == "aux") 33 0 : paramError("nonlinear_system_name", 34 : "This should not be set when 'system_type' is 'aux'. This parameter is only " 35 : "applicable to nonlinear systems."); 36 970 : } 37 : 38 : std::unique_ptr<NumericVector<Number>> 39 1480 : SolutionContainer::collectSnapshot() 40 : { 41 1480 : std::unique_ptr<NumericVector<Number>> cloned_solution; 42 : 43 : // Clone the current solution 44 1480 : if (_system_type == "nonlinear") 45 : cloned_solution = 46 2480 : _fe_problem.getNonlinearSystemBase(_nonlinear_system_number).solution().clone(); 47 : else 48 720 : cloned_solution = _fe_problem.systemBaseAuxiliary().solution().clone(); 49 : 50 1480 : return cloned_solution; 51 0 : }