<commit_before>/****************************************************************/
/*               DO NOT MODIFY THIS HEADER                      */
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*           (c) 2010 Battelle Energy Alliance, LLC             */
/*                   ALL RIGHTS RESERVED                        */
/*                                                              */
/*          Prepared by Battelle Energy Alliance, LLC           */
/*            Under Contract No. DE-AC07-05ID14517              */
/*            With the U. S. Department of Energy               */
/*                                                              */
/*            See COPYRIGHT for full restrictions               */
/****************************************************************/

#ifndef PETSCOUTPUTTER_H
#define PETSCOUTPUTTER_H

// MOOSE includes
#include "FileOutputter.h"

// Forward declerations
class PetscOutputter;

template<>
InputParameters validParams<PetscOutputter>();

/**
 * Adds the ability to output on every nonlinear and/or linear residual
 */
class PetscOutputter : public FileOutputter
{
public:

  /**
   * Class constructor
   * @param name Outputter name
   * @param parameters Outputter input file parameters
   */
  PetscOutputter(const std::string & name, InputParameters & parameters);

  /**
   * Class destructor
   */
  virtual ~PetscOutputter();

  /**
   * Linear residual output status
   * @return True if the output is currently being called on a linear residual evaluation
   */
  bool onLinearResidual(){ return _on_linear_residual; }

  /**
   * Non-Linear residual output status
   * @return True if the output is currently being called on a non-linear residual evaluation
   */
  bool onNonlinearResidual() { return _on_nonlinear_residual; }

  /**
   * Get the output time.
   * This outputter enables the ability to perform output on the nonlinear and linear iterations performed
   * by PETSc. To separate theses outputs within the output a pseudo time is defined, this function provides
   * this time and it should be used in place of _time from Outputter.
   */
  Real time();

protected:

  /// Current norm returned from PETSc
  PetscReal _norm;

  /// Current non-linear iteration returned from PETSc
  PetscInt _nonlinear_iter;

  /// Current linear iteration returned from PETSc
  PetscInt _linear_iter;

private:

  /**
   * Internal setup function that executes at the beginning of the time step
   */
  void timestepSetupInternal();

#ifdef LIBMESH_HAVE_PETSC
  /**
   * Performs the output on non-linear iterations<commit_msg>Removed PETSc types (closes #2665)<commit_after>/****************************************************************/
/*               DO NOT MODIFY THIS HEADER                      */
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*           (c) 2010 Battelle Energy Alliance, LLC             */
/*                   ALL RIGHTS RESERVED                        */
/*                                                              */
/*          Prepared by Battelle Energy Alliance, LLC           */
/*            Under Contract No. DE-AC07-05ID14517              */
/*            With the U. S. Department of Energy               */
/*                                                              */
/*            See COPYRIGHT for full restrictions               */
/****************************************************************/

#ifndef PETSCOUTPUTTER_H
#define PETSCOUTPUTTER_H

// MOOSE includes
#include "FileOutputter.h"

// Forward declerations
class PetscOutputter;

template<>
InputParameters validParams<PetscOutputter>();

/**
 * Adds the ability to output on every nonlinear and/or linear residual
 */
class PetscOutputter : public FileOutputter
{
public:

  /**
   * Class constructor
   * @param name Outputter name
   * @param parameters Outputter input file parameters
   */
  PetscOutputter(const std::string & name, InputParameters & parameters);

  /**
   * Class destructor
   */
  virtual ~PetscOutputter();

  /**
   * Linear residual output status
   * @return True if the output is currently being called on a linear residual evaluation
   */
  bool onLinearResidual(){ return _on_linear_residual; }

  /**
   * Non-Linear residual output status
   * @return True if the output is currently being called on a non-linear residual evaluation
   */
  bool onNonlinearResidual() { return _on_nonlinear_residual; }

  /**
   * Get the output time.
   * This outputter enables the ability to perform output on the nonlinear and linear iterations performed
   * by PETSc. To separate theses outputs within the output a pseudo time is defined, this function provides
   * this time and it should be used in place of _time from Outputter.
   */
  Real time();

protected:

  /// Current norm returned from PETSc
  Real _norm;

  /// Current non-linear iteration returned from PETSc
  int _nonlinear_iter;

  /// Current linear iteration returned from PETSc
  int _linear_iter;

private:

  /**
   * Internal setup function that executes at the beginning of the time step
   */
  void timestepSetupInternal();

#ifdef LIBMESH_HAVE_PETSC
  /**
   * Performs the output on non-linear iterations
{'fraction_non_alphanumeric': 0.11905646359583952, 'fraction_numerical': 0.005572065378900446, 'mean_word_length': 2.1109185441941074, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '965441', 'n_tokens_mistral': 1361, 'n_tokens_neox': 1246, 'n_words': 477}