| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// NOX: An Object-Oriented Nonlinear Solver Package |
| 4 |
// |
| 5 |
// Copyright 2002 NTESS and the NOX contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
//----------------------------------------------------------------------------- |
| 11 |
#ifndef Problem_Interface_H |
| 12 |
#define Problem_Interface_H |
| 13 |
|
| 14 |
// Interface to the NOX_Epetra_Group to provide for |
| 15 |
// residual and matrix fill routines. |
| 16 |
|
| 17 |
// ---------- Standard Includes ---------- |
| 18 |
#include <iostream> |
| 19 |
#include "Epetra_Vector.h" |
| 20 |
#include "Epetra_Operator.h" |
| 21 |
#include "Epetra_RowMatrix.h" |
| 22 |
#include "NOX_Epetra.H" |
| 23 |
|
| 24 |
// ---------- Forward Declarations ---------- |
| 25 |
class GenericEpetraProblem; |
| 26 |
|
| 27 |
class Problem_Interface : public NOX::Epetra::Interface::Required, |
| 28 |
public NOX::Epetra::Interface::Jacobian, |
| 29 |
public NOX::Epetra::Interface::Preconditioner |
| 30 |
{ |
| 31 |
public: |
| 32 |
Problem_Interface(GenericEpetraProblem& Problem); |
| 33 |
~Problem_Interface(); |
| 34 |
|
| 35 |
//! Compute and return F |
| 36 |
bool computeF(const Epetra_Vector& x, Epetra_Vector& FVec, |
| 37 |
FillType flag = Residual); |
| 38 |
|
| 39 |
//! Compute an explicit Jacobian |
| 40 |
bool computeJacobian(const Epetra_Vector& x, |
| 41 |
Epetra_Operator& Jac); |
| 42 |
|
| 43 |
//! Compute the Epetra_RowMatrix M, that will be used by the Aztec preconditioner instead of the Jacobian. This is used when there is no explicit Jacobian present (i.e. Matrix-Free Newton-Krylov). This MUST BE an Epetra_RowMatrix since the Aztec preconditioners need to know the sparsity pattern of the matrix. Returns true if computation was successful. |
| 44 |
bool computePrecMatrix(const Epetra_Vector& x); |
| 45 |
|
| 46 |
//! Computes a user supplied preconditioner based on input vector x. Returns true if computation was successful. |
| 47 |
bool computePreconditioner(const Epetra_Vector& x, |
| 48 |
Epetra_Operator& Prec, |
| 49 |
Teuchos::ParameterList* precParams = 0); |
| 50 |
|
| 51 |
//! Application Operator: Object that points to the user's evaluation routines. |
| 52 |
/*! This is used to point to the actual routines and to store |
| 53 |
* auxiliary data required by the user's application for function/Jacobian |
| 54 |
* evaluations that NOX does not need to know about. This is type of |
| 55 |
* passdown class design by the application code. |
| 56 |
*/ |
| 57 |
GenericEpetraProblem& problem; |
| 58 |
}; |
| 59 |
|
| 60 |
#endif |