Poster of Linux kernelThe best gift for a Linux geek
PetscDiffSolver

PetscDiffSolver

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

PetscDiffSolver -  

SYNOPSIS


#include <petsc_diff_solver.h>

Inherits DiffSolver.  

Public Types


typedef DiffSolver Parent

enum SolveResult { INVALID_SOLVE_RESULT = 0, CONVERGED_NO_REASON = 1, CONVERGED_ABSOLUTE_RESIDUAL = 2, CONVERGED_RELATIVE_RESIDUAL = 4, CONVERGED_ABSOLUTE_STEP = 8, CONVERGED_RELATIVE_STEP = 16, DIVERGED_NO_REASON = 32, DIVERGED_MAX_NONLINEAR_ITERATIONS = 64, DIVERGED_BACKTRACKING_FAILURE = 128 }

typedef DifferentiableSystem sys_type
 

Public Member Functions


PetscDiffSolver (sys_type &system)

virtual ~PetscDiffSolver ()

virtual void reinit ()

void init ()

void clear ()

virtual unsigned int solve ()

virtual unsigned int adjoint_solve ()

unsigned int total_outer_iterations ()

unsigned int total_inner_iterations ()

unsigned int solve_result ()

const sys_type & system () const

sys_type & system ()
 

Static Public Member Functions


static AutoPtr< DiffSolver > build (sys_type &s)

static std::string get_info ()

static void print_info ()

static unsigned int n_objects ()
 

Public Attributes


unsigned int max_linear_iterations

unsigned int max_nonlinear_iterations

bool quiet

bool continue_after_max_iterations

bool continue_after_backtrack_failure

Real absolute_residual_tolerance

Real relative_residual_tolerance

Real absolute_step_tolerance

Real relative_step_tolerance

Real initial_linear_tolerance

Real minimum_linear_tolerance
 

Protected Types


typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 

Protected Member Functions


void increment_constructor_count (const std::string &name)

void increment_destructor_count (const std::string &name)
 

Protected Attributes


SNES _snes

Real max_solution_norm

Real max_residual_norm

unsigned int _outer_iterations

unsigned int _inner_iterations

sys_type & _system

unsigned int _solve_result
 

Static Protected Attributes


static Counts _counts

static Threads::atomic< unsigned int > _n_objects

static Threads::spin_mutex _mutex
 

Detailed Description

This class defines a solver which uses a PETSc SNES context to handle a DifferentiableSystem

This class is part of the new DifferentiableSystem framework, which is still experimental. Users of this framework should beware of bugs and future API changes.

Author:

Roy H. Stogner 2008

Definition at line 52 of file petsc_diff_solver.h.  

Member Typedef Documentation

 

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.

Definition at line 105 of file reference_counter.h.  

typedef DiffSolver PetscDiffSolver::Parent

Definition at line 66 of file petsc_diff_solver.h.  

typedef DifferentiableSystem DiffSolver::sys_type [inherited]The type of system

Definition at line 56 of file diff_solver.h.  

Member Enumeration Documentation

 

