| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// LOCA: Library of Continuation Algorithms Package |
| 4 |
// |
| 5 |
// Copyright 2001-2005 NTESS and the LOCA 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 "LOCA_Parameter_Vector.H" |
| 23 |
#include "LOCA_Epetra_Interface_Required.H" // base class |
| 24 |
#include "NOX_Epetra_Interface_Jacobian.H" // base class |
| 25 |
#include "NOX_Epetra_Interface_Preconditioner.H" // base class |
| 26 |
#include "LOCA_Epetra_Interface_TimeDependent.H" // base class |
| 27 |
|
| 28 |
// ---------- Forward Declarations ---------- |
| 29 |
class Brusselator; |
| 30 |
|
| 31 |
class Problem_Interface : public NOX::Epetra::Interface::Jacobian, |
| 32 |
public NOX::Epetra::Interface::Preconditioner, |
| 33 |
public LOCA::Epetra::Interface::TimeDependent |
| 34 |
{ |
| 35 |
public: |
| 36 |
Problem_Interface(Brusselator& Problem); |
| 37 |
~Problem_Interface(); |
| 38 |
|
| 39 |
//! Compute and return F (LOCA::Epetra::Interface::Required) |
| 40 |
bool computeF(const Epetra_Vector& x, Epetra_Vector& FVec, |
| 41 |
NOX::Epetra::Interface::Required::FillType fillType); |
| 42 |
|
| 43 |
//! Compute an explicit Jacobian (NOX::Epetra::Interface::Jacobian) |
| 44 |
bool computeJacobian(const Epetra_Vector& x, Epetra_Operator& Jac); |
| 45 |
|
| 46 |
//! Set a parameter in the user's code. (LOCA::Epetra::Interface::Required) |
| 47 |
void setParameters(const LOCA::ParameterVector& params); |
| 48 |
|
| 49 |
//! Call user's own print routine for vector-parameter pair (LOCA::Epetra::Interface::Required) |
| 50 |
virtual void printSolution(const Epetra_Vector& x_, double conParam); |
| 51 |
|
| 52 |
//! Routine to set data for file indexing in subsequent printSolution call |
| 53 |
virtual void dataForPrintSolution(const int conStep, const int timeStep, |
| 54 |
const int numTimeSteps); |
| 55 |
|
| 56 |
//! Calculation of preconditioner (NOX::Epetra::Interface::Preconditioner) |
| 57 |
bool computePrecMatrix(const Epetra_Vector& x, Epetra_RowMatrix& M); |
| 58 |
|
| 59 |
//! Computes a user supplied preconditioner based on input vector x. Returns true if computation was successful. (NOX::Epetra::Interface::Preconditioner) |
| 60 |
bool computePreconditioner(const Epetra_Vector& x, |
| 61 |
Epetra_Operator& Prec, |
| 62 |
Teuchos::ParameterList* p); |
| 63 |
|
| 64 |
//! Compute a Time Dependent Shifted Matrix (LOCA::Epetra::Interface::TimeDependent) |
| 65 |
bool computeShiftedMatrix(double alpha, double beta, const Epetra_Vector& x, |
| 66 |
Epetra_Operator& shMat); |
| 67 |
|
| 68 |
//! Set the time derivative of the solution for use in the computeF routine |
| 69 |
// (LOCA::Epetra::Interface::TimeDependent), and absolut time as well |
| 70 |
void setXdot(const Epetra_Vector& xDot, const double time); |
| 71 |
|
| 72 |
//! Application Operator: Object that points to the user's evaluation routines. |
| 73 |
/*! This is used to point to the actual routines and to store |
| 74 |
* auxiliary data required by the user's application for function/Jacobian |
| 75 |
* evaluations that NOX does not need to know about. This is type of |
| 76 |
* passdown class design by the application code. |
| 77 |
*/ |
| 78 |
Brusselator& problem; |
| 79 |
|
| 80 |
private: |
| 81 |
// temporarily keep this routine around while incrementally refactoring |
| 82 |
bool computeMassMatrix(const Epetra_Vector& x); |
| 83 |
|
| 84 |
int conStep; // Output continuation step index |
| 85 |
int timeStep; // Output time step index |
| 86 |
}; |
| 87 |
|
| 88 |
#endif |
| 89 |
|