www.mooseframework.org
TopResidualDebugOutput.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef TOPRESIDUALEBUGOUTPUT_H
16 #define TOPRESIDUALEBUGOUTPUT_H
17 
18 // MOOSE includes
19 #include "PetscOutput.h"
20 
21 #include "libmesh/system.h"
22 
23 // Forward declerations
25 
26 template <>
28 
34 {
35  unsigned int _var;
36  dof_id_type _nd;
37  Real _residual;
38  bool _is_scalar;
39 
40  TopResidualDebugOutputTopResidualData() : _var(0), _nd(0), _residual(0.), _is_scalar(false) {}
41 
43  dof_id_type nd,
44  Real residual,
45  bool is_scalar = false)
46  : _var(var), _nd(nd), _residual(residual), _is_scalar(is_scalar)
47  {
48  }
49 };
50 
57 {
58 public:
63  TopResidualDebugOutput(const InputParameters & parameters);
64 
65 protected:
69  virtual void output(const ExecFlagType & type) override;
70 
76  void printTopResiduals(const NumericVector<Number> & residual, unsigned int n);
77 
84  {
85  return (fabs(i._residual) > fabs(j._residual));
86  }
87 
89  unsigned int _num_residuals;
90 
92  System & _sys;
93 };
94 
95 #endif // TOPRESIDUALDEBUGOUTPUT_H
static bool sortTopResidualData(TopResidualDebugOutputTopResidualData i, TopResidualDebugOutputTopResidualData j)
Method for sorting the residuals data from TopResidualDebugOutputTopResidualData structs.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
A class for producing various debug related outputs.
System & _sys
Reference to libMesh system.
TopResidualDebugOutputTopResidualData(unsigned int var, dof_id_type nd, Real residual, bool is_scalar=false)
InputParameters validParams< TopResidualDebugOutput >()
A structure for storing data related to top residuals.
MatType type
PetscInt n
ExecFlagType
Execution flags - when is the object executed/evaluated.
Definition: MooseTypes.h:90
Adds the ability to output on every nonlinear and/or linear residual.
Definition: PetscOutput.h:30
unsigned int _num_residuals
Number of residuals to display.