enum DiffSolver::SolveResult [inherited]Enumeration return type for the solve() function. Multiple SolveResults may be combined (OR'd) in the single return. To test which ones are present, just AND the return value with any of the SolveResult flags defined below.

Enumerator:

INVALID_SOLVE_RESULT
A default or invalid solve result. This usually means no solve has occurred yet.
CONVERGED_NO_REASON
The solver converged but no particular reason is specified.
CONVERGED_ABSOLUTE_RESIDUAL
The DiffSolver achieved the desired absolute residual tolerance.
CONVERGED_RELATIVE_RESIDUAL
The DiffSolver achieved the desired relative residual tolerance.
CONVERGED_ABSOLUTE_STEP
The DiffSolver achieved the desired absolute step size tolerance.
CONVERGED_RELATIVE_STEP
The DiffSolver achieved the desired relative step size tolerance.
DIVERGED_NO_REASON
The DiffSolver diverged but no particular reason is specified.
DIVERGED_MAX_NONLINEAR_ITERATIONS
The DiffSolver reached the maximum allowed number of nonlinear iterations before satisfying any convergence tests.
DIVERGED_BACKTRACKING_FAILURE
The DiffSolver failed to find a descent direction by backtracking (See newton_solver.C)

Definition at line 200 of file diff_solver.h.

                   {
    INVALID_SOLVE_RESULT = 0,
    
    CONVERGED_NO_REASON = 1,

    CONVERGED_ABSOLUTE_RESIDUAL = 2,

    CONVERGED_RELATIVE_RESIDUAL = 4,

    CONVERGED_ABSOLUTE_STEP = 8,

    CONVERGED_RELATIVE_STEP = 16,

    DIVERGED_NO_REASON = 32,

    DIVERGED_MAX_NONLINEAR_ITERATIONS = 64,

    DIVERGED_BACKTRACKING_FAILURE = 128
  };
 

Constructor & Destructor Documentation

 

PetscDiffSolver::PetscDiffSolver (sys_type &system)Constructor. Requires a reference to the system to be solved.

Definition at line 155 of file petsc_diff_solver.C.

  : Parent(s)
{
}
 

PetscDiffSolver::~PetscDiffSolver () [virtual]Destructor.

Definition at line 199 of file petsc_diff_solver.C.

{
}
 

Member Function Documentation

 

unsigned int PetscDiffSolver::adjoint_solve () [virtual]This method performs an adjoint solve. What occurs in this method will depend on the PETSc KSP settings. See the PETSc documentation for more details.

Implements DiffSolver.

Definition at line 287 of file petsc_diff_solver.C.

References DiffSolver::_system, ExplicitSystem::assemble_qoi_derivative(), DifferentiableSystem::assembly(), DiffSolver::build(), SparseMatrix< T >::close(), DiffSolver::CONVERGED_RELATIVE_RESIDUAL, DofMap::enforce_constraints_exactly(), System::get_dof_map(), ImplicitSystem::get_matrix(), SparseMatrix< T >::get_transpose(), ImplicitSystem::have_matrix(), ImplicitSystem::matrix, DiffSolver::max_linear_iterations, DiffSolver::relative_residual_tolerance, ExplicitSystem::rhs, System::solution, and System::update().

{
  // The adjoint_solve API (and all APIs using it) are about to see a
  // series of non-backwards-compatible changes, primarily to add
  // multiple-QoI support
  libmesh_experimental();

  START_LOG('adjoint_solve()', 'PetscDiffSolver');

  // Do DiffSystem assembly
  _system.assembly(false, true);
  _system.matrix->close();

  // But take the adjoint
  _system.matrix->get_transpose(*_system.matrix);

  if (_system.have_matrix('Preconditioner'))
    {
      SparseMatrix<Number> &pre = _system.get_matrix('Preconditioner');
      pre.get_transpose(pre);
    }

  // And set the right hand side to the quantity of interest
  // derivative
  _system.assemble_qoi_derivative();

  // Then build something to solve the _linear_ system
  AutoPtr<LinearSolver<Number> > linear_solver = LinearSolver<Number>::build();

  // Solve the linear system.  Two cases:
  const std::pair<unsigned int, Real> rval =
    (_system.have_matrix('Preconditioner')) ?
  // 1.) User-supplied preconditioner
    linear_solver->solve (*_system.matrix,
                          _system.get_matrix('Preconditioner'),
                          *_system.solution, *_system.rhs,
                          relative_residual_tolerance,
                          max_linear_iterations) :
  // 2.) Use system matrix for the preconditioner
    linear_solver->solve (*_system.matrix,
                          *_system.solution, *_system.rhs,
                          relative_residual_tolerance, 
                          max_linear_iterations);

  // We may need to localize a parallel solution
  _system.update ();

  // The linear solver may not have fit our constraints exactly
#ifdef LIBMESH_ENABLE_AMR
  _system.get_dof_map().enforce_constraints_exactly(_system);
#endif

  STOP_LOG('adjoint_solve()', 'PetscDiffSolver');

  // FIXME - We'll worry about getting the solve result right later...
  
  return DiffSolver::CONVERGED_RELATIVE_RESIDUAL;
}
 

AutoPtr< DiffSolver > DiffSolver::build (sys_type &s) [static, inherited]Factory. Requires a reference to the system to be solved. Returns a NewtonSolver by default

Definition at line 47 of file diff_solver.C.

Referenced by adjoint_solve(), and TimeSolver::init().

{
  return AutoPtr<DiffSolver>(new NewtonSolver(s));
}
 

void PetscDiffSolver::clear ()The clear function. solve() calls this to destroy a used SNES context.

Definition at line 205 of file petsc_diff_solver.C.

References _snes, and libMesh::COMM_WORLD.

Referenced by solve().

{
  START_LOG('clear()', 'PetscDiffSolver');

  int ierr=0;

  ierr = SNESDestroy(_snes);
  CHKERRABORT(libMesh::COMM_WORLD,ierr);

  STOP_LOG('clear()', 'PetscDiffSolver');
}
 

std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.

Definition at line 45 of file reference_counter.C.

References ReferenceCounter::_counts, and Quality::name().

Referenced by ReferenceCounter::print_info().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)

  std::ostringstream out;
  
  out << '
      << ' ---------------------------------------------------------------------------- 
      << '| Reference count information                                                |
      << ' ---------------------------------------------------------------------------- ;
  
  for (Counts::iterator it = _counts.begin();
       it != _counts.end(); ++it)
    {
      const std::string name(it->first);
      const unsigned int creations    = it->second.first;
      const unsigned int destructions = it->second.second;

      out << '| ' << name << ' reference count information:
          << '|  Creations:    ' << creations    << '
          << '|  Destructions: ' << destructions << ';
    }
  
  out << ' ---------------------------------------------------------------------------- ;

  return out.str();

