www.mooseframework.org
SolutionHistory.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "SolutionHistory.h"
12 #include "NonlinearSystemBase.h"
13 #include "FEProblem.h"
14 
15 #include <fstream>
16 
18 
19 template <>
22 {
23  // Get the parameters from the parent object
25  params.addClassDescription("Output for the nonlinear solution history.");
26 
27  // Return the parameters
28  return params;
29 }
30 
31 SolutionHistory::SolutionHistory(const InputParameters & parameters) : FileOutput(parameters) {}
32 
33 std::string
35 {
36  return _file_base + ".slh";
37 }
38 
39 void
41 {
42  // Reference to the Non-linear System
44 
45  std::ofstream slh_file;
46  slh_file.open(filename().c_str(), std::ios::app);
47  if (slh_file.fail())
48  mooseError("Unable to open file ", filename());
49 
50  slh_file << nl_sys._current_nl_its;
51 
52  for (const auto & linear_its : nl_sys._current_l_its)
53  slh_file << " " << linear_its;
54 
55  slh_file << std::endl;
56 }
InputParameters validParams< SolutionHistory >()
NonlinearSystemBase & getNonlinearSystemBase()
SolutionHistory(const InputParameters &parameters)
Class constructor.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::string _file_base
The base filename from the input paramaters.
Definition: FileOutput.h:81
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
Nonlinear system to be solved.
std::vector< unsigned int > _current_l_its
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
Definition: Output.h:167
virtual void output(const ExecFlagType &type) override
Output the data to *.slh file.
virtual std::string filename() override
The filename for the output file.
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:21
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
InputParameters validParams< FileOutput >()
Definition: FileOutput.C:23
registerMooseObject("MooseApp", SolutionHistory)
An outputter with filename support.
Definition: FileOutput.h:26
Based class for adding basic filename support to output base class.