| 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 |
// Finite Element Problem Class |
| 11 |
/* Provides function (RHS) and Jacobian evaluations for the |
| 12 |
* 2 equation test for quadratic and cubic line searches |
| 13 |
* from Dennis & Schnabel's book, chp 6. example 6.5.1 |
| 14 |
* |
| 15 |
* U0**2 + U1**2 - 2 = 0 |
| 16 |
* exp(U0-1) + U1**3 -2 = 0 |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifndef _NOX_EXAMPLE_DENNIS_SCHNABEL_651_H |
| 20 |
#define _NOX_EXAMPLE_DENNIS_SCHNABEL_651_H |
| 21 |
|
| 22 |
// Forward Declarations |
| 23 |
#include "petscksp.h" |
| 24 |
|
| 25 |
// Flag to tell the evaluate routine what objects to fill |
| 26 |
enum FillType {RHS_ONLY, MATRIX_ONLY, ALL}; |
| 27 |
|
| 28 |
// Finite Element Problem Class |
| 29 |
class DennisSchnabel { |
| 30 |
|
| 31 |
public: |
| 32 |
|
| 33 |
// Constructor |
| 34 |
DennisSchnabel(int NumGlobalElements); |
| 35 |
|
| 36 |
// Destructor |
| 37 |
~DennisSchnabel(); |
| 38 |
|
| 39 |
// Evaluates the function (RHS) and/or the Jacobian using the solution |
| 40 |
// values in solnVector. |
| 41 |
bool evaluate(FillType f, const Vec *solnVector, |
| 42 |
Vec *rhsVector, Mat *matrix); |
| 43 |
|
| 44 |
// Return a reference to the Vec with the initial guess |
| 45 |
// that is generated by this class. |
| 46 |
Vec& getSolution(); |
| 47 |
|
| 48 |
// Return a reference to the Vec with the Jacobian |
| 49 |
// that is generated by this class. |
| 50 |
Mat& getJacobian(); |
| 51 |
|
| 52 |
private: |
| 53 |
|
| 54 |
// inserts the global column indices into the Graph |
| 55 |
// Epetra_CrsGraph& generateGraph(Epetra_CrsGraph& AA); |
| 56 |
|
| 57 |
private: |
| 58 |
|
| 59 |
FillType flag; |
| 60 |
Vec *initialSolution; |
| 61 |
Vec *overlapSolution; |
| 62 |
Vec *soln; |
| 63 |
Vec *rhs; |
| 64 |
Mat *A; |
| 65 |
VecScatter* petscMap; |
| 66 |
|
| 67 |
int MyPID; // Process number |
| 68 |
int NumProc; // Total number of processes |
| 69 |
int NumMyElements; // Number of elements owned by this process |
| 70 |
int NumGlobalElements; // Total Number of elements |
| 71 |
|
| 72 |
}; |
| 73 |
#endif |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|