#else

  return '';
  
#endif
}
 

void ReferenceCounter::increment_constructor_count (const std::string &name) [inline, protected, inherited]Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.

Definition at line 149 of file reference_counter.h.

References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.

Referenced by ReferenceCountedObject< Value >::ReferenceCountedObject().

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.first++;
}
 

void ReferenceCounter::increment_destructor_count (const std::string &name) [inline, protected, inherited]Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.

Definition at line 167 of file reference_counter.h.

References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.

Referenced by ReferenceCountedObject< Value >::~ReferenceCountedObject().

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.second++;
}
 

void PetscDiffSolver::init () [virtual]The initialization function. solve() calls this to create a new SNES context.

Reimplemented from DiffSolver.

Definition at line 161 of file petsc_diff_solver.C.

References __libmesh_petsc_diff_solver_monitor(), _snes, libMesh::COMM_WORLD, and DiffSolver::init().

Referenced by solve().

{
  START_LOG('init()', 'PetscDiffSolver');

  Parent::init();

  int ierr=0;

#if PETSC_VERSION_LESS_THAN(2,1,2)
  // At least until Petsc 2.1.1, the SNESCreate had a different
  // calling syntax.  The second argument was of type SNESProblemType,
  // and could have a value of either SNES_NONLINEAR_EQUATIONS or
  // SNES_UNCONSTRAINED_MINIMIZATION.
  ierr = SNESCreate(libMesh::COMM_WORLD, SNES_NONLINEAR_EQUATIONS, &_snes);
  CHKERRABORT(libMesh::COMM_WORLD,ierr);
#else
  ierr = SNESCreate(libMesh::COMM_WORLD,&_snes);
  CHKERRABORT(libMesh::COMM_WORLD,ierr);
#endif

#if PETSC_VERSION_LESS_THAN(2,3,3)
  ierr = SNESSetMonitor (_snes, __libmesh_petsc_diff_solver_monitor,
                         this, PETSC_NULL);
#else
  // API name change in PETSc 2.3.3
  ierr = SNESMonitorSet (_snes, __libmesh_petsc_diff_solver_monitor,
                         this, PETSC_NULL);
#endif
  CHKERRABORT(libMesh::COMM_WORLD,ierr);

  ierr = SNESSetFromOptions(_snes);
  CHKERRABORT(libMesh::COMM_WORLD,ierr);

  STOP_LOG('init()', 'PetscDiffSolver');
}
 

