Debian Codegraph @

packages/nox/test/epetra/LOCA_TestProblems/Problem_Interface.C

raw
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 "Epetra_CrsMatrix.h"
13 #include "Problem_Interface.H"
14 #include "LOCA_Parameter_Vector.H"
15
16 // ---------- User Defined Includes ----------
17 #include "FiniteElementProblem.H"
18
19 //-----------------------------------------------------------------------------
20 Problem_Interface::Problem_Interface(FiniteElementProblem& Problem) :
21 problem(Problem),
22 numFillsF(0)
23 {
24 }
25
26 Problem_Interface::~Problem_Interface()
27 { }
28
29 bool Problem_Interface::computeF(const Epetra_Vector& x, Epetra_Vector& F, FillType flag)
30 {
31 ++numFillsF;
32 return problem.evaluate(F_ONLY, &x, &F, NULL);
33 }
34
35 bool Problem_Interface::computeJacobian(const Epetra_Vector& x,
36 Epetra_Operator& Jac)
37 {
38 return problem.evaluate(MATRIX_ONLY, &x, NULL,&problem.getJacobian(),
39 1.0, 0.0);
40 }
41
42 bool Problem_Interface::computeShiftedMatrix(double alpha, double beta,
43 const Epetra_Vector& x,
44 Epetra_Operator& A)
45 {
46 return problem.evaluate(MATRIX_ONLY, &x, NULL,&problem.getJacobian(),
47 alpha, beta);
48 }
49
50 void Problem_Interface::setParameters(const LOCA::ParameterVector& params)
51 {
52 for (int i = 0; i < params.length(); i++ ) {
53 problem.setParameter(params.getLabel(i), params.getValue(i));
54 }
55 }
56 //-----------------------------------------------------------------------------
57