| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// Trilinos: An Object-Oriented Solver Framework |
| 4 |
// |
| 5 |
// Copyright 2001-2024 NTESS and the Trilinos 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 |
|
| 15 |
// ML headers |
| 16 |
#include "ml_common.h" |
| 17 |
#include "TrilinosCouplings_config.h" |
| 18 |
|
| 19 |
#if defined(HAVE_ML_NOX) && defined(HAVE_ML_EPETRA) && defined(HAVE_ML_AZTECOO) && defined(HAVE_ML_TEUCHOS) && defined(HAVE_ML_IFPACK) && defined(HAVE_ML_AMESOS) && defined(HAVE_ML_EPETRAEXT) |
| 20 |
#include "ml_include.h" |
| 21 |
#include "nlnml_finelevelnoxinterface.H" |
| 22 |
// ---------- Standard Includes ---------- |
| 23 |
#include <iostream> |
| 24 |
#include "Epetra_Vector.h" |
| 25 |
#include "Epetra_Operator.h" |
| 26 |
#include "Epetra_RowMatrix.h" |
| 27 |
|
| 28 |
#include "FiniteElementProblem.H" |
| 29 |
// ---------- Forward Declarations ---------- |
| 30 |
class FiniteElementProblem; |
| 31 |
|
| 32 |
class Problem_Interface : public NLNML::NLNML_FineLevelNoxInterface |
| 33 |
{ |
| 34 |
public: |
| 35 |
explicit Problem_Interface(FiniteElementProblem& Problem); |
| 36 |
|
| 37 |
virtual ~Problem_Interface(); |
| 38 |
|
| 39 |
//! Compute and return F |
| 40 |
bool computeF(const Epetra_Vector& x, Epetra_Vector& F, const FillType fillFlag); |
| 41 |
|
| 42 |
//! Compute an explicit Jacobian |
| 43 |
bool computeJacobian(const Epetra_Vector& x, Epetra_Operator& Jac); |
| 44 |
|
| 45 |
// return the Jacobian from the problem |
| 46 |
Epetra_CrsMatrix* getJacobian() |
| 47 |
{ |
| 48 |
Epetra_CrsMatrix& Jac = problem.getJacobian(); |
| 49 |
return(&Jac); |
| 50 |
} |
| 51 |
|
| 52 |
// return the graph from the problem |
| 53 |
const Epetra_CrsGraph* getGraph() {const Epetra_CrsGraph& Graph = problem.getGraph(); |
| 54 |
return(&Graph);} |
| 55 |
const Epetra_CrsGraph* getModifiedGraph() {const Epetra_CrsGraph& Graph = problem.getGraph(); |
| 56 |
return(&Graph);} |
| 57 |
|
| 58 |
// return the current solution from the problem |
| 59 |
const Epetra_Vector* getSolution() {const Epetra_Vector& vec = problem.getSolution(); return &vec; } |
| 60 |
|
| 61 |
// return the Map from the problem |
| 62 |
const Epetra_Map& getMap() { return problem.getMap(); } |
| 63 |
|
| 64 |
// get nullspace |
| 65 |
double* Get_Nullspace(const int nummyrows, const int numpde, const int dim_nullsp) |
| 66 |
{ |
| 67 |
return NULL; |
| 68 |
} |
| 69 |
|
| 70 |
// get block information |
| 71 |
bool getBlockInfo(int *nblocks, std::vector<int>& blocks, std::vector<int>& block_pde) |
| 72 |
{ *nblocks = 0; blocks.clear(); block_pde.clear(); return false; } |
| 73 |
|
| 74 |
// derived from NOX::Parameter::PrePostOperator |
| 75 |
const std::string& getType() const { return type_; } |
| 76 |
|
| 77 |
//! Application Operator: Object that points to the user's evaluation routines. |
| 78 |
/*! This is used to point to the actual routines and to store |
| 79 |
* auxiliary data required by the user's application for function/Jacobian |
| 80 |
* evaluations that NOX does not need to know about. This is type of |
| 81 |
* passdown class design by the application code. |
| 82 |
*/ |
| 83 |
|
| 84 |
FiniteElementProblem& problem; |
| 85 |
std::string type_; |
| 86 |
}; |
| 87 |
|
| 88 |
#endif // defined(HAVE_ML_NOX) && defined(HAVE_ML_EPETRA) && defined(HAVE_ML_AZTECOO) |
| 89 |
#endif |