static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 76 of file reference_counter.h.

References ReferenceCounter::_n_objects.

Referenced by System::read_serialized_blocked_dof_objects(), and System::write_serialized_blocked_dof_objects().

  { return _n_objects; }
 

void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.

Definition at line 83 of file reference_counter.C.

References ReferenceCounter::get_info().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
  
  std::cout << ReferenceCounter::get_info();
  
#endif
}
 

void PetscDiffSolver::reinit () [virtual]The reinitialization function. This method is used after changes in the mesh.

Reimplemented from DiffSolver.

Definition at line 219 of file petsc_diff_solver.C.

References DiffSolver::reinit().

{
  Parent::reinit();
}
 

unsigned int PetscDiffSolver::solve () [virtual]This method performs a solve. What occurs in this method will depend on the PETSc SNES settings. See the PETSc documentation for more details.

Implements DiffSolver.

Definition at line 226 of file petsc_diff_solver.C.

References __libmesh_petsc_diff_solver_jacobian(), __libmesh_petsc_diff_solver_residual(), DiffSolver::_outer_iterations, _snes, DiffSolver::_system, clear(), PetscMatrix< T >::close(), PetscVector< T >::close(), libMesh::COMM_WORLD, DiffSolver::CONVERGED_RELATIVE_RESIDUAL, DofMap::enforce_constraints_exactly(), AutoPtr< Tp >::get(), System::get_dof_map(), init(), PetscMatrix< T >::mat(), ImplicitSystem::matrix, ExplicitSystem::rhs, System::solution, and PetscVector< T >::vec().

{
  this->init();

  START_LOG('solve()', 'PetscDiffSolver');

  PetscVector<Number> &x =
    *(libmesh_cast_ptr<PetscVector<Number>*>(_system.solution.get()));
  PetscMatrix<Number> &jac =
    *(libmesh_cast_ptr<PetscMatrix<Number>*>(_system.matrix));
  PetscVector<Number> &r =
    *(libmesh_cast_ptr<PetscVector<Number>*>(_system.rhs));

  x.close();
  r.close();
  jac.close();

#ifdef LIBMESH_ENABLE_AMR
  _system.get_dof_map().enforce_constraints_exactly(_system);
#endif

  int ierr = 0;

  ierr = SNESSetFunction (_snes, r.vec(),
                          __libmesh_petsc_diff_solver_residual, this);
    CHKERRABORT(libMesh::COMM_WORLD,ierr);

  ierr = SNESSetJacobian (_snes, jac.mat(), jac.mat(),
                          __libmesh_petsc_diff_solver_jacobian, this);
    CHKERRABORT(libMesh::COMM_WORLD,ierr);

# if PETSC_VERSION_LESS_THAN(2,2,0)

  ierr = SNESSolve (_snes, x.vec(), &_outer_iterations);
         CHKERRABORT(libMesh::COMM_WORLD,ierr);

// 2.2.x style
#elif PETSC_VERSION_LESS_THAN(2,3,0)

  ierr = SNESSolve (_snes, x.vec());
         CHKERRABORT(libMesh::COMM_WORLD,ierr);

// 2.3.x & newer style
#else

  ierr = SNESSolve (_snes, PETSC_NULL, x.vec());
         CHKERRABORT(libMesh::COMM_WORLD,ierr);

#endif

  STOP_LOG('solve()', 'PetscDiffSolver');

  this->clear();

  // FIXME - We'll worry about getting the solve result right later...
  
  return DiffSolver::CONVERGED_RELATIVE_RESIDUAL;
}
 

unsigned int DiffSolver::solve_result () [inline, inherited]Returns:

the value of the SolveResult from the last solve.

Definition at line 116 of file diff_solver.h.

References DiffSolver::_solve_result.

{ return _solve_result; }
 

const sys_type& DiffSolver::system () const [inline, inherited]Returns:

a constant reference to the system we are solving.

Definition at line 121 of file diff_solver.h.

References DiffSolver::_system.

Referenced by __libmesh_petsc_diff_solver_jacobian(), and __libmesh_petsc_diff_solver_residual().

{ return _system; }
 

