| 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 |
// ---------- Includes ---------- |
| 11 |
#include <iostream> |
| 12 |
#include "Problem_Interface.H" |
| 13 |
|
| 14 |
// ---------- User Defined Includes ---------- |
| 15 |
#include "Brusselator.H" |
| 16 |
#include "Epetra_RowMatrix.h" |
| 17 |
|
| 18 |
//----------------------------------------------------------------------------- |
| 19 |
Problem_Interface::Problem_Interface(Brusselator& Problem) : |
| 20 |
problem(Problem) |
| 21 |
{ } |
| 22 |
|
| 23 |
Problem_Interface::~Problem_Interface() |
| 24 |
{ } |
| 25 |
|
| 26 |
bool Problem_Interface::computeF(const Epetra_Vector& x, Epetra_Vector& FVec, |
| 27 |
NOX::Epetra::Interface::Required::FillType fillType) |
| 28 |
{ |
| 29 |
return problem.evaluate(F_ONLY, &x, &FVec, NULL); |
| 30 |
} |
| 31 |
|
| 32 |
bool Problem_Interface::computeJacobian(const Epetra_Vector& x, |
| 33 |
Epetra_Operator& Jac) |
| 34 |
{ |
| 35 |
return problem.evaluate(MATRIX_ONLY, &x, NULL, |
| 36 |
dynamic_cast<Epetra_RowMatrix*>(&Jac), |
| 37 |
1.0, 0.0); |
| 38 |
} |
| 39 |
|
| 40 |
void Problem_Interface::setParameters(const LOCA::ParameterVector& params) |
| 41 |
{ |
| 42 |
problem.setParameters(params.getValue("alpha"), |
| 43 |
params.getValue("beta"), |
| 44 |
params.getValue("D1"), |
| 45 |
params.getValue("D2")); |
| 46 |
} |
| 47 |
|
| 48 |
bool Problem_Interface::computeShiftedMatrix(double alpha, double beta, |
| 49 |
const Epetra_Vector& x, |
| 50 |
Epetra_Operator& A) |
| 51 |
{ |
| 52 |
return problem.evaluate(MATRIX_ONLY, &x, NULL, |
| 53 |
dynamic_cast<Epetra_RowMatrix*>(&A), alpha, beta); |
| 54 |
} |
| 55 |
|
| 56 |
//----------------------------------------------------------------------------- |
| 57 |
|