| 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 |
#include "TrilinosCouplings_IntrepidPoissonExample_SolveWithBelos.hpp" |
| 11 |
#include "TrilinosCouplings_EpetraIntrepidPoissonExample.hpp" |
| 12 |
#include <BelosEpetraAdapter.hpp> |
| 13 |
|
| 14 |
|
| 15 |
namespace TrilinosCouplings { |
| 16 |
namespace EpetraIntrepidPoissonExample { |
| 17 |
|
| 18 |
void |
| 19 |
solveWithBelos (bool& converged, |
| 20 |
int& numItersPerformed, |
| 21 |
const std::string& solverName, |
| 22 |
const Teuchos::ScalarTraits<ST>::magnitudeType& tol, |
| 23 |
const int maxNumIters, |
| 24 |
const int num_steps, |
| 25 |
const Teuchos::RCP<multivector_type>& X, |
| 26 |
const Teuchos::RCP<const sparse_matrix_type>& A, |
| 27 |
const Teuchos::RCP<const multivector_type>& B, |
| 28 |
const Teuchos::RCP<operator_type>& M_left, |
| 29 |
const Teuchos::RCP<operator_type>& M_right) |
| 30 |
{ |
| 31 |
typedef multivector_type MV; |
| 32 |
typedef operator_type OP; |
| 33 |
|
| 34 |
// Create prec operator out of M (Apply->ApplyInverse) |
| 35 |
Teuchos::RCP<const operator_type> Mp_left = M_left; |
| 36 |
Teuchos::RCP<const operator_type> Mp_right = M_right; |
| 37 |
if (! M_left.is_null ()) { |
| 38 |
Mp_left = Teuchos::rcp (new Belos::EpetraPrecOp (M_left)); |
| 39 |
} |
| 40 |
if (! M_right.is_null ()) { |
| 41 |
Mp_right = Teuchos::rcp (new Belos::EpetraPrecOp (M_right)); |
| 42 |
} |
| 43 |
|
| 44 |
// Invoke the generic solve routine. |
| 45 |
IntrepidPoissonExample::solveWithBelos<ST, MV, OP> (converged, numItersPerformed, |
| 46 |
solverName, tol, maxNumIters, |
| 47 |
num_steps, |
| 48 |
X, A, B, Mp_left, Mp_right); |
| 49 |
} |
| 50 |
|
| 51 |
} // namespace EpetraIntrepidPoissonExample |
| 52 |
} // namespace TrilinosCouplings |