sys_type& DiffSolver::system () [inline, inherited]Returns:

a writeable reference to the system we are solving.

Definition at line 126 of file diff_solver.h.

References DiffSolver::_system.

{ return _system; }
 

unsigned int DiffSolver::total_inner_iterations () [inline, inherited]Returns:

the number of 'inner' (e.g. Krylov) iterations required by the last solve.

Definition at line 111 of file diff_solver.h.

References DiffSolver::_inner_iterations.

{ return _inner_iterations; }
 

unsigned int DiffSolver::total_outer_iterations () [inline, inherited]Returns:

the number of 'outer' (e.g. quasi-Newton) iterations required by the last solve.

Definition at line 105 of file diff_solver.h.

References DiffSolver::_outer_iterations.

{ return _outer_iterations; }
 

Member Data Documentation

 

ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.

Definition at line 110 of file reference_counter.h.

Referenced by ReferenceCounter::get_info(), ReferenceCounter::increment_constructor_count(), and ReferenceCounter::increment_destructor_count().  

unsigned int DiffSolver::_inner_iterations [protected, inherited]The number of inner iterations used by the last solve

Definition at line 280 of file diff_solver.h.

Referenced by NewtonSolver::solve(), and DiffSolver::total_inner_iterations().  

Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited]Mutual exclusion object to enable thread-safe reference counting.

Definition at line 123 of file reference_counter.h.  

Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.

Definition at line 118 of file reference_counter.h.

Referenced by ReferenceCounter::n_objects(), ReferenceCounter::ReferenceCounter(), and ReferenceCounter::~ReferenceCounter().  

unsigned int DiffSolver::_outer_iterations [protected, inherited]The number of outer iterations used by the last solve

Definition at line 275 of file diff_solver.h.

Referenced by NewtonSolver::line_search(), solve(), NewtonSolver::solve(), and DiffSolver::total_outer_iterations().  

SNES PetscDiffSolver::_snes [protected]Nonlinear solver context

Definition at line 105 of file petsc_diff_solver.h.

Referenced by clear(), init(), and solve().  

unsigned int DiffSolver::_solve_result [protected, inherited]Initialized to zero. solve_result is typically set internally in the solve() function before it returns. When non-zero, solve_result tells the result of the latest solve. See enum definition for description.

Definition at line 293 of file diff_solver.h.

Referenced by NewtonSolver::line_search(), NewtonSolver::solve(), DiffSolver::solve_result(), and NewtonSolver::test_convergence().  

sys_type& DiffSolver::_system [protected, inherited]A reference to the system we are solving.

Definition at line 285 of file diff_solver.h.

Referenced by adjoint_solve(), NewtonSolver::adjoint_solve(), NewtonSolver::line_search(), solve(), NewtonSolver::solve(), and DiffSolver::system().  

Real DiffSolver::absolute_residual_tolerance [inherited]The DiffSolver should exit after the residual is reduced to either less than absolute_residual_tolerance or less than relative_residual_tolerance times the initial residual.

Users should increase any of these tolerances that they want to use for a stopping condition.

Definition at line 169 of file diff_solver.h.

Referenced by NewtonSolver::print_convergence(), and NewtonSolver::test_convergence().  

Real DiffSolver::absolute_step_tolerance [inherited]The DiffSolver should exit after the full nonlinear step norm is reduced to either less than absolute_step_tolerance or less than relative_step_tolerance times the largest nonlinear solution which has been seen so far.

Users should increase any of these tolerances that they want to use for a stopping condition.

Definition at line 181 of file diff_solver.h.

Referenced by NewtonSolver::print_convergence(), and NewtonSolver::test_convergence().  

bool DiffSolver::continue_after_backtrack_failure [inherited]Defaults to false, telling the DiffSolver to throw a libmesh_error() when the backtracking scheme fails to find a descent direction.

Definition at line 158 of file diff_solver.h.

Referenced by NewtonSolver::line_search().  

bool DiffSolver::continue_after_max_iterations [inherited]Defaults to true, telling the DiffSolver to continue rather than exit when a solve has reached its maximum number of nonlinear iterations.

Definition at line 152 of file diff_solver.h.

Referenced by NewtonSolver::solve().  

Real DiffSolver::initial_linear_tolerance [inherited]Any required linear solves will at first be done with this tolerance; the DiffSolver may tighten the tolerance for later solves.

Definition at line 188 of file diff_solver.h.

Referenced by NewtonSolver::solve().  

unsigned int DiffSolver::max_linear_iterations [inherited]Each linear solver step should exit after max_linear_iterations is exceeded.

Definition at line 132 of file diff_solver.h.

Referenced by adjoint_solve(), NewtonSolver::adjoint_solve(), ContinuationSystem::continuation_solve(), NewtonSolver::solve(), and ContinuationSystem::solve_tangent().  

unsigned int DiffSolver::max_nonlinear_iterations [inherited]The DiffSolver should exit in failure if max_nonlinear_iterations is exceeded and continue_after_max_iterations is false, or should end the nonlinear solve if max_nonlinear_iterations is exceeded and continue_after_max_iterations is true.

Definition at line 140 of file diff_solver.h.

Referenced by ContinuationSystem::continuation_solve(), NewtonSolver::solve(), and ContinuationSystem::update_solution().  

Real DiffSolver::max_residual_norm [protected, inherited]The largest nonlinear residual which the DiffSolver has yet seen will be stored here, to be used for stopping criteria based on relative_residual_tolerance

Definition at line 270 of file diff_solver.h.

Referenced by DiffSolver::init(), NewtonSolver::print_convergence(), DiffSolver::reinit(), NewtonSolver::solve(), and NewtonSolver::test_convergence().  

Real DiffSolver::max_solution_norm [protected, inherited]The largest solution norm which the DiffSolver has yet seen will be stored here, to be used for stopping criteria based on relative_step_tolerance

Definition at line 263 of file diff_solver.h.

Referenced by DiffSolver::init(), NewtonSolver::print_convergence(), DiffSolver::reinit(), NewtonSolver::solve(), and NewtonSolver::test_convergence().  

Real DiffSolver::minimum_linear_tolerance [inherited]The tolerance for linear solves is kept above this minimum

Definition at line 193 of file diff_solver.h.

Referenced by NewtonSolver::solve().  

bool DiffSolver::quiet [inherited]The DiffSolver should not print anything to std::cout unless quiet is set to false

Definition at line 146 of file diff_solver.h.

Referenced by NewtonSolver::adjoint_solve(), NewtonSolver::line_search(), NewtonSolver::print_convergence(), and NewtonSolver::solve().  

Real DiffSolver::relative_residual_tolerance [inherited]

Definition at line 170 of file diff_solver.h.

Referenced by adjoint_solve(), NewtonSolver::adjoint_solve(), NewtonSolver::print_convergence(), and NewtonSolver::test_convergence().  

Real DiffSolver::relative_step_tolerance [inherited]

Definition at line 182 of file diff_solver.h.

Referenced by NewtonSolver::print_convergence(), and NewtonSolver::test_convergence().

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Types
Public Member Functions
Static Public Member Functions
Public Attributes
Protected Types
Protected Member Functions
Protected Attributes
Static Protected Attributes
Detailed Description
Member Typedef Documentation
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.
typedef DiffSolver PetscDiffSolver::Parent
typedef DifferentiableSystem DiffSolver::sys_type [inherited]The type of system
Member Enumeration Documentation
enum DiffSolver::SolveResult [inherited]Enumeration return type for the solve() function. Multiple SolveResults may be combined (OR'd) in the single return. To test which ones are present, just AND the return value with any of the SolveResult flags defined below.
Constructor & Destructor Documentation
PetscDiffSolver::PetscDiffSolver (sys_type &system)Constructor. Requires a reference to the system to be solved.
PetscDiffSolver::~PetscDiffSolver () [virtual]Destructor.
Member Function Documentation
unsigned int PetscDiffSolver::adjoint_solve () [virtual]This method performs an adjoint solve. What occurs in this method will depend on the PETSc KSP settings. See the PETSc documentation for more details.
AutoPtr< DiffSolver > DiffSolver::build (sys_type &s) [static, inherited]Factory. Requires a reference to the system to be solved. Returns a NewtonSolver by default
void PetscDiffSolver::clear ()The clear function. solve() calls this to destroy a used SNES context.
std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.
void ReferenceCounter::increment_constructor_count (const std::string &name) [inline, protected, inherited]Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
void ReferenceCounter::increment_destructor_count (const std::string &name) [inline, protected, inherited]Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
void PetscDiffSolver::init () [virtual]The initialization function. solve() calls this to create a new SNES context.
static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.
void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.
void PetscDiffSolver::reinit () [virtual]The reinitialization function. This method is used after changes in the mesh.
unsigned int PetscDiffSolver::solve () [virtual]This method performs a solve. What occurs in this method will depend on the PETSc SNES settings. See the PETSc documentation for more details.
unsigned int DiffSolver::solve_result () [inline, inherited]Returns:
const sys_type& DiffSolver::system () const [inline, inherited]Returns:
sys_type& DiffSolver::system () [inline, inherited]Returns:
unsigned int DiffSolver::total_inner_iterations () [inline, inherited]Returns:
unsigned int DiffSolver::total_outer_iterations () [inline, inherited]Returns:
Member Data Documentation
ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.
unsigned int DiffSolver::_inner_iterations [protected, inherited]The number of inner iterations used by the last solve
Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited]Mutual exclusion object to enable thread-safe reference counting.
Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.
unsigned int DiffSolver::_outer_iterations [protected, inherited]The number of outer iterations used by the last solve
SNES PetscDiffSolver::_snes [protected]Nonlinear solver context
unsigned int DiffSolver::_solve_result [protected, inherited]Initialized to zero. solve_result is typically set internally in the solve() function before it returns. When non-zero, solve_result tells the result of the latest solve. See enum definition for description.
sys_type& DiffSolver::_system [protected, inherited]A reference to the system we are solving.
Real DiffSolver::absolute_residual_tolerance [inherited]The DiffSolver should exit after the residual is reduced to either less than absolute_residual_tolerance or less than relative_residual_tolerance times the initial residual.
Real DiffSolver::absolute_step_tolerance [inherited]The DiffSolver should exit after the full nonlinear step norm is reduced to either less than absolute_step_tolerance or less than relative_step_tolerance times the largest nonlinear solution which has been seen so far.
bool DiffSolver::continue_after_backtrack_failure [inherited]Defaults to false, telling the DiffSolver to throw a libmesh_error() when the backtracking scheme fails to find a descent direction.
bool DiffSolver::continue_after_max_iterations [inherited]Defaults to true, telling the DiffSolver to continue rather than exit when a solve has reached its maximum number of nonlinear iterations.
Real DiffSolver::initial_linear_tolerance [inherited]Any required linear solves will at first be done with this tolerance; the DiffSolver may tighten the tolerance for later solves.
unsigned int DiffSolver::max_linear_iterations [inherited]Each linear solver step should exit after max_linear_iterations is exceeded.
unsigned int DiffSolver::max_nonlinear_iterations [inherited]The DiffSolver should exit in failure if max_nonlinear_iterations is exceeded and continue_after_max_iterations is false, or should end the nonlinear solve if max_nonlinear_iterations is exceeded and continue_after_max_iterations is true.
Real DiffSolver::max_residual_norm [protected, inherited]The largest nonlinear residual which the DiffSolver has yet seen will be stored here, to be used for stopping criteria based on relative_residual_tolerance
Real DiffSolver::max_solution_norm [protected, inherited]The largest solution norm which the DiffSolver has yet seen will be stored here, to be used for stopping criteria based on relative_step_tolerance
Real DiffSolver::minimum_linear_tolerance [inherited]The tolerance for linear solves is kept above this minimum
bool DiffSolver::quiet [inherited]The DiffSolver should not print anything to std::cout unless quiet is set to false
Real DiffSolver::relative_residual_tolerance [inherited]
Real DiffSolver::relative_step_tolerance [inherited]
Author

This document was created by man2html, using the manual pages.
Time: 21:52:24 GMT, April 16